Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def get_related_clients(self, client):
related_clients = []
for cl in self.get_clients():
if cl.connection_file == client.connection_file and \
cl is not client:
related_clients.append(cl)
retu... | [
"\r\n Get all other clients that are connected to the same kernel as `client`\r\n "
] |
Please provide a description of the function:def close_related_clients(self, client):
related_clients = self.get_related_clients(client)
for cl in related_clients:
self.close_client(client=cl, force=True) | [
"Close all clients related to *client*, except itself"
] |
Please provide a description of the function:def restart(self):
self.master_clients = 0
self.create_new_client_if_empty = False
for i in range(len(self.clients)):
client = self.clients[-1]
try:
client.shutdown()
except Exceptio... | [
"\r\n Restart the console\r\n\r\n This is needed when we switch projects to update PYTHONPATH\r\n and the selected interpreter\r\n "
] |
Please provide a description of the function:def pdb_has_stopped(self, fname, lineno, shellwidget):
# This is a unique form of the edit_goto signal that is intended to
# prevent keyboard input from accidentally entering the editor
# during repeated, rapid entry of debugging commands... | [
"Python debugger has just stopped at frame (fname, lineno)"
] |
Please provide a description of the function:def create_client_from_path(self, path):
self.create_new_client()
sw = self.get_current_shellwidget()
sw.set_cwd(path) | [
"Create a client with its cwd pointing to path."
] |
Please provide a description of the function:def create_client_for_file(self, filename, is_cython=False):
# Create client
self.create_new_client(filename=filename, is_cython=is_cython)
# Don't increase the count of master clients
self.master_clients -= 1
# Rena... | [
"Create a client to execute code related to a file."
] |
Please provide a description of the function:def get_client_for_file(self, filename):
client = None
for idx, cl in enumerate(self.get_clients()):
if self.filenames[idx] == filename:
self.tabwidget.setCurrentIndex(idx)
client = cl
... | [
"Get client associated with a given file."
] |
Please provide a description of the function:def set_elapsed_time(self, client):
related_clients = self.get_related_clients(client)
for cl in related_clients:
if cl.timer is not None:
client.create_time_label()
client.t0 = cl.t0
... | [
"Set elapsed time for slave clients."
] |
Please provide a description of the function:def tunnel_to_kernel(self, connection_info, hostname, sshkey=None,
password=None, timeout=10):
lports = zmqtunnel.select_random_ports(4)
rports = (connection_info['shell_port'], connection_info['iopub_port'],
... | [
"\r\n Tunnel connections to a kernel via ssh.\r\n\r\n Remote ports are specified in the connection info ci.\r\n "
] |
Please provide a description of the function:def create_kernel_spec(self, is_cython=False,
is_pylab=False, is_sympy=False):
# Before creating our kernel spec, we always need to
# set this value in spyder.ini
CONF.set('main', 'spyder_pythonpath',
... | [
"Create a kernel spec for our own kernels"
] |
Please provide a description of the function:def create_kernel_manager_and_kernel_client(self, connection_file,
stderr_handle,
is_cython=False,
is_pylab=False,
... | [
"Create kernel manager and client."
] |
Please provide a description of the function:def restart_kernel(self):
client = self.get_current_client()
if client is not None:
self.switch_to_plugin()
client.restart_kernel() | [
"Restart kernel of current client."
] |
Please provide a description of the function:def reset_kernel(self):
client = self.get_current_client()
if client is not None:
self.switch_to_plugin()
client.reset_namespace() | [
"Reset kernel of current client."
] |
Please provide a description of the function:def interrupt_kernel(self):
client = self.get_current_client()
if client is not None:
self.switch_to_plugin()
client.stop_button_click_handler() | [
"Interrupt kernel of current client."
] |
Please provide a description of the function:def update_execution_state_kernel(self):
client = self.get_current_client()
if client is not None:
executing = client.stop_button.isEnabled()
self.interrupt_action.setEnabled(executing) | [
"Update actions following the execution state of the kernel."
] |
Please provide a description of the function:def connect_external_kernel(self, shellwidget):
sw = shellwidget
kc = shellwidget.kernel_client
if self.main.help is not None:
self.main.help.set_shell(sw)
if self.main.variableexplorer is not None:
self... | [
"\r\n Connect an external kernel to the Variable Explorer and Help, if\r\n it is a Spyder kernel.\r\n "
] |
Please provide a description of the function:def add_tab(self, widget, name, filename=''):
self.clients.append(widget)
index = self.tabwidget.addTab(widget, name)
self.filenames.insert(index, filename)
self.tabwidget.setCurrentIndex(index)
if self.dockwidget and no... | [
"Add tab"
] |
Please provide a description of the function:def move_tab(self, index_from, index_to):
filename = self.filenames.pop(index_from)
client = self.clients.pop(index_from)
self.filenames.insert(index_to, filename)
self.clients.insert(index_to, client)
self.update_tabs_t... | [
"\r\n Move tab (tabs themselves have already been moved by the tabwidget)\r\n "
] |
Please provide a description of the function:def disambiguate_fname(self, fname):
files_path_list = [filename for filename in self.filenames
if filename]
return sourcecode.disambiguate_fname(files_path_list, fname) | [
"Generate a file name without ambiguation."
] |
Please provide a description of the function:def update_tabs_text(self):
# This is needed to prevent that hanged consoles make reference
# to an index that doesn't exist. See issue 4881
try:
for index, fname in enumerate(self.filenames):
client = self.c... | [
"Update the text from the tabs."
] |
Please provide a description of the function:def rename_client_tab(self, client, given_name):
index = self.get_client_index_from_id(id(client))
if given_name is not None:
client.given_name = given_name
self.tabwidget.setTabText(index, client.get_name()) | [
"Rename client's tab"
] |
Please provide a description of the function:def rename_tabs_after_change(self, given_name):
client = self.get_current_client()
# Prevent renames that want to assign the same name of
# a previous tab
repeated = False
for cl in self.get_clients():
if ... | [
"Rename tabs after a change in name."
] |
Please provide a description of the function:def tab_name_editor(self):
index = self.tabwidget.currentIndex()
self.tabwidget.tabBar().tab_name_editor.edit_tab(index) | [
"Trigger the tab name editor."
] |
Please provide a description of the function:def go_to_error(self, text):
match = get_error_match(to_text_string(text))
if match:
fname, lnb = match.groups()
if ("<ipython-input-" in fname and
self.run_cell_filename is not None):
... | [
"Go to error if relevant"
] |
Please provide a description of the function:def show_intro(self):
from IPython.core.usage import interactive_usage
self.main.help.show_rich_text(interactive_usage) | [
"Show intro to IPython help"
] |
Please provide a description of the function:def show_guiref(self):
from qtconsole.usage import gui_reference
self.main.help.show_rich_text(gui_reference, collapse=True) | [
"Show qtconsole help"
] |
Please provide a description of the function:def show_quickref(self):
from IPython.core.usage import quick_reference
self.main.help.show_plain_text(quick_reference) | [
"Show IPython Cheat Sheet"
] |
Please provide a description of the function:def _new_connection_file(self):
# Check if jupyter_runtime_dir exists (Spyder addition)
if not osp.isdir(jupyter_runtime_dir()):
try:
os.makedirs(jupyter_runtime_dir())
except (IOError, OSError):
... | [
"\r\n Generate a new connection file\r\n\r\n Taken from jupyter_client/console_app.py\r\n Licensed under the BSD license\r\n "
] |
Please provide a description of the function:def _remove_old_stderr_files(self):
if os.name == 'nt':
tmpdir = get_temp_dir()
for fname in os.listdir(tmpdir):
if osp.splitext(fname)[1] == '.stderr':
try:
os.remove... | [
"\r\n Remove stderr files left by previous Spyder instances.\r\n\r\n This is only required on Windows because we can't\r\n clean up stderr files while Spyder is running on it.\r\n "
] |
Please provide a description of the function:def rotate(self):
self._index -= 1
if self._index >= 0:
return self._ring[self._index]
return None | [
" Rotate the kill ring, then yank back the new top.\n\n Returns\n -------\n A text string or None.\n "
] |
Please provide a description of the function:def kill_cursor(self, cursor):
text = cursor.selectedText()
if text:
cursor.removeSelectedText()
self.kill(text) | [
" Kills the text selected by the give cursor.\n "
] |
Please provide a description of the function:def yank(self):
text = self._ring.yank()
if text:
self._skip_cursor = True
cursor = self._text_edit.textCursor()
cursor.insertText(text)
self._prev_yank = text | [
" Yank back the most recently killed text.\n "
] |
Please provide a description of the function:def show_in_external_file_explorer(fnames=None):
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
for fname in fnames:
open_file_in_external_explorer(fname) | [
"Show files in external file explorer\r\n\r\n Args:\r\n fnames (list): Names of files to show.\r\n "
] |
Please provide a description of the function:def fixpath(path):
norm = osp.normcase if os.name == 'nt' else osp.normpath
return norm(osp.abspath(osp.realpath(path))) | [
"Normalize path fixing case, making absolute and removing symlinks"
] |
Please provide a description of the function:def create_script(fname):
text = os.linesep.join(["# -*- coding: utf-8 -*-", "", ""])
try:
encoding.write(to_text_string(text), fname, 'utf-8')
except EnvironmentError as error:
QMessageBox.critical(_("Save Error"),
... | [
"Create a new Python script"
] |
Please provide a description of the function:def listdir(path, include=r'.', exclude=r'\.pyc$|^\.', show_all=False,
folders_only=False):
namelist = []
dirlist = [to_text_string(osp.pardir)]
for item in os.listdir(to_text_string(path)):
if re.search(exclude, item) and not show_... | [
"List files and directories"
] |
Please provide a description of the function:def has_subdirectories(path, include, exclude, show_all):
try:
# > 1 because of '..'
return len( listdir(path, include, exclude,
show_all, folders_only=True) ) > 1
except (IOError, OSError):
return False | [
"Return True if path has subdirectories"
] |
Please provide a description of the function:def icon(self, icontype_or_qfileinfo):
if isinstance(icontype_or_qfileinfo, QFileIconProvider.IconType):
return super(IconProvider, self).icon(icontype_or_qfileinfo)
else:
qfileinfo = icontype_or_qfileinfo
fn... | [
"Reimplement Qt method"
] |
Please provide a description of the function:def setup_fs_model(self):
filters = QDir.AllDirs | QDir.Files | QDir.Drives | QDir.NoDotAndDotDot
self.fsmodel = QFileSystemModel(self)
self.fsmodel.setFilter(filters)
self.fsmodel.setNameFilterDisables(False) | [
"Setup filesystem model"
] |
Please provide a description of the function:def setup_view(self):
self.install_model()
self.fsmodel.directoryLoaded.connect(
lambda: self.resizeColumnToContents(0))
self.setAnimated(False)
self.setSortingEnabled(True)
self.sortByColumn(0, Qt.Ascending... | [
"Setup view"
] |
Please provide a description of the function:def set_single_click_to_open(self, value):
self.single_click_to_open = value
self.parent_widget.sig_option_changed.emit('single_click_to_open',
value) | [
"Set single click to open items."
] |
Please provide a description of the function:def set_name_filters(self, name_filters):
self.name_filters = name_filters
self.fsmodel.setNameFilters(name_filters) | [
"Set name filters"
] |
Please provide a description of the function:def set_show_all(self, state):
if state:
self.fsmodel.setNameFilters([])
else:
self.fsmodel.setNameFilters(self.name_filters) | [
"Toggle 'show all files' state"
] |
Please provide a description of the function:def get_filename(self, index):
if index:
return osp.normpath(to_text_string(self.fsmodel.filePath(index))) | [
"Return filename associated with *index*"
] |
Please provide a description of the function:def get_selected_filenames(self):
if self.selectionMode() == self.ExtendedSelection:
if self.selectionModel() is None:
return []
return [self.get_filename(idx) for idx in
self.selectionModel(... | [
"Return selected filenames"
] |
Please provide a description of the function:def get_dirname(self, index):
fname = self.get_filename(index)
if fname:
if osp.isdir(fname):
return fname
else:
return osp.dirname(fname) | [
"Return dirname associated with *index*"
] |
Please provide a description of the function:def setup(self, name_filters=['*.py', '*.pyw'], show_all=False,
single_click_to_open=False):
self.setup_view()
self.set_name_filters(name_filters)
self.show_all = show_all
self.single_click_to_open = single_click... | [
"Setup tree widget"
] |
Please provide a description of the function:def setup_common_actions(self):
# Filters
filters_action = create_action(self, _("Edit filename filters..."),
None, ima.icon('filter'),
triggered=self.edit_filter)
... | [
"Setup context menu common actions"
] |
Please provide a description of the function:def edit_filter(self):
filters, valid = QInputDialog.getText(self, _('Edit filename filters'),
_('Name filters:'),
QLineEdit.Normal,
... | [
"Edit name filters"
] |
Please provide a description of the function:def toggle_all(self, checked):
self.parent_widget.sig_option_changed.emit('show_all', checked)
self.show_all = checked
self.set_show_all(checked) | [
"Toggle all files mode"
] |
Please provide a description of the function:def create_file_new_actions(self, fnames):
if not fnames:
return []
new_file_act = create_action(self, _("File..."),
icon=ima.icon('filenew'),
triggered=lamb... | [
"Return actions for submenu 'New...'"
] |
Please provide a description of the function:def create_file_manage_actions(self, fnames):
only_files = all([osp.isfile(_fn) for _fn in fnames])
only_modules = all([osp.splitext(_fn)[1] in ('.py', '.pyw', '.ipy')
for _fn in fnames])
only_notebooks = all(... | [
"Return file management actions"
] |
Please provide a description of the function:def create_folder_manage_actions(self, fnames):
actions = []
if os.name == 'nt':
_title = _("Open command prompt here")
else:
_title = _("Open terminal here")
_title = _("Open IPython console here")
... | [
"Return folder management actions"
] |
Please provide a description of the function:def create_context_menu_actions(self):
actions = []
fnames = self.get_selected_filenames()
new_actions = self.create_file_new_actions(fnames)
if len(new_actions) > 1:
# Creating a submenu only if there is more than o... | [
"Create context menu actions"
] |
Please provide a description of the function:def update_menu(self):
self.menu.clear()
add_actions(self.menu, self.create_context_menu_actions()) | [
"Update context menu"
] |
Please provide a description of the function:def keyPressEvent(self, event):
if event.key() in (Qt.Key_Enter, Qt.Key_Return):
self.clicked()
elif event.key() == Qt.Key_F2:
self.rename()
elif event.key() == Qt.Key_Delete:
self.delete()
... | [
"Reimplement Qt method"
] |
Please provide a description of the function:def mouseReleaseEvent(self, event):
QTreeView.mouseReleaseEvent(self, event)
if self.single_click_to_open:
self.clicked() | [
"Reimplement Qt method."
] |
Please provide a description of the function:def clicked(self):
fnames = self.get_selected_filenames()
for fname in fnames:
if osp.isdir(fname):
self.directory_clicked(fname)
else:
self.open([fname]) | [
"Selected item was double-clicked or enter/return was pressed"
] |
Please provide a description of the function:def dragMoveEvent(self, event):
if (event.mimeData().hasFormat("text/plain")):
event.setDropAction(Qt.MoveAction)
event.accept()
else:
event.ignore() | [
"Drag and Drop - Move event"
] |
Please provide a description of the function:def startDrag(self, dropActions):
data = QMimeData()
data.setUrls([QUrl(fname) for fname in self.get_selected_filenames()])
drag = QDrag(self)
drag.setMimeData(data)
drag.exec_() | [
"Reimplement Qt Method - handle drag event"
] |
Please provide a description of the function:def open(self, fnames=None):
if fnames is None:
fnames = self.get_selected_filenames()
for fname in fnames:
if osp.isfile(fname) and encoding.is_text_file(fname):
self.parent_widget.sig_open_file.emit(fna... | [
"Open files with the appropriate application"
] |
Please provide a description of the function:def open_external(self, fnames=None):
if fnames is None:
fnames = self.get_selected_filenames()
for fname in fnames:
self.open_outside_spyder([fname]) | [
"Open files with default application"
] |
Please provide a description of the function:def open_outside_spyder(self, fnames):
for path in sorted(fnames):
path = file_uri(path)
ok = programs.start_file(path)
if not ok:
self.sig_edit.emit(path) | [
"Open file outside Spyder with the appropriate application\r\n If this does not work, opening unknown file in Spyder, as text file"
] |
Please provide a description of the function:def open_interpreter(self, fnames):
for path in sorted(fnames):
self.sig_open_interpreter.emit(path) | [
"Open interpreter"
] |
Please provide a description of the function:def run(self, fnames=None):
if fnames is None:
fnames = self.get_selected_filenames()
for fname in fnames:
self.sig_run.emit(fname) | [
"Run Python scripts"
] |
Please provide a description of the function:def remove_tree(self, dirname):
while osp.exists(dirname):
try:
shutil.rmtree(dirname, onerror=misc.onerror)
except Exception as e:
# This handles a Windows problem with shutil.rmtree.
... | [
"Remove whole directory tree\r\n Reimplemented in project explorer widget"
] |
Please provide a description of the function:def delete_file(self, fname, multiple, yes_to_all):
if multiple:
buttons = QMessageBox.Yes|QMessageBox.YesToAll| \
QMessageBox.No|QMessageBox.Cancel
else:
buttons = QMessageBox.Yes|QMessageBox.No
... | [
"Delete file"
] |
Please provide a description of the function:def delete(self, fnames=None):
if fnames is None:
fnames = self.get_selected_filenames()
multiple = len(fnames) > 1
yes_to_all = None
for fname in fnames:
spyproject_path = osp.join(fname,'.spyproject')
... | [
"Delete files"
] |
Please provide a description of the function:def convert_notebook(self, fname):
try:
script = nbexporter().from_filename(fname)[0]
except Exception as e:
QMessageBox.critical(self, _('Conversion error'),
_("It was not possible to ... | [
"Convert an IPython notebook to a Python script in editor"
] |
Please provide a description of the function:def convert_notebooks(self):
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
for fname in fnames:
self.convert_notebook(fname) | [
"Convert IPython notebooks to Python scripts in editor"
] |
Please provide a description of the function:def rename_file(self, fname):
path, valid = QInputDialog.getText(self, _('Rename'),
_('New name:'), QLineEdit.Normal,
osp.basename(fname))
if valid:
path = osp.join(osp.dir... | [
"Rename file"
] |
Please provide a description of the function:def rename(self, fnames=None):
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
for fname in fnames:
self.rename_file(fname) | [
"Rename files"
] |
Please provide a description of the function:def move(self, fnames=None, directory=None):
if fnames is None:
fnames = self.get_selected_filenames()
orig = fixpath(osp.dirname(fnames[0]))
while True:
self.redirect_stdio.emit(False)
if directory ... | [
"Move files/directories"
] |
Please provide a description of the function:def create_new_folder(self, current_path, title, subtitle, is_package):
if current_path is None:
current_path = ''
if osp.isfile(current_path):
current_path = osp.dirname(current_path)
name, valid = QInputDialog.... | [
"Create new folder"
] |
Please provide a description of the function:def new_folder(self, basedir):
title = _('New folder')
subtitle = _('Folder name:')
self.create_new_folder(basedir, title, subtitle, is_package=False) | [
"New folder"
] |
Please provide a description of the function:def new_package(self, basedir):
title = _('New package')
subtitle = _('Package name:')
self.create_new_folder(basedir, title, subtitle, is_package=True) | [
"New package"
] |
Please provide a description of the function:def create_new_file(self, current_path, title, filters, create_func):
if current_path is None:
current_path = ''
if osp.isfile(current_path):
current_path = osp.dirname(current_path)
self.redirect_stdio.emit(Fals... | [
"Create new file\r\n Returns True if successful"
] |
Please provide a description of the function:def new_file(self, basedir):
title = _("New file")
filters = _("All files")+" (*)"
def create_func(fname):
if osp.splitext(fname)[1] in ('.py', '.pyw', '.ipy'):
create_script(fname)
... | [
"New file",
"File creation callback"
] |
Please provide a description of the function:def new_module(self, basedir):
title = _("New module")
filters = _("Python scripts")+" (*.py *.pyw *.ipy)"
def create_func(fname):
self.sig_create_module.emit(fname)
self.create_new_file(basedir, title, filters, ... | [
"New module"
] |
Please provide a description of the function:def copy_path(self, fnames=None, method="absolute"):
cb = QApplication.clipboard()
explorer_dir = self.fsmodel.rootPath()
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, li... | [
"Copy absolute or relative path to given file(s)/folders(s)."
] |
Please provide a description of the function:def copy_file_clipboard(self, fnames=None):
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
try:
file_content = QMimeData()
... | [
"Copy file(s)/folders(s) to clipboard."
] |
Please provide a description of the function:def save_file_clipboard(self, fnames=None):
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
if len(fnames) >= 1:
try:
... | [
"Paste file from clipboard into file/project explorer directory."
] |
Please provide a description of the function:def create_shortcuts(self):
# Configurable
copy_clipboard_file = config_shortcut(self.copy_file_clipboard,
context='explorer',
name='copy file', parent=s... | [
"Create shortcuts for this file explorer."
] |
Please provide a description of the function:def vcs_command(self, fnames, action):
try:
for path in sorted(fnames):
vcs.run_vcs_tool(path, action)
except vcs.ActionToolNotFound as error:
msg = _("For %s support, please install one of the<br/> "
... | [
"VCS action (commit, browse)",
"<b>Unable to find external program.</b><br><br>%s"
] |
Please provide a description of the function:def set_scrollbar_position(self, position):
# Scrollbars will be restored after the expanded state
self._scrollbar_positions = position
if self._to_be_loaded is not None and len(self._to_be_loaded) == 0:
self.restore_scrollba... | [
"Set scrollbar positions"
] |
Please provide a description of the function:def restore_scrollbar_positions(self):
hor, ver = self._scrollbar_positions
self.horizontalScrollBar().setValue(hor)
self.verticalScrollBar().setValue(ver) | [
"Restore scrollbar positions once tree is loaded"
] |
Please provide a description of the function:def save_expanded_state(self):
model = self.model()
# If model is not installed, 'model' will be None: this happens when
# using the Project Explorer without having selected a workspace yet
if model is not None:
self... | [
"Save all items expanded state"
] |
Please provide a description of the function:def restore_directory_state(self, fname):
root = osp.normpath(to_text_string(fname))
if not osp.exists(root):
# Directory has been (re)moved outside Spyder
return
for basename in os.listdir(root):
pa... | [
"Restore directory expanded state"
] |
Please provide a description of the function:def follow_directories_loaded(self, fname):
if self._to_be_loaded is None:
return
path = osp.normpath(to_text_string(fname))
if path in self._to_be_loaded:
self._to_be_loaded.remove(path)
if self._to_be_... | [
"Follow directories loaded during startup"
] |
Please provide a description of the function:def restore_expanded_state(self):
if self.__expanded_state is not None:
# In the old project explorer, the expanded state was a dictionnary:
if isinstance(self.__expanded_state, list):
self.fsmodel.directoryLoaded... | [
"Restore all items expanded state"
] |
Please provide a description of the function:def filter_directories(self):
index = self.get_index('.spyproject')
if index is not None:
self.setRowHidden(index.row(), index.parent(), True) | [
"Filter the directories to show"
] |
Please provide a description of the function:def setup_filter(self, root_path, path_list):
self.root_path = osp.normpath(to_text_string(root_path))
self.path_list = [osp.normpath(to_text_string(p)) for p in path_list]
self.invalidateFilter() | [
"Setup proxy model filter parameters"
] |
Please provide a description of the function:def sort(self, column, order=Qt.AscendingOrder):
self.sourceModel().sort(column, order) | [
"Reimplement Qt method"
] |
Please provide a description of the function:def filterAcceptsRow(self, row, parent_index):
if self.root_path is None:
return True
index = self.sourceModel().index(row, 0, parent_index)
path = osp.normcase(osp.normpath(
to_text_string(self.sourceModel().fil... | [
"Reimplement Qt method"
] |
Please provide a description of the function:def data(self, index, role):
if role == Qt.ToolTipRole:
root_dir = self.path_list[0].split(osp.sep)[-1]
if index.data() == root_dir:
return osp.join(self.root_path, root_dir)
return QSortFilterProxyModel.... | [
"Show tooltip with full path only for the root directory"
] |
Please provide a description of the function:def setup_proxy_model(self):
self.proxymodel = ProxyModel(self)
self.proxymodel.setSourceModel(self.fsmodel) | [
"Setup proxy model"
] |
Please provide a description of the function:def set_root_path(self, root_path):
self.root_path = root_path
self.install_model()
index = self.fsmodel.setRootPath(root_path)
self.proxymodel.setup_filter(self.root_path, [])
self.setRootIndex(self.proxymodel.mapFromSo... | [
"Set root path"
] |
Please provide a description of the function:def get_index(self, filename):
index = self.fsmodel.index(filename)
if index.isValid() and index.model() is self.fsmodel:
return self.proxymodel.mapFromSource(index) | [
"Return index associated with filename"
] |
Please provide a description of the function:def set_folder_names(self, folder_names):
assert self.root_path is not None
path_list = [osp.join(self.root_path, dirname)
for dirname in folder_names]
self.proxymodel.setup_filter(self.root_path, path_list) | [
"Set folder names"
] |
Please provide a description of the function:def get_filename(self, index):
if index:
path = self.fsmodel.filePath(self.proxymodel.mapToSource(index))
return osp.normpath(to_text_string(path)) | [
"Return filename from index"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.