-
-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Add a file switcher instance #46
Changes from 3 commits
bd5fed0
63a6585
1b387d4
a697bff
14f62be
b69f7ad
de59552
2ccccec
2ecd8bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,7 +115,9 @@ class NotebookClient(QWidget): | |
def __init__(self, plugin, name): | ||
super(NotebookClient, self).__init__(plugin) | ||
|
||
self.name = name | ||
if os.name == 'nt': | ||
name = name.replace('/','\\') | ||
self.filename = name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please leave this as it was, i.e. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, it's fine as you wrote it :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But to be consistent, you should change |
||
|
||
self.file_url = None | ||
self.server_url = None | ||
|
@@ -143,7 +145,7 @@ def add_token(self, url): | |
def register(self, server_info): | ||
"""Register attributes that can be computed with the server info.""" | ||
# Path relative to the server directory | ||
self.path = os.path.relpath(self.name, | ||
self.path = os.path.relpath(self.filename, | ||
start=server_info['notebook_dir']) | ||
|
||
# Replace backslashes on Windows | ||
|
@@ -174,11 +176,11 @@ def load_notebook(self): | |
self.go_to(self.file_url) | ||
|
||
def get_name(self): | ||
return self.name | ||
return self.filename | ||
|
||
def get_short_name(self): | ||
"""Get a short name for the notebook.""" | ||
sname = osp.basename(self.name) | ||
sname = osp.basename(self.filename) | ||
if len(sname) > 15: | ||
sname = sname[:15] | ||
return sname | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please align the last two lines here to
(
in the first line