Skip to content

Commit

Permalink
Merge pull request #445 from ajdapretnar/canvas-fix
Browse files Browse the repository at this point in the history
Compatibility with split canvas
  • Loading branch information
PrimozGodec authored Jul 2, 2019
2 parents 56d3165 + 20cb702 commit d2fab8a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
8 changes: 6 additions & 2 deletions orangecontrib/text/nyt.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@


from Orange import data
from Orange.canvas.utils import environ
from orangecontrib.text.corpus import Corpus

try:
from Orange.misc import environ
except ImportError:
from Orange.canvas.utils import environ

SLEEP = 1
TIMEOUT = 10
MAX_DOCS = 1000
Expand Down Expand Up @@ -131,7 +135,7 @@ def search(self, query, date_from=None, date_to=None, max_docs=None,

def _cache_init(self):
""" Initialize cache in Orange environment buffer dir. """
path = os.path.join(environ.buffer_dir, "nytcache")
path = os.path.join(environ.cache_dir(), "nytcache")
try:
if not os.path.exists(path):
os.makedirs(path)
Expand Down
8 changes: 6 additions & 2 deletions orangecontrib/text/pubmed.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
from Bio import Medline
from validate_email import validate_email

from Orange.canvas.utils import environ
try:
from Orange.misc import environ
except ImportError:
from Orange.canvas.utils import environ

from Orange.data import StringVariable, DiscreteVariable, TimeVariable, Domain
from orangecontrib.text.corpus import Corpus

Expand Down Expand Up @@ -184,7 +188,7 @@ def __init__(self, email, progress_callback=None, error_callback=None):
self.stop_signal = False

self.cache_path = None
cache_folder = os.path.join(environ.buffer_dir, 'pubmedcache')
cache_folder = os.path.join(environ.cache_dir(), 'pubmedcache')

if not os.path.exists(cache_folder):
os.makedirs(cache_folder)
Expand Down
6 changes: 5 additions & 1 deletion orangecontrib/text/widgets/owimportdocuments.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@

from orangecontrib.text.corpus import Corpus
from orangecontrib.text.import_documents import ImportDocuments
from Orange.canvas.preview.previewbrowser import TextLabel

try:
from orangecanvas.preview.previewbrowser import TextLabel
except ImportError:
from Orange.canvas.preview.previewbrowser import TextLabel


def prettifypath(path):
Expand Down
7 changes: 6 additions & 1 deletion orangecontrib/text/widgets/ownyt.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
from Orange.data import StringVariable
from Orange.widgets.credentials import CredentialManager
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget, Msg, gui, Output
from Orange.widgets.widget import OWWidget, Msg, Output
from orangecontrib.text.corpus import Corpus
from orangecontrib.text.nyt import NYT, MIN_DATE
from orangecontrib.text.widgets.utils import CheckListLayout, DatePickerInterval, QueryBox, \
gui_require, asynchronous

try:
from orangewidget import gui
except ImportError:
from Orange.canvas.widgets.widget import gui


class OWNYT(OWWidget):
class APICredentialsDialog(OWWidget):
Expand Down

0 comments on commit d2fab8a

Please sign in to comment.