repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
pyQode/pyqode.core
pyqode/core/panels/global_checker.py
GlobalCheckerPanel.paintEvent
def paintEvent(self, event): """ Pains the messages and the visible area on the panel. :param event: paint event infos """ if self.isVisible(): # fill background self._background_brush = QtGui.QBrush(self.editor.background) painter = QtGui.QPai...
python
def paintEvent(self, event): """ Pains the messages and the visible area on the panel. :param event: paint event infos """ if self.isVisible(): # fill background self._background_brush = QtGui.QBrush(self.editor.background) painter = QtGui.QPai...
[ "def", "paintEvent", "(", "self", ",", "event", ")", ":", "if", "self", ".", "isVisible", "(", ")", ":", "# fill background", "self", ".", "_background_brush", "=", "QtGui", ".", "QBrush", "(", "self", ".", "editor", ".", "background", ")", "painter", "=...
Pains the messages and the visible area on the panel. :param event: paint event infos
[ "Pains", "the", "messages", "and", "the", "visible", "area", "on", "the", "panel", ".", ":", "param", "event", ":", "paint", "event", "infos" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/panels/global_checker.py#L66-L77
pyQode/pyqode.core
pyqode/core/panels/global_checker.py
GlobalCheckerPanel.get_marker_height
def get_marker_height(self): """ Gets the height of message marker. """ return self.editor.viewport().height() / TextHelper( self.editor).line_count()
python
def get_marker_height(self): """ Gets the height of message marker. """ return self.editor.viewport().height() / TextHelper( self.editor).line_count()
[ "def", "get_marker_height", "(", "self", ")", ":", "return", "self", ".", "editor", ".", "viewport", "(", ")", ".", "height", "(", ")", "/", "TextHelper", "(", "self", ".", "editor", ")", ".", "line_count", "(", ")" ]
Gets the height of message marker.
[ "Gets", "the", "height", "of", "message", "marker", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/panels/global_checker.py#L85-L90
pyQode/pyqode.core
pyqode/core/panels/global_checker.py
GlobalCheckerPanel.get_marker_size
def get_marker_size(self): """ Gets the size of a message marker. :return: QSize """ h = self.get_marker_height() if h < 1: h = 1 return QtCore.QSize(self.sizeHint().width() / 2, h)
python
def get_marker_size(self): """ Gets the size of a message marker. :return: QSize """ h = self.get_marker_height() if h < 1: h = 1 return QtCore.QSize(self.sizeHint().width() / 2, h)
[ "def", "get_marker_size", "(", "self", ")", ":", "h", "=", "self", ".", "get_marker_height", "(", ")", "if", "h", "<", "1", ":", "h", "=", "1", "return", "QtCore", ".", "QSize", "(", "self", ".", "sizeHint", "(", ")", ".", "width", "(", ")", "/",...
Gets the size of a message marker. :return: QSize
[ "Gets", "the", "size", "of", "a", "message", "marker", ".", ":", "return", ":", "QSize" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/panels/global_checker.py#L92-L100
pyQode/pyqode.core
pyqode/core/widgets/file_icons_provider.py
FileIconProvider.mimetype_icon
def mimetype_icon(path, fallback=None): """ Tries to create an icon from theme using the file mimetype. E.g.:: return self.mimetype_icon( path, fallback=':/icons/text-x-python.png') :param path: file path for which the icon must be created :param fa...
python
def mimetype_icon(path, fallback=None): """ Tries to create an icon from theme using the file mimetype. E.g.:: return self.mimetype_icon( path, fallback=':/icons/text-x-python.png') :param path: file path for which the icon must be created :param fa...
[ "def", "mimetype_icon", "(", "path", ",", "fallback", "=", "None", ")", ":", "mime", "=", "mimetypes", ".", "guess_type", "(", "path", ")", "[", "0", "]", "if", "mime", ":", "icon", "=", "mime", ".", "replace", "(", "'/'", ",", "'-'", ")", "# if sy...
Tries to create an icon from theme using the file mimetype. E.g.:: return self.mimetype_icon( path, fallback=':/icons/text-x-python.png') :param path: file path for which the icon must be created :param fallback: fallback icon path (qrc or file system) :ret...
[ "Tries", "to", "create", "an", "icon", "from", "theme", "using", "the", "file", "mimetype", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/file_icons_provider.py#L13-L37
psphere-project/psphere
examples/connect.py
main
def main(options): """A simple connection test to login and print the server time.""" client = Client(server=options.server, username=options.username, password=options.password) print('Successfully connected to %s' % client.server) print(client.si.CurrentTime()) client.logout()
python
def main(options): """A simple connection test to login and print the server time.""" client = Client(server=options.server, username=options.username, password=options.password) print('Successfully connected to %s' % client.server) print(client.si.CurrentTime()) client.logout()
[ "def", "main", "(", "options", ")", ":", "client", "=", "Client", "(", "server", "=", "options", ".", "server", ",", "username", "=", "options", ".", "username", ",", "password", "=", "options", ".", "password", ")", "print", "(", "'Successfully connected ...
A simple connection test to login and print the server time.
[ "A", "simple", "connection", "test", "to", "login", "and", "print", "the", "server", "time", "." ]
train
https://github.com/psphere-project/psphere/blob/83a252e037c3d6e4f18bcd37380998bc9535e591/examples/connect.py#L21-L28
pyQode/pyqode.core
pyqode/core/panels/checker.py
CheckerPanel.marker_for_line
def marker_for_line(self, line): """ Returns the marker that is displayed at the specified line number if any. :param line: The marker line. :return: Marker of None :rtype: pyqode.core.Marker """ block = self.editor.document().findBlockByNumber(line) ...
python
def marker_for_line(self, line): """ Returns the marker that is displayed at the specified line number if any. :param line: The marker line. :return: Marker of None :rtype: pyqode.core.Marker """ block = self.editor.document().findBlockByNumber(line) ...
[ "def", "marker_for_line", "(", "self", ",", "line", ")", ":", "block", "=", "self", ".", "editor", ".", "document", "(", ")", ".", "findBlockByNumber", "(", "line", ")", "try", ":", "return", "block", ".", "userData", "(", ")", ".", "messages", "except...
Returns the marker that is displayed at the specified line number if any. :param line: The marker line. :return: Marker of None :rtype: pyqode.core.Marker
[ "Returns", "the", "marker", "that", "is", "displayed", "at", "the", "specified", "line", "number", "if", "any", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/panels/checker.py#L34-L48
pyQode/pyqode.core
pyqode/core/tools/console.py
main
def main(): """ pyqode-console main function. """ global program, args, ret print(os.getcwd()) ret = 0 if '--help' in sys.argv or '-h' in sys.argv or len(sys.argv) == 1: print(__doc__) else: program = sys.argv[1] args = sys.argv[2:] if args: re...
python
def main(): """ pyqode-console main function. """ global program, args, ret print(os.getcwd()) ret = 0 if '--help' in sys.argv or '-h' in sys.argv or len(sys.argv) == 1: print(__doc__) else: program = sys.argv[1] args = sys.argv[2:] if args: re...
[ "def", "main", "(", ")", ":", "global", "program", ",", "args", ",", "ret", "print", "(", "os", ".", "getcwd", "(", ")", ")", "ret", "=", "0", "if", "'--help'", "in", "sys", ".", "argv", "or", "'-h'", "in", "sys", ".", "argv", "or", "len", "(",...
pyqode-console main function.
[ "pyqode", "-", "console", "main", "function", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/tools/console.py#L23-L45
fmenabe/python-dokuwiki
doc/source/conf.py
linkcode_resolve
def linkcode_resolve(domain, info): """A simple function to find matching source code.""" module_name = info['module'] fullname = info['fullname'] attribute_name = fullname.split('.')[-1] base_url = 'https://github.com/fmenabe/python-dokuwiki/blob/' if release.endswith('-dev'): base_url...
python
def linkcode_resolve(domain, info): """A simple function to find matching source code.""" module_name = info['module'] fullname = info['fullname'] attribute_name = fullname.split('.')[-1] base_url = 'https://github.com/fmenabe/python-dokuwiki/blob/' if release.endswith('-dev'): base_url...
[ "def", "linkcode_resolve", "(", "domain", ",", "info", ")", ":", "module_name", "=", "info", "[", "'module'", "]", "fullname", "=", "info", "[", "'fullname'", "]", "attribute_name", "=", "fullname", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "b...
A simple function to find matching source code.
[ "A", "simple", "function", "to", "find", "matching", "source", "code", "." ]
train
https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/doc/source/conf.py#L48-L96
pyQode/pyqode.core
pyqode/core/managers/backend.py
BackendManager.pick_free_port
def pick_free_port(): """ Picks a free port """ test_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) test_socket.bind(('127.0.0.1', 0)) free_port = int(test_socket.getsockname()[1]) test_socket.close() return free_port
python
def pick_free_port(): """ Picks a free port """ test_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) test_socket.bind(('127.0.0.1', 0)) free_port = int(test_socket.getsockname()[1]) test_socket.close() return free_port
[ "def", "pick_free_port", "(", ")", ":", "test_socket", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "test_socket", ".", "bind", "(", "(", "'127.0.0.1'", ",", "0", ")", ")", "free_port", "=", "int", ...
Picks a free port
[ "Picks", "a", "free", "port" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/managers/backend.py#L57-L63
pyQode/pyqode.core
pyqode/core/managers/backend.py
BackendManager.start
def start(self, script, interpreter=sys.executable, args=None, error_callback=None, reuse=False): """ Starts the backend process. The backend is a python script that starts a :class:`pyqode.core.backend.JsonServer`. You must write the backend script so that you can...
python
def start(self, script, interpreter=sys.executable, args=None, error_callback=None, reuse=False): """ Starts the backend process. The backend is a python script that starts a :class:`pyqode.core.backend.JsonServer`. You must write the backend script so that you can...
[ "def", "start", "(", "self", ",", "script", ",", "interpreter", "=", "sys", ".", "executable", ",", "args", "=", "None", ",", "error_callback", "=", "None", ",", "reuse", "=", "False", ")", ":", "self", ".", "_shared", "=", "reuse", "if", "reuse", "a...
Starts the backend process. The backend is a python script that starts a :class:`pyqode.core.backend.JsonServer`. You must write the backend script so that you can apply your own backend configuration. The script can be run with a custom interpreter. The default is to use sys.e...
[ "Starts", "the", "backend", "process", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/managers/backend.py#L65-L126
pyQode/pyqode.core
pyqode/core/managers/backend.py
BackendManager.stop
def stop(self): """ Stops the backend process. """ if self._process is None: return if self._shared: BackendManager.SHARE_COUNT -= 1 if BackendManager.SHARE_COUNT: return comm('stopping backend process') # close ...
python
def stop(self): """ Stops the backend process. """ if self._process is None: return if self._shared: BackendManager.SHARE_COUNT -= 1 if BackendManager.SHARE_COUNT: return comm('stopping backend process') # close ...
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "_process", "is", "None", ":", "return", "if", "self", ".", "_shared", ":", "BackendManager", ".", "SHARE_COUNT", "-=", "1", "if", "BackendManager", ".", "SHARE_COUNT", ":", "return", "comm", "(", ...
Stops the backend process.
[ "Stops", "the", "backend", "process", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/managers/backend.py#L128-L159
pyQode/pyqode.core
pyqode/core/managers/backend.py
BackendManager.send_request
def send_request(self, worker_class_or_function, args, on_receive=None): """ Requests some work to be done by the backend. You can get notified of the work results by passing a callback (on_receive). :param worker_class_or_function: Worker class or function :param args: worker a...
python
def send_request(self, worker_class_or_function, args, on_receive=None): """ Requests some work to be done by the backend. You can get notified of the work results by passing a callback (on_receive). :param worker_class_or_function: Worker class or function :param args: worker a...
[ "def", "send_request", "(", "self", ",", "worker_class_or_function", ",", "args", ",", "on_receive", "=", "None", ")", ":", "if", "not", "self", ".", "running", ":", "try", ":", "# try to restart the backend if it crashed.", "self", ".", "start", "(", "self", ...
Requests some work to be done by the backend. You can get notified of the work results by passing a callback (on_receive). :param worker_class_or_function: Worker class or function :param args: worker args, any Json serializable objects :param on_receive: an optional callback executed w...
[ "Requests", "some", "work", "to", "be", "done", "by", "the", "backend", ".", "You", "can", "get", "notified", "of", "the", "work", "results", "by", "passing", "a", "callback", "(", "on_receive", ")", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/managers/backend.py#L161-L194
pyQode/pyqode.core
pyqode/core/managers/backend.py
BackendManager.running
def running(self): """ Tells whether the backend process is running. :return: True if the process is running, otherwise False """ try: return (self._process is not None and self._process.state() != self._process.NotRunning) except RuntimeE...
python
def running(self): """ Tells whether the backend process is running. :return: True if the process is running, otherwise False """ try: return (self._process is not None and self._process.state() != self._process.NotRunning) except RuntimeE...
[ "def", "running", "(", "self", ")", ":", "try", ":", "return", "(", "self", ".", "_process", "is", "not", "None", "and", "self", ".", "_process", ".", "state", "(", ")", "!=", "self", ".", "_process", ".", "NotRunning", ")", "except", "RuntimeError", ...
Tells whether the backend process is running. :return: True if the process is running, otherwise False
[ "Tells", "whether", "the", "backend", "process", "is", "running", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/managers/backend.py#L211-L221
pyQode/pyqode.core
pyqode/core/widgets/menu_recents.py
RecentFilesManager.remove
def remove(self, filename): """ Remove a file path from the list of recent files. :param filename: Path of the file to remove """ files = self.get_value('list', []) files.remove(filename) self.set_value('list', files) self.updated.emit()
python
def remove(self, filename): """ Remove a file path from the list of recent files. :param filename: Path of the file to remove """ files = self.get_value('list', []) files.remove(filename) self.set_value('list', files) self.updated.emit()
[ "def", "remove", "(", "self", ",", "filename", ")", ":", "files", "=", "self", ".", "get_value", "(", "'list'", ",", "[", "]", ")", "files", ".", "remove", "(", "filename", ")", "self", ".", "set_value", "(", "'list'", ",", "files", ")", "self", "....
Remove a file path from the list of recent files. :param filename: Path of the file to remove
[ "Remove", "a", "file", "path", "from", "the", "list", "of", "recent", "files", ".", ":", "param", "filename", ":", "Path", "of", "the", "file", "to", "remove" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/menu_recents.py#L34-L42
pyQode/pyqode.core
pyqode/core/widgets/menu_recents.py
RecentFilesManager.get_value
def get_value(self, key, default=None): """ Reads value from QSettings :param key: value key :param default: default value. :return: value """ def unique(seq, idfun=None): if idfun is None: def idfun(x): return x ...
python
def get_value(self, key, default=None): """ Reads value from QSettings :param key: value key :param default: default value. :return: value """ def unique(seq, idfun=None): if idfun is None: def idfun(x): return x ...
[ "def", "get_value", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "def", "unique", "(", "seq", ",", "idfun", "=", "None", ")", ":", "if", "idfun", "is", "None", ":", "def", "idfun", "(", "x", ")", ":", "return", "x", "# order pr...
Reads value from QSettings :param key: value key :param default: default value. :return: value
[ "Reads", "value", "from", "QSettings", ":", "param", "key", ":", "value", "key", ":", "param", "default", ":", "default", "value", ".", ":", "return", ":", "value" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/menu_recents.py#L44-L72
pyQode/pyqode.core
pyqode/core/widgets/menu_recents.py
RecentFilesManager.set_value
def set_value(self, key, value): """ Set the recent files value in QSettings. :param key: value key :param value: new value """ if value is None: value = [] value = [os.path.normpath(pth) for pth in value] self._settings.setValue('recent_files/...
python
def set_value(self, key, value): """ Set the recent files value in QSettings. :param key: value key :param value: new value """ if value is None: value = [] value = [os.path.normpath(pth) for pth in value] self._settings.setValue('recent_files/...
[ "def", "set_value", "(", "self", ",", "key", ",", "value", ")", ":", "if", "value", "is", "None", ":", "value", "=", "[", "]", "value", "=", "[", "os", ".", "path", ".", "normpath", "(", "pth", ")", "for", "pth", "in", "value", "]", "self", "."...
Set the recent files value in QSettings. :param key: value key :param value: new value
[ "Set", "the", "recent", "files", "value", "in", "QSettings", ".", ":", "param", "key", ":", "value", "key", ":", "param", "value", ":", "new", "value" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/menu_recents.py#L74-L83
pyQode/pyqode.core
pyqode/core/widgets/menu_recents.py
RecentFilesManager.get_recent_files
def get_recent_files(self): """ Gets the list of recent files. (files that do not exists anymore are automatically filtered) """ ret_val = [] files = self.get_value('list', []) # filter files, remove files that do not exist anymore for file in files: ...
python
def get_recent_files(self): """ Gets the list of recent files. (files that do not exists anymore are automatically filtered) """ ret_val = [] files = self.get_value('list', []) # filter files, remove files that do not exist anymore for file in files: ...
[ "def", "get_recent_files", "(", "self", ")", ":", "ret_val", "=", "[", "]", "files", "=", "self", ".", "get_value", "(", "'list'", ",", "[", "]", ")", "# filter files, remove files that do not exist anymore", "for", "file", "in", "files", ":", "if", "file", ...
Gets the list of recent files. (files that do not exists anymore are automatically filtered)
[ "Gets", "the", "list", "of", "recent", "files", ".", "(", "files", "that", "do", "not", "exists", "anymore", "are", "automatically", "filtered", ")" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/menu_recents.py#L85-L100
pyQode/pyqode.core
pyqode/core/widgets/menu_recents.py
RecentFilesManager.open_file
def open_file(self, file): """ Adds a file to the list (and move it to the top of the list if the file already exists) :param file: file path to add the list of recent files. """ files = self.get_recent_files() try: files.remove(file) except ...
python
def open_file(self, file): """ Adds a file to the list (and move it to the top of the list if the file already exists) :param file: file path to add the list of recent files. """ files = self.get_recent_files() try: files.remove(file) except ...
[ "def", "open_file", "(", "self", ",", "file", ")", ":", "files", "=", "self", ".", "get_recent_files", "(", ")", "try", ":", "files", ".", "remove", "(", "file", ")", "except", "ValueError", ":", "pass", "files", ".", "insert", "(", "0", ",", "file",...
Adds a file to the list (and move it to the top of the list if the file already exists) :param file: file path to add the list of recent files.
[ "Adds", "a", "file", "to", "the", "list", "(", "and", "move", "it", "to", "the", "top", "of", "the", "list", "if", "the", "file", "already", "exists", ")" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/menu_recents.py#L102-L119
pyQode/pyqode.core
pyqode/core/widgets/menu_recents.py
MenuRecentFiles.update_actions
def update_actions(self): """ Updates the list of actions. """ self.clear() self.recent_files_actions[:] = [] for file in self.manager.get_recent_files(): action = QtWidgets.QAction(self) action.setText(os.path.split(file)[1]) action.se...
python
def update_actions(self): """ Updates the list of actions. """ self.clear() self.recent_files_actions[:] = [] for file in self.manager.get_recent_files(): action = QtWidgets.QAction(self) action.setText(os.path.split(file)[1]) action.se...
[ "def", "update_actions", "(", "self", ")", ":", "self", ".", "clear", "(", ")", "self", ".", "recent_files_actions", "[", ":", "]", "=", "[", "]", "for", "file", "in", "self", ".", "manager", ".", "get_recent_files", "(", ")", ":", "action", "=", "Qt...
Updates the list of actions.
[ "Updates", "the", "list", "of", "actions", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/menu_recents.py#L168-L196
pyQode/pyqode.core
pyqode/core/widgets/menu_recents.py
MenuRecentFiles.clear_recent_files
def clear_recent_files(self): """ Clear recent files and menu. """ self.manager.clear() self.update_actions() self.clear_requested.emit()
python
def clear_recent_files(self): """ Clear recent files and menu. """ self.manager.clear() self.update_actions() self.clear_requested.emit()
[ "def", "clear_recent_files", "(", "self", ")", ":", "self", ".", "manager", ".", "clear", "(", ")", "self", ".", "update_actions", "(", ")", "self", ".", "clear_requested", ".", "emit", "(", ")" ]
Clear recent files and menu.
[ "Clear", "recent", "files", "and", "menu", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/menu_recents.py#L198-L202
pyQode/pyqode.core
pyqode/core/widgets/menu_recents.py
MenuRecentFiles._on_action_triggered
def _on_action_triggered(self): """ Emits open_requested when a recent file action has been triggered. """ action = self.sender() assert isinstance(action, QtWidgets.QAction) path = action.data() self.open_requested.emit(path) self.update_actions()
python
def _on_action_triggered(self): """ Emits open_requested when a recent file action has been triggered. """ action = self.sender() assert isinstance(action, QtWidgets.QAction) path = action.data() self.open_requested.emit(path) self.update_actions()
[ "def", "_on_action_triggered", "(", "self", ")", ":", "action", "=", "self", ".", "sender", "(", ")", "assert", "isinstance", "(", "action", ",", "QtWidgets", ".", "QAction", ")", "path", "=", "action", ".", "data", "(", ")", "self", ".", "open_requested...
Emits open_requested when a recent file action has been triggered.
[ "Emits", "open_requested", "when", "a", "recent", "file", "action", "has", "been", "triggered", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/menu_recents.py#L204-L212
pyQode/pyqode.core
pyqode/core/managers/panels.py
PanelsManager.append
def append(self, panel, position=Panel.Position.LEFT): """ Installs a panel on the editor. :param panel: Panel to install :param position: Position where the panel must be installed. :return: The installed panel """ assert panel is not None pos_to_string ...
python
def append(self, panel, position=Panel.Position.LEFT): """ Installs a panel on the editor. :param panel: Panel to install :param position: Position where the panel must be installed. :return: The installed panel """ assert panel is not None pos_to_string ...
[ "def", "append", "(", "self", ",", "panel", ",", "position", "=", "Panel", ".", "Position", ".", "LEFT", ")", ":", "assert", "panel", "is", "not", "None", "pos_to_string", "=", "{", "Panel", ".", "Position", ".", "BOTTOM", ":", "'bottom'", ",", "Panel"...
Installs a panel on the editor. :param panel: Panel to install :param position: Position where the panel must be installed. :return: The installed panel
[ "Installs", "a", "panel", "on", "the", "editor", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/managers/panels.py#L40-L62
pyQode/pyqode.core
pyqode/core/managers/panels.py
PanelsManager.remove
def remove(self, name_or_klass): """ Removes the specified panel. :param name_or_klass: Name or class of the panel to remove. :return: The removed panel """ _logger().log(5, 'removing panel %r', name_or_klass) panel = self.get(name_or_klass) panel.on_unin...
python
def remove(self, name_or_klass): """ Removes the specified panel. :param name_or_klass: Name or class of the panel to remove. :return: The removed panel """ _logger().log(5, 'removing panel %r', name_or_klass) panel = self.get(name_or_klass) panel.on_unin...
[ "def", "remove", "(", "self", ",", "name_or_klass", ")", ":", "_logger", "(", ")", ".", "log", "(", "5", ",", "'removing panel %r'", ",", "name_or_klass", ")", "panel", "=", "self", ".", "get", "(", "name_or_klass", ")", "panel", ".", "on_uninstall", "("...
Removes the specified panel. :param name_or_klass: Name or class of the panel to remove. :return: The removed panel
[ "Removes", "the", "specified", "panel", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/managers/panels.py#L64-L76
pyQode/pyqode.core
pyqode/core/managers/panels.py
PanelsManager.get
def get(self, name_or_klass): """ Gets a specific panel instance. :param name_or_klass: Name or class of the panel to retrieve. :return: The specified panel instance. """ if not isinstance(name_or_klass, str): name_or_klass = name_or_klass.__name__ fo...
python
def get(self, name_or_klass): """ Gets a specific panel instance. :param name_or_klass: Name or class of the panel to retrieve. :return: The specified panel instance. """ if not isinstance(name_or_klass, str): name_or_klass = name_or_klass.__name__ fo...
[ "def", "get", "(", "self", ",", "name_or_klass", ")", ":", "if", "not", "isinstance", "(", "name_or_klass", ",", "str", ")", ":", "name_or_klass", "=", "name_or_klass", ".", "__name__", "for", "zone", "in", "range", "(", "4", ")", ":", "try", ":", "pan...
Gets a specific panel instance. :param name_or_klass: Name or class of the panel to retrieve. :return: The specified panel instance.
[ "Gets", "a", "specific", "panel", "instance", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/managers/panels.py#L90-L106
pyQode/pyqode.core
pyqode/core/managers/panels.py
PanelsManager.refresh
def refresh(self): """ Refreshes the editor panels (resize and update margins) """ _logger().log(5, 'refresh_panels') self.resize() self._update(self.editor.contentsRect(), 0, force_update_margins=True)
python
def refresh(self): """ Refreshes the editor panels (resize and update margins) """ _logger().log(5, 'refresh_panels') self.resize() self._update(self.editor.contentsRect(), 0, force_update_margins=True)
[ "def", "refresh", "(", "self", ")", ":", "_logger", "(", ")", ".", "log", "(", "5", ",", "'refresh_panels'", ")", "self", ".", "resize", "(", ")", "self", ".", "_update", "(", "self", ".", "editor", ".", "contentsRect", "(", ")", ",", "0", ",", "...
Refreshes the editor panels (resize and update margins)
[ "Refreshes", "the", "editor", "panels", "(", "resize", "and", "update", "margins", ")" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/managers/panels.py#L144-L149
pyQode/pyqode.core
pyqode/core/managers/panels.py
PanelsManager._update
def _update(self, rect, delta_y, force_update_margins=False): """ Updates panels """ helper = TextHelper(self.editor) if not self: return for zones_id, zone in self._panels.items(): if zones_id == Panel.Position.TOP or \ zones_id == Panel.Position.B...
python
def _update(self, rect, delta_y, force_update_margins=False): """ Updates panels """ helper = TextHelper(self.editor) if not self: return for zones_id, zone in self._panels.items(): if zones_id == Panel.Position.TOP or \ zones_id == Panel.Position.B...
[ "def", "_update", "(", "self", ",", "rect", ",", "delta_y", ",", "force_update_margins", "=", "False", ")", ":", "helper", "=", "TextHelper", "(", "self", ".", "editor", ")", "if", "not", "self", ":", "return", "for", "zones_id", ",", "zone", "in", "se...
Updates panels
[ "Updates", "panels" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/managers/panels.py#L212-L232
pyQode/pyqode.core
pyqode/core/icons.py
icon
def icon(theme_name='', path='', qta_name='', qta_options=None, use_qta=None): """ Creates an icon from qtawesome, from theme or from path. :param theme_name: icon name in the current theme (GNU/Linux only) :param path: path of the icon (from file system or qrc) :param qta_name: icon name in qtawes...
python
def icon(theme_name='', path='', qta_name='', qta_options=None, use_qta=None): """ Creates an icon from qtawesome, from theme or from path. :param theme_name: icon name in the current theme (GNU/Linux only) :param path: path of the icon (from file system or qrc) :param qta_name: icon name in qtawes...
[ "def", "icon", "(", "theme_name", "=", "''", ",", "path", "=", "''", ",", "qta_name", "=", "''", ",", "qta_options", "=", "None", ",", "use_qta", "=", "None", ")", ":", "ret_val", "=", "None", "if", "use_qta", "is", "None", ":", "use_qta", "=", "US...
Creates an icon from qtawesome, from theme or from path. :param theme_name: icon name in the current theme (GNU/Linux only) :param path: path of the icon (from file system or qrc) :param qta_name: icon name in qtawesome :param qta_options: the qtawesome options to use for controlling icon ...
[ "Creates", "an", "icon", "from", "qtawesome", "from", "theme", "or", "from", "path", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/icons.py#L29-L57
pyQode/pyqode.core
pyqode/core/api/decoration.py
TextDecoration.set_outline
def set_outline(self, color): """ Uses an outline rectangle. :param color: Color of the outline rect :type color: QtGui.QColor """ self.format.setProperty(QtGui.QTextFormat.OutlinePen, QtGui.QPen(color))
python
def set_outline(self, color): """ Uses an outline rectangle. :param color: Color of the outline rect :type color: QtGui.QColor """ self.format.setProperty(QtGui.QTextFormat.OutlinePen, QtGui.QPen(color))
[ "def", "set_outline", "(", "self", ",", "color", ")", ":", "self", ".", "format", ".", "setProperty", "(", "QtGui", ".", "QTextFormat", ".", "OutlinePen", ",", "QtGui", ".", "QPen", "(", "color", ")", ")" ]
Uses an outline rectangle. :param color: Color of the outline rect :type color: QtGui.QColor
[ "Uses", "an", "outline", "rectangle", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/api/decoration.py#L114-L122
pyQode/pyqode.core
pyqode/core/api/decoration.py
TextDecoration.set_full_width
def set_full_width(self, flag=True, clear=True): """ Enables FullWidthSelection (the selection does not stops at after the character instead it goes up to the right side of the widget). :param flag: True to use full width selection. :type flag: bool :param clear: True t...
python
def set_full_width(self, flag=True, clear=True): """ Enables FullWidthSelection (the selection does not stops at after the character instead it goes up to the right side of the widget). :param flag: True to use full width selection. :type flag: bool :param clear: True t...
[ "def", "set_full_width", "(", "self", ",", "flag", "=", "True", ",", "clear", "=", "True", ")", ":", "if", "clear", ":", "self", ".", "cursor", ".", "clearSelection", "(", ")", "self", ".", "format", ".", "setProperty", "(", "QtGui", ".", "QTextFormat"...
Enables FullWidthSelection (the selection does not stops at after the character instead it goes up to the right side of the widget). :param flag: True to use full width selection. :type flag: bool :param clear: True to clear any previous selection. Default is True. :type clear:...
[ "Enables", "FullWidthSelection", "(", "the", "selection", "does", "not", "stops", "at", "after", "the", "character", "instead", "it", "goes", "up", "to", "the", "right", "side", "of", "the", "widget", ")", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/api/decoration.py#L137-L150
doloopwhile/Python-CoffeeScript
coffeescript/__init__.py
Compiler.compile
def compile(self, script, bare=False): '''compile a CoffeeScript code to a JavaScript code. if bare is True, then compile the JavaScript without the top-level function safety wrapper (like the coffee command). ''' if not hasattr(self, '_context'): self._context = sel...
python
def compile(self, script, bare=False): '''compile a CoffeeScript code to a JavaScript code. if bare is True, then compile the JavaScript without the top-level function safety wrapper (like the coffee command). ''' if not hasattr(self, '_context'): self._context = sel...
[ "def", "compile", "(", "self", ",", "script", ",", "bare", "=", "False", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_context'", ")", ":", "self", ".", "_context", "=", "self", ".", "_runtime", ".", "compile", "(", "self", ".", "_compiler_s...
compile a CoffeeScript code to a JavaScript code. if bare is True, then compile the JavaScript without the top-level function safety wrapper (like the coffee command).
[ "compile", "a", "CoffeeScript", "code", "to", "a", "JavaScript", "code", "." ]
train
https://github.com/doloopwhile/Python-CoffeeScript/blob/9ca0c861c7c2e5c4ecd2dad7dc9010a15a4fb404/coffeescript/__init__.py#L73-L82
doloopwhile/Python-CoffeeScript
coffeescript/__init__.py
Compiler.compile_file
def compile_file(self, filename, encoding="utf-8", bare=False): '''compile a CoffeeScript script file to a JavaScript code. filename can be a list or tuple of filenames, then contents of files are concatenated with line feeds. if bare is True, then compile the JavaScript without the to...
python
def compile_file(self, filename, encoding="utf-8", bare=False): '''compile a CoffeeScript script file to a JavaScript code. filename can be a list or tuple of filenames, then contents of files are concatenated with line feeds. if bare is True, then compile the JavaScript without the to...
[ "def", "compile_file", "(", "self", ",", "filename", ",", "encoding", "=", "\"utf-8\"", ",", "bare", "=", "False", ")", ":", "if", "isinstance", "(", "filename", ",", "_BaseString", ")", ":", "filename", "=", "[", "filename", "]", "scripts", "=", "[", ...
compile a CoffeeScript script file to a JavaScript code. filename can be a list or tuple of filenames, then contents of files are concatenated with line feeds. if bare is True, then compile the JavaScript without the top-level function safety wrapper (like the coffee command).
[ "compile", "a", "CoffeeScript", "script", "file", "to", "a", "JavaScript", "code", "." ]
train
https://github.com/doloopwhile/Python-CoffeeScript/blob/9ca0c861c7c2e5c4ecd2dad7dc9010a15a4fb404/coffeescript/__init__.py#L84-L101
pyQode/pyqode.core
examples/notepad/notepad/main_window.py
MainWindow.setup_actions
def setup_actions(self): """ Connects slots to signals """ self.actionOpen.triggered.connect(self.on_open) self.actionNew.triggered.connect(self.on_new) self.actionSave.triggered.connect(self.on_save) self.actionSave_as.triggered.connect(self.on_save_as) self.actionQuit.t...
python
def setup_actions(self): """ Connects slots to signals """ self.actionOpen.triggered.connect(self.on_open) self.actionNew.triggered.connect(self.on_new) self.actionSave.triggered.connect(self.on_save) self.actionSave_as.triggered.connect(self.on_save_as) self.actionQuit.t...
[ "def", "setup_actions", "(", "self", ")", ":", "self", ".", "actionOpen", ".", "triggered", ".", "connect", "(", "self", ".", "on_open", ")", "self", ".", "actionNew", ".", "triggered", ".", "connect", "(", "self", ".", "on_new", ")", "self", ".", "act...
Connects slots to signals
[ "Connects", "slots", "to", "signals" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/examples/notepad/notepad/main_window.py#L54-L63
pyQode/pyqode.core
examples/notepad/notepad/main_window.py
MainWindow.setup_recent_files_menu
def setup_recent_files_menu(self): """ Setup the recent files menu and manager """ self.recent_files_manager = widgets.RecentFilesManager( 'pyQode', 'notepad') self.menu_recents = widgets.MenuRecentFiles( self.menuFile, title='Recents', recent_files_manager=se...
python
def setup_recent_files_menu(self): """ Setup the recent files menu and manager """ self.recent_files_manager = widgets.RecentFilesManager( 'pyQode', 'notepad') self.menu_recents = widgets.MenuRecentFiles( self.menuFile, title='Recents', recent_files_manager=se...
[ "def", "setup_recent_files_menu", "(", "self", ")", ":", "self", ".", "recent_files_manager", "=", "widgets", ".", "RecentFilesManager", "(", "'pyQode'", ",", "'notepad'", ")", "self", ".", "menu_recents", "=", "widgets", ".", "MenuRecentFiles", "(", "self", "."...
Setup the recent files menu and manager
[ "Setup", "the", "recent", "files", "menu", "and", "manager" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/examples/notepad/notepad/main_window.py#L65-L74
pyQode/pyqode.core
examples/notepad/notepad/main_window.py
MainWindow.setup_mimetypes
def setup_mimetypes(self): """ Setup additional mime types. """ # setup some specific mimetypes mimetypes.add_type('text/xml', '.ui') # qt designer forms forms mimetypes.add_type('text/x-rst', '.rst') # rst docs mimetypes.add_type('text/x-cython', '.pyx') # cython impl files ...
python
def setup_mimetypes(self): """ Setup additional mime types. """ # setup some specific mimetypes mimetypes.add_type('text/xml', '.ui') # qt designer forms forms mimetypes.add_type('text/x-rst', '.rst') # rst docs mimetypes.add_type('text/x-cython', '.pyx') # cython impl files ...
[ "def", "setup_mimetypes", "(", "self", ")", ":", "# setup some specific mimetypes", "mimetypes", ".", "add_type", "(", "'text/xml'", ",", "'.ui'", ")", "# qt designer forms forms", "mimetypes", ".", "add_type", "(", "'text/x-rst'", ",", "'.rst'", ")", "# rst docs", ...
Setup additional mime types.
[ "Setup", "additional", "mime", "types", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/examples/notepad/notepad/main_window.py#L76-L93
pyQode/pyqode.core
examples/notepad/notepad/main_window.py
MainWindow.open_file
def open_file(self, path): """ Creates a new GenericCodeEdit, opens the requested file and adds it to the tab widget. :param path: Path of the file to open """ if path: editor = self.tabWidget.open_document(path) editor.cursorPositionChanged.conne...
python
def open_file(self, path): """ Creates a new GenericCodeEdit, opens the requested file and adds it to the tab widget. :param path: Path of the file to open """ if path: editor = self.tabWidget.open_document(path) editor.cursorPositionChanged.conne...
[ "def", "open_file", "(", "self", ",", "path", ")", ":", "if", "path", ":", "editor", "=", "self", ".", "tabWidget", ".", "open_document", "(", "path", ")", "editor", ".", "cursorPositionChanged", ".", "connect", "(", "self", ".", "on_cursor_pos_changed", "...
Creates a new GenericCodeEdit, opens the requested file and adds it to the tab widget. :param path: Path of the file to open
[ "Creates", "a", "new", "GenericCodeEdit", "opens", "the", "requested", "file", "and", "adds", "it", "to", "the", "tab", "widget", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/examples/notepad/notepad/main_window.py#L144-L156
pyQode/pyqode.core
examples/notepad/notepad/main_window.py
MainWindow.on_new
def on_new(self): """ Add a new empty code editor to the tab widget """ editor = self.tabWidget.create_new_document() editor.cursorPositionChanged.connect(self.on_cursor_pos_changed) self.refresh_color_scheme()
python
def on_new(self): """ Add a new empty code editor to the tab widget """ editor = self.tabWidget.create_new_document() editor.cursorPositionChanged.connect(self.on_cursor_pos_changed) self.refresh_color_scheme()
[ "def", "on_new", "(", "self", ")", ":", "editor", "=", "self", ".", "tabWidget", ".", "create_new_document", "(", ")", "editor", ".", "cursorPositionChanged", ".", "connect", "(", "self", ".", "on_cursor_pos_changed", ")", "self", ".", "refresh_color_scheme", ...
Add a new empty code editor to the tab widget
[ "Add", "a", "new", "empty", "code", "editor", "to", "the", "tab", "widget" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/examples/notepad/notepad/main_window.py#L158-L164
pyQode/pyqode.core
examples/notepad/notepad/main_window.py
MainWindow.on_open
def on_open(self): """ Shows an open file dialog and open the file if the dialog was accepted. """ filename, filter = QtWidgets.QFileDialog.getOpenFileName( self, _('Open')) if filename: self.open_file(filename)
python
def on_open(self): """ Shows an open file dialog and open the file if the dialog was accepted. """ filename, filter = QtWidgets.QFileDialog.getOpenFileName( self, _('Open')) if filename: self.open_file(filename)
[ "def", "on_open", "(", "self", ")", ":", "filename", ",", "filter", "=", "QtWidgets", ".", "QFileDialog", ".", "getOpenFileName", "(", "self", ",", "_", "(", "'Open'", ")", ")", "if", "filename", ":", "self", ".", "open_file", "(", "filename", ")" ]
Shows an open file dialog and open the file if the dialog was accepted.
[ "Shows", "an", "open", "file", "dialog", "and", "open", "the", "file", "if", "the", "dialog", "was", "accepted", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/examples/notepad/notepad/main_window.py#L166-L175
pyQode/pyqode.core
examples/notepad/notepad/main_window.py
MainWindow.on_save_as
def on_save_as(self): """ Save the current editor document as. """ self.tabWidget.save_current_as() self._update_status_bar(self.tabWidget.current_widget())
python
def on_save_as(self): """ Save the current editor document as. """ self.tabWidget.save_current_as() self._update_status_bar(self.tabWidget.current_widget())
[ "def", "on_save_as", "(", "self", ")", ":", "self", ".", "tabWidget", ".", "save_current_as", "(", ")", "self", ".", "_update_status_bar", "(", "self", ".", "tabWidget", ".", "current_widget", "(", ")", ")" ]
Save the current editor document as.
[ "Save", "the", "current", "editor", "document", "as", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/examples/notepad/notepad/main_window.py#L181-L186
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
BaseTabWidget.tab_under_menu
def tab_under_menu(self): """ Returns the tab that sits under the context menu. :return: QWidget """ if self._menu_pos: return self.tabBar().tabAt(self._menu_pos) else: return self.currentIndex()
python
def tab_under_menu(self): """ Returns the tab that sits under the context menu. :return: QWidget """ if self._menu_pos: return self.tabBar().tabAt(self._menu_pos) else: return self.currentIndex()
[ "def", "tab_under_menu", "(", "self", ")", ":", "if", "self", ".", "_menu_pos", ":", "return", "self", ".", "tabBar", "(", ")", ".", "tabAt", "(", "self", ".", "_menu_pos", ")", "else", ":", "return", "self", ".", "currentIndex", "(", ")" ]
Returns the tab that sits under the context menu. :return: QWidget
[ "Returns", "the", "tab", "that", "sits", "under", "the", "context", "menu", ".", ":", "return", ":", "QWidget" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L157-L165
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
BaseTabWidget.close_others
def close_others(self): """ Closes every editors tabs except the current one. """ current_widget = self.widget(self.tab_under_menu()) if self._try_close_dirty_tabs(exept=current_widget): i = 0 while self.count() > 1: widget = self.widget(i)...
python
def close_others(self): """ Closes every editors tabs except the current one. """ current_widget = self.widget(self.tab_under_menu()) if self._try_close_dirty_tabs(exept=current_widget): i = 0 while self.count() > 1: widget = self.widget(i)...
[ "def", "close_others", "(", "self", ")", ":", "current_widget", "=", "self", ".", "widget", "(", "self", ".", "tab_under_menu", "(", ")", ")", "if", "self", ".", "_try_close_dirty_tabs", "(", "exept", "=", "current_widget", ")", ":", "i", "=", "0", "whil...
Closes every editors tabs except the current one.
[ "Closes", "every", "editors", "tabs", "except", "the", "current", "one", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L173-L185
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
BaseTabWidget.close_left
def close_left(self): """ Closes every editors tabs on the left of the current one. """ current_widget = self.widget(self.tab_under_menu()) index = self.indexOf(current_widget) if self._try_close_dirty_tabs(tab_range=range(index)): while True: ...
python
def close_left(self): """ Closes every editors tabs on the left of the current one. """ current_widget = self.widget(self.tab_under_menu()) index = self.indexOf(current_widget) if self._try_close_dirty_tabs(tab_range=range(index)): while True: ...
[ "def", "close_left", "(", "self", ")", ":", "current_widget", "=", "self", ".", "widget", "(", "self", ".", "tab_under_menu", "(", ")", ")", "index", "=", "self", ".", "indexOf", "(", "current_widget", ")", "if", "self", ".", "_try_close_dirty_tabs", "(", ...
Closes every editors tabs on the left of the current one.
[ "Closes", "every", "editors", "tabs", "on", "the", "left", "of", "the", "current", "one", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L187-L199
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
BaseTabWidget.close_right
def close_right(self): """ Closes every editors tabs on the left of the current one. """ current_widget = self.widget(self.tab_under_menu()) index = self.indexOf(current_widget) if self._try_close_dirty_tabs(tab_range=range(index + 1, self.count())): while Tru...
python
def close_right(self): """ Closes every editors tabs on the left of the current one. """ current_widget = self.widget(self.tab_under_menu()) index = self.indexOf(current_widget) if self._try_close_dirty_tabs(tab_range=range(index + 1, self.count())): while Tru...
[ "def", "close_right", "(", "self", ")", ":", "current_widget", "=", "self", ".", "widget", "(", "self", ".", "tab_under_menu", "(", ")", ")", "index", "=", "self", ".", "indexOf", "(", "current_widget", ")", "if", "self", ".", "_try_close_dirty_tabs", "(",...
Closes every editors tabs on the left of the current one.
[ "Closes", "every", "editors", "tabs", "on", "the", "left", "of", "the", "current", "one", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L201-L213
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
BaseTabWidget.close_all
def close_all(self): """ Closes all editors """ if self._try_close_dirty_tabs(): while self.count(): widget = self.widget(0) self.remove_tab(0) self.tab_closed.emit(widget) return True return False
python
def close_all(self): """ Closes all editors """ if self._try_close_dirty_tabs(): while self.count(): widget = self.widget(0) self.remove_tab(0) self.tab_closed.emit(widget) return True return False
[ "def", "close_all", "(", "self", ")", ":", "if", "self", ".", "_try_close_dirty_tabs", "(", ")", ":", "while", "self", ".", "count", "(", ")", ":", "widget", "=", "self", ".", "widget", "(", "0", ")", "self", ".", "remove_tab", "(", "0", ")", "self...
Closes all editors
[ "Closes", "all", "editors" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L215-L225
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
BaseTabWidget._collect_dirty_tabs
def _collect_dirty_tabs(self, skip=None, tab_range=None): """ Collects the list of dirty tabs :param skip: Tab to skip (used for close_others). """ widgets = [] filenames = [] if tab_range is None: tab_range = range(self.count()) for i in tab_...
python
def _collect_dirty_tabs(self, skip=None, tab_range=None): """ Collects the list of dirty tabs :param skip: Tab to skip (used for close_others). """ widgets = [] filenames = [] if tab_range is None: tab_range = range(self.count()) for i in tab_...
[ "def", "_collect_dirty_tabs", "(", "self", ",", "skip", "=", "None", ",", "tab_range", "=", "None", ")", ":", "widgets", "=", "[", "]", "filenames", "=", "[", "]", "if", "tab_range", "is", "None", ":", "tab_range", "=", "range", "(", "self", ".", "co...
Collects the list of dirty tabs :param skip: Tab to skip (used for close_others).
[ "Collects", "the", "list", "of", "dirty", "tabs" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L373-L394
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
BaseTabWidget._close_widget
def _close_widget(widget): """ Closes the given widgets and handles cases where the widget has been clone or is a clone of another widget """ if widget is None: return try: widget.document().setParent(None) widget.syntax_highlighter.set...
python
def _close_widget(widget): """ Closes the given widgets and handles cases where the widget has been clone or is a clone of another widget """ if widget is None: return try: widget.document().setParent(None) widget.syntax_highlighter.set...
[ "def", "_close_widget", "(", "widget", ")", ":", "if", "widget", "is", "None", ":", "return", "try", ":", "widget", ".", "document", "(", ")", ".", "setParent", "(", "None", ")", "widget", ".", "syntax_highlighter", ".", "setParent", "(", "None", ")", ...
Closes the given widgets and handles cases where the widget has been clone or is a clone of another widget
[ "Closes", "the", "given", "widgets", "and", "handles", "cases", "where", "the", "widget", "has", "been", "clone", "or", "is", "a", "clone", "of", "another", "widget" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L453-L483
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
BaseTabWidget.remove_tab
def remove_tab(self, index): """ Overrides removeTab to emit tab_closed and last_tab_closed signals. :param index: index of the tab to remove. """ widget = self.widget(index) try: document = widget.document() except AttributeError: documen...
python
def remove_tab(self, index): """ Overrides removeTab to emit tab_closed and last_tab_closed signals. :param index: index of the tab to remove. """ widget = self.widget(index) try: document = widget.document() except AttributeError: documen...
[ "def", "remove_tab", "(", "self", ",", "index", ")", ":", "widget", "=", "self", ".", "widget", "(", "index", ")", "try", ":", "document", "=", "widget", ".", "document", "(", ")", "except", "AttributeError", ":", "document", "=", "None", "# not a QPlain...
Overrides removeTab to emit tab_closed and last_tab_closed signals. :param index: index of the tab to remove.
[ "Overrides", "removeTab", "to", "emit", "tab_closed", "and", "last_tab_closed", "signals", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L497-L523
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
BaseTabWidget._on_split_requested
def _on_split_requested(self): """ Emits the split requested signal with the desired orientation. """ orientation = self.sender().text() widget = self.widget(self.tab_under_menu()) if 'horizontally' in orientation: self.split_requested.emit( wi...
python
def _on_split_requested(self): """ Emits the split requested signal with the desired orientation. """ orientation = self.sender().text() widget = self.widget(self.tab_under_menu()) if 'horizontally' in orientation: self.split_requested.emit( wi...
[ "def", "_on_split_requested", "(", "self", ")", ":", "orientation", "=", "self", ".", "sender", "(", ")", ".", "text", "(", ")", "widget", "=", "self", ".", "widget", "(", "self", ".", "tab_under_menu", "(", ")", ")", "if", "'horizontally'", "in", "ori...
Emits the split requested signal with the desired orientation.
[ "Emits", "the", "split", "requested", "signal", "with", "the", "desired", "orientation", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L525-L536
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
BaseTabWidget.addTab
def addTab(self, tab, *args): """ Adds a tab to the tab widget, this function set the parent_tab_widget attribute on the tab instance. """ tab.parent_tab_widget = self super(BaseTabWidget, self).addTab(tab, *args)
python
def addTab(self, tab, *args): """ Adds a tab to the tab widget, this function set the parent_tab_widget attribute on the tab instance. """ tab.parent_tab_widget = self super(BaseTabWidget, self).addTab(tab, *args)
[ "def", "addTab", "(", "self", ",", "tab", ",", "*", "args", ")", ":", "tab", ".", "parent_tab_widget", "=", "self", "super", "(", "BaseTabWidget", ",", "self", ")", ".", "addTab", "(", "tab", ",", "*", "args", ")" ]
Adds a tab to the tab widget, this function set the parent_tab_widget attribute on the tab instance.
[ "Adds", "a", "tab", "to", "the", "tab", "widget", "this", "function", "set", "the", "parent_tab_widget", "attribute", "on", "the", "tab", "instance", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L571-L577
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableTabWidget.add_context_action
def add_context_action(self, action): """ Adds a custom context menu action :param action: action to add. """ self.main_tab_widget.context_actions.append(action) for child_splitter in self.child_splitters: child_splitter.add_context_action(action)
python
def add_context_action(self, action): """ Adds a custom context menu action :param action: action to add. """ self.main_tab_widget.context_actions.append(action) for child_splitter in self.child_splitters: child_splitter.add_context_action(action)
[ "def", "add_context_action", "(", "self", ",", "action", ")", ":", "self", ".", "main_tab_widget", ".", "context_actions", ".", "append", "(", "action", ")", "for", "child_splitter", "in", "self", ".", "child_splitters", ":", "child_splitter", ".", "add_context_...
Adds a custom context menu action :param action: action to add.
[ "Adds", "a", "custom", "context", "menu", "action" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L749-L757
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableTabWidget.add_tab
def add_tab(self, tab, title='', icon=None): """ Adds a tab to main tab widget. :param tab: Widget to add as a new tab of the main tab widget. :param title: Tab title :param icon: Tab icon """ if icon: tab._icon = icon if not hasattr(tab, 'clo...
python
def add_tab(self, tab, title='', icon=None): """ Adds a tab to main tab widget. :param tab: Widget to add as a new tab of the main tab widget. :param title: Tab title :param icon: Tab icon """ if icon: tab._icon = icon if not hasattr(tab, 'clo...
[ "def", "add_tab", "(", "self", ",", "tab", ",", "title", "=", "''", ",", "icon", "=", "None", ")", ":", "if", "icon", ":", "tab", ".", "_icon", "=", "icon", "if", "not", "hasattr", "(", "tab", ",", "'clones'", ")", ":", "tab", ".", "clones", "=...
Adds a tab to main tab widget. :param tab: Widget to add as a new tab of the main tab widget. :param title: Tab title :param icon: Tab icon
[ "Adds", "a", "tab", "to", "main", "tab", "widget", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L759-L791
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableTabWidget.split
def split(self, widget, orientation): """ Split the the current widget in new SplittableTabWidget. :param widget: widget to split :param orientation: orientation of the splitter :return: the new splitter """ if widget.original: base = widget.original ...
python
def split(self, widget, orientation): """ Split the the current widget in new SplittableTabWidget. :param widget: widget to split :param orientation: orientation of the splitter :return: the new splitter """ if widget.original: base = widget.original ...
[ "def", "split", "(", "self", ",", "widget", ",", "orientation", ")", ":", "if", "widget", ".", "original", ":", "base", "=", "widget", ".", "original", "else", ":", "base", "=", "widget", "clone", "=", "base", ".", "split", "(", ")", "if", "not", "...
Split the the current widget in new SplittableTabWidget. :param widget: widget to split :param orientation: orientation of the splitter :return: the new splitter
[ "Split", "the", "the", "current", "widget", "in", "new", "SplittableTabWidget", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L836-L878
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableTabWidget.has_children
def has_children(self): """ Checks if there are children tab widgets. :return: True if there is at least one tab in the children tab widget. """ for splitter in self.child_splitters: if splitter.has_children(): return splitter return self.main_...
python
def has_children(self): """ Checks if there are children tab widgets. :return: True if there is at least one tab in the children tab widget. """ for splitter in self.child_splitters: if splitter.has_children(): return splitter return self.main_...
[ "def", "has_children", "(", "self", ")", ":", "for", "splitter", "in", "self", ".", "child_splitters", ":", "if", "splitter", ".", "has_children", "(", ")", ":", "return", "splitter", "return", "self", ".", "main_tab_widget", ".", "count", "(", ")", "!=", ...
Checks if there are children tab widgets. :return: True if there is at least one tab in the children tab widget.
[ "Checks", "if", "there", "are", "children", "tab", "widgets", ".", ":", "return", ":", "True", "if", "there", "is", "at", "least", "one", "tab", "in", "the", "children", "tab", "widget", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L880-L888
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableTabWidget.widgets
def widgets(self, include_clones=False): """ Recursively gets the list of widgets. :param include_clones: True to retrieve all tabs, including clones, otherwise only original widgets are returned. """ widgets = [] for i in range(self.main_tab_widget.count()):...
python
def widgets(self, include_clones=False): """ Recursively gets the list of widgets. :param include_clones: True to retrieve all tabs, including clones, otherwise only original widgets are returned. """ widgets = [] for i in range(self.main_tab_widget.count()):...
[ "def", "widgets", "(", "self", ",", "include_clones", "=", "False", ")", ":", "widgets", "=", "[", "]", "for", "i", "in", "range", "(", "self", ".", "main_tab_widget", ".", "count", "(", ")", ")", ":", "widget", "=", "self", ".", "main_tab_widget", "...
Recursively gets the list of widgets. :param include_clones: True to retrieve all tabs, including clones, otherwise only original widgets are returned.
[ "Recursively", "gets", "the", "list", "of", "widgets", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L900-L917
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableTabWidget.count
def count(self): """ Returns the number of widgets currently displayed (takes child splits into account). """ c = self.main_tab_widget.count() for child in self.child_splitters: c += child.count() return c
python
def count(self): """ Returns the number of widgets currently displayed (takes child splits into account). """ c = self.main_tab_widget.count() for child in self.child_splitters: c += child.count() return c
[ "def", "count", "(", "self", ")", ":", "c", "=", "self", ".", "main_tab_widget", ".", "count", "(", ")", "for", "child", "in", "self", ".", "child_splitters", ":", "c", "+=", "child", ".", "count", "(", ")", "return", "c" ]
Returns the number of widgets currently displayed (takes child splits into account).
[ "Returns", "the", "number", "of", "widgets", "currently", "displayed", "(", "takes", "child", "splits", "into", "account", ")", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L971-L979
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
CodeEditTabWidget.get_filter
def get_filter(cls, mimetype): """ Returns a filter string for the file dialog. The filter is based on the mime type. :param mimetype: path from which the filter must be derived. :return: Filter string """ filters = ' '.join( ['*%s' % ext for ext in m...
python
def get_filter(cls, mimetype): """ Returns a filter string for the file dialog. The filter is based on the mime type. :param mimetype: path from which the filter must be derived. :return: Filter string """ filters = ' '.join( ['*%s' % ext for ext in m...
[ "def", "get_filter", "(", "cls", ",", "mimetype", ")", ":", "filters", "=", "' '", ".", "join", "(", "[", "'*%s'", "%", "ext", "for", "ext", "in", "mimetypes", ".", "guess_all_extensions", "(", "mimetype", ")", "]", ")", "return", "'%s (%s)'", "%", "("...
Returns a filter string for the file dialog. The filter is based on the mime type. :param mimetype: path from which the filter must be derived. :return: Filter string
[ "Returns", "a", "filter", "string", "for", "the", "file", "dialog", ".", "The", "filter", "is", "based", "on", "the", "mime", "type", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L993-L1003
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
CodeEditTabWidget.addTab
def addTab(self, widget, *args): """ Re-implements addTab to connect to the dirty changed signal and setup some helper attributes. :param widget: widget to add :param args: optional addtional arguments (name and/or icon). """ widget.dirty_changed.connect(self._on...
python
def addTab(self, widget, *args): """ Re-implements addTab to connect to the dirty changed signal and setup some helper attributes. :param widget: widget to add :param args: optional addtional arguments (name and/or icon). """ widget.dirty_changed.connect(self._on...
[ "def", "addTab", "(", "self", ",", "widget", ",", "*", "args", ")", ":", "widget", ".", "dirty_changed", ".", "connect", "(", "self", ".", "_on_dirty_changed", ")", "super", "(", "CodeEditTabWidget", ",", "self", ")", ".", "addTab", "(", "widget", ",", ...
Re-implements addTab to connect to the dirty changed signal and setup some helper attributes. :param widget: widget to add :param args: optional addtional arguments (name and/or icon).
[ "Re", "-", "implements", "addTab", "to", "connect", "to", "the", "dirty", "changed", "signal", "and", "setup", "some", "helper", "attributes", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1005-L1014
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
CodeEditTabWidget._on_dirty_changed
def _on_dirty_changed(self, dirty): """ Adds a star in front of a dirtt tab and emits dirty_changed. """ widget = self.sender() if isinstance(widget, DraggableTabBar): return parent = widget.parent_tab_widget index = parent.indexOf(widget) titl...
python
def _on_dirty_changed(self, dirty): """ Adds a star in front of a dirtt tab and emits dirty_changed. """ widget = self.sender() if isinstance(widget, DraggableTabBar): return parent = widget.parent_tab_widget index = parent.indexOf(widget) titl...
[ "def", "_on_dirty_changed", "(", "self", ",", "dirty", ")", ":", "widget", "=", "self", ".", "sender", "(", ")", "if", "isinstance", "(", "widget", ",", "DraggableTabBar", ")", ":", "return", "parent", "=", "widget", ".", "parent_tab_widget", "index", "=",...
Adds a star in front of a dirtt tab and emits dirty_changed.
[ "Adds", "a", "star", "in", "front", "of", "a", "dirtt", "tab", "and", "emits", "dirty_changed", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1016-L1031
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
CodeEditTabWidget._ask_path
def _ask_path(cls, editor): """ Shows a QFileDialog and ask for a save filename. :return: save filename """ try: filter = cls.get_filter(editor.mimetypes[0]) except IndexError: filter = _('All files (*)') return QtWidgets.QFileDialog.getSa...
python
def _ask_path(cls, editor): """ Shows a QFileDialog and ask for a save filename. :return: save filename """ try: filter = cls.get_filter(editor.mimetypes[0]) except IndexError: filter = _('All files (*)') return QtWidgets.QFileDialog.getSa...
[ "def", "_ask_path", "(", "cls", ",", "editor", ")", ":", "try", ":", "filter", "=", "cls", ".", "get_filter", "(", "editor", ".", "mimetypes", "[", "0", "]", ")", "except", "IndexError", ":", "filter", "=", "_", "(", "'All files (*)'", ")", "return", ...
Shows a QFileDialog and ask for a save filename. :return: save filename
[ "Shows", "a", "QFileDialog", "and", "ask", "for", "a", "save", "filename", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1034-L1045
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
CodeEditTabWidget.save_widget
def save_widget(cls, editor): """ Implements SplittableTabWidget.save_widget to actually save the code editor widget. If the editor.file.path is None or empty or the file does not exist, a save as dialog is shown (save as). :param editor: editor widget to save. ...
python
def save_widget(cls, editor): """ Implements SplittableTabWidget.save_widget to actually save the code editor widget. If the editor.file.path is None or empty or the file does not exist, a save as dialog is shown (save as). :param editor: editor widget to save. ...
[ "def", "save_widget", "(", "cls", ",", "editor", ")", ":", "if", "editor", ".", "original", ":", "editor", "=", "editor", ".", "original", "if", "editor", ".", "file", ".", "path", "is", "None", "or", "not", "os", ".", "path", ".", "exists", "(", "...
Implements SplittableTabWidget.save_widget to actually save the code editor widget. If the editor.file.path is None or empty or the file does not exist, a save as dialog is shown (save as). :param editor: editor widget to save. :return: False if there was a problem saving the e...
[ "Implements", "SplittableTabWidget", ".", "save_widget", "to", "actually", "save", "the", "code", "editor", "widget", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1048-L1090
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableCodeEditTabWidget.register_code_edit
def register_code_edit(cls, code_edit_class): """ Register an additional code edit **class** .. warning: This method expect a class, not an instance! :param code_edit_class: code edit class to register. """ if not inspect.isclass(code_edit_class): raise Type...
python
def register_code_edit(cls, code_edit_class): """ Register an additional code edit **class** .. warning: This method expect a class, not an instance! :param code_edit_class: code edit class to register. """ if not inspect.isclass(code_edit_class): raise Type...
[ "def", "register_code_edit", "(", "cls", ",", "code_edit_class", ")", ":", "if", "not", "inspect", ".", "isclass", "(", "code_edit_class", ")", ":", "raise", "TypeError", "(", "'must be a class, not an instance.'", ")", "for", "mimetype", "in", "code_edit_class", ...
Register an additional code edit **class** .. warning: This method expect a class, not an instance! :param code_edit_class: code edit class to register.
[ "Register", "an", "additional", "code", "edit", "**", "class", "**" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1187-L1202
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableCodeEditTabWidget.save_current_as
def save_current_as(self): """ Save current widget as. """ if not self.current_widget(): return mem = self.current_widget().file.path self.current_widget().file._path = None self.current_widget().file._old_path = mem CodeEditTabWidget.default_d...
python
def save_current_as(self): """ Save current widget as. """ if not self.current_widget(): return mem = self.current_widget().file.path self.current_widget().file._path = None self.current_widget().file._old_path = mem CodeEditTabWidget.default_d...
[ "def", "save_current_as", "(", "self", ")", ":", "if", "not", "self", ".", "current_widget", "(", ")", ":", "return", "mem", "=", "self", ".", "current_widget", "(", ")", ".", "file", ".", "path", "self", ".", "current_widget", "(", ")", ".", "file", ...
Save current widget as.
[ "Save", "current", "widget", "as", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1204-L1235
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableCodeEditTabWidget.save_current
def save_current(self): """ Save current editor. If the editor.file.path is None, a save as dialog will be shown. """ if self.current_widget() is not None: editor = self.current_widget() self._save(editor)
python
def save_current(self): """ Save current editor. If the editor.file.path is None, a save as dialog will be shown. """ if self.current_widget() is not None: editor = self.current_widget() self._save(editor)
[ "def", "save_current", "(", "self", ")", ":", "if", "self", ".", "current_widget", "(", ")", "is", "not", "None", ":", "editor", "=", "self", ".", "current_widget", "(", ")", "self", ".", "_save", "(", "editor", ")" ]
Save current editor. If the editor.file.path is None, a save as dialog will be shown.
[ "Save", "current", "editor", ".", "If", "the", "editor", ".", "file", ".", "path", "is", "None", "a", "save", "as", "dialog", "will", "be", "shown", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1237-L1244
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableCodeEditTabWidget.save_all
def save_all(self): """ Save all editors. """ for w in self.widgets(): try: self._save(w) except OSError: _logger().exception('failed to save %s', w.file.path)
python
def save_all(self): """ Save all editors. """ for w in self.widgets(): try: self._save(w) except OSError: _logger().exception('failed to save %s', w.file.path)
[ "def", "save_all", "(", "self", ")", ":", "for", "w", "in", "self", ".", "widgets", "(", ")", ":", "try", ":", "self", ".", "_save", "(", "w", ")", "except", "OSError", ":", "_logger", "(", ")", ".", "exception", "(", "'failed to save %s'", ",", "w...
Save all editors.
[ "Save", "all", "editors", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1270-L1278
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableCodeEditTabWidget._create_code_edit
def _create_code_edit(self, mimetype, *args, **kwargs): """ Create a code edit instance based on the mimetype of the file to open/create. :type mimetype: mime type :param args: Positional arguments that must be forwarded to the editor widget constructor. :par...
python
def _create_code_edit(self, mimetype, *args, **kwargs): """ Create a code edit instance based on the mimetype of the file to open/create. :type mimetype: mime type :param args: Positional arguments that must be forwarded to the editor widget constructor. :par...
[ "def", "_create_code_edit", "(", "self", ",", "mimetype", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "mimetype", "in", "self", ".", "editors", ".", "keys", "(", ")", ":", "return", "self", ".", "editors", "[", "mimetype", "]", "(", ...
Create a code edit instance based on the mimetype of the file to open/create. :type mimetype: mime type :param args: Positional arguments that must be forwarded to the editor widget constructor. :param kwargs: Keyworded arguments that must be forwarded to the editor ...
[ "Create", "a", "code", "edit", "instance", "based", "on", "the", "mimetype", "of", "the", "file", "to", "open", "/", "create", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1280-L1297
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableCodeEditTabWidget.create_new_document
def create_new_document(self, base_name='New Document', extension='.txt', preferred_eol=0, autodetect_eol=True, **kwargs): """ Creates a new document. The document name will be ``base_name + count + extension`` :param base_name: B...
python
def create_new_document(self, base_name='New Document', extension='.txt', preferred_eol=0, autodetect_eol=True, **kwargs): """ Creates a new document. The document name will be ``base_name + count + extension`` :param base_name: B...
[ "def", "create_new_document", "(", "self", ",", "base_name", "=", "'New Document'", ",", "extension", "=", "'.txt'", ",", "preferred_eol", "=", "0", ",", "autodetect_eol", "=", "True", ",", "*", "*", "kwargs", ")", ":", "SplittableCodeEditTabWidget", ".", "_ne...
Creates a new document. The document name will be ``base_name + count + extension`` :param base_name: Base name of the document. An int will be appended. :param extension: Document extension (dotted) :param args: Positional arguments that must be forwarded to the editor wid...
[ "Creates", "a", "new", "document", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1299-L1329
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableCodeEditTabWidget.open_document
def open_document(self, path, encoding=None, replace_tabs_by_spaces=True, clean_trailing_whitespaces=True, safe_save=True, restore_cursor_position=True, preferred_eol=0, autodetect_eol=True, show_whitespaces=False, **kwargs): """ Opens a ...
python
def open_document(self, path, encoding=None, replace_tabs_by_spaces=True, clean_trailing_whitespaces=True, safe_save=True, restore_cursor_position=True, preferred_eol=0, autodetect_eol=True, show_whitespaces=False, **kwargs): """ Opens a ...
[ "def", "open_document", "(", "self", ",", "path", ",", "encoding", "=", "None", ",", "replace_tabs_by_spaces", "=", "True", ",", "clean_trailing_whitespaces", "=", "True", ",", "safe_save", "=", "True", ",", "restore_cursor_position", "=", "True", ",", "preferre...
Opens a document. :param path: Path of the document to open :param encoding: The encoding to use to open the file. Default is locale.getpreferredencoding(). :param replace_tabs_by_spaces: Enable/Disable replace tabs by spaces. Default is true. :param clean_traili...
[ "Opens", "a", "document", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1338-L1443
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableCodeEditTabWidget.close_document
def close_document(self, path): """ Closes a text document. :param path: Path of the document to close. """ to_close = [] for widget in self.widgets(include_clones=True): p = os.path.normpath(os.path.normcase(widget.file.path)) path = os.path.normp...
python
def close_document(self, path): """ Closes a text document. :param path: Path of the document to close. """ to_close = [] for widget in self.widgets(include_clones=True): p = os.path.normpath(os.path.normcase(widget.file.path)) path = os.path.normp...
[ "def", "close_document", "(", "self", ",", "path", ")", ":", "to_close", "=", "[", "]", "for", "widget", "in", "self", ".", "widgets", "(", "include_clones", "=", "True", ")", ":", "p", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path...
Closes a text document. :param path: Path of the document to close.
[ "Closes", "a", "text", "document", ".", ":", "param", "path", ":", "Path", "of", "the", "document", "to", "close", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1445-L1458
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableCodeEditTabWidget.rename_document
def rename_document(self, old_path, new_path): """ Renames an already opened document (this will not rename the file, just update the file path and tab title). Use that function to update a file that has been renamed externally. :param old_path: old path (path of the widget to ...
python
def rename_document(self, old_path, new_path): """ Renames an already opened document (this will not rename the file, just update the file path and tab title). Use that function to update a file that has been renamed externally. :param old_path: old path (path of the widget to ...
[ "def", "rename_document", "(", "self", ",", "old_path", ",", "new_path", ")", ":", "to_rename", "=", "[", "]", "title", "=", "os", ".", "path", ".", "split", "(", "new_path", ")", "[", "1", "]", "for", "widget", "in", "self", ".", "widgets", "(", "...
Renames an already opened document (this will not rename the file, just update the file path and tab title). Use that function to update a file that has been renamed externally. :param old_path: old path (path of the widget to rename with ``new_path`` :param new_path: new p...
[ "Renames", "an", "already", "opened", "document", "(", "this", "will", "not", "rename", "the", "file", "just", "update", "the", "file", "path", "and", "tab", "title", ")", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1460-L1481
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
SplittableCodeEditTabWidget.closeEvent
def closeEvent(self, event): """ Saves dirty editors on close and cancel the event if the user choosed to continue to work. :param event: close event """ dirty_widgets = [] for w in self.widgets(include_clones=False): if w.dirty: dirty...
python
def closeEvent(self, event): """ Saves dirty editors on close and cancel the event if the user choosed to continue to work. :param event: close event """ dirty_widgets = [] for w in self.widgets(include_clones=False): if w.dirty: dirty...
[ "def", "closeEvent", "(", "self", ",", "event", ")", ":", "dirty_widgets", "=", "[", "]", "for", "w", "in", "self", ".", "widgets", "(", "include_clones", "=", "False", ")", ":", "if", "w", ".", "dirty", ":", "dirty_widgets", ".", "append", "(", "w",...
Saves dirty editors on close and cancel the event if the user choosed to continue to work. :param event: close event
[ "Saves", "dirty", "editors", "on", "close", "and", "cancel", "the", "event", "if", "the", "user", "choosed", "to", "continue", "to", "work", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L1483-L1518
pyQode/pyqode.core
pyqode/core/modes/code_completion.py
CodeCompletionMode._is_shortcut
def _is_shortcut(self, event): """ Checks if the event's key and modifiers make the completion shortcut (Ctrl+Space) :param event: QKeyEvent :return: bool """ modifier = (QtCore.Qt.MetaModifier if sys.platform == 'darwin' else QtCore.Qt.Contr...
python
def _is_shortcut(self, event): """ Checks if the event's key and modifiers make the completion shortcut (Ctrl+Space) :param event: QKeyEvent :return: bool """ modifier = (QtCore.Qt.MetaModifier if sys.platform == 'darwin' else QtCore.Qt.Contr...
[ "def", "_is_shortcut", "(", "self", ",", "event", ")", ":", "modifier", "=", "(", "QtCore", ".", "Qt", ".", "MetaModifier", "if", "sys", ".", "platform", "==", "'darwin'", "else", "QtCore", ".", "Qt", ".", "ControlModifier", ")", "valid_modifier", "=", "...
Checks if the event's key and modifiers make the completion shortcut (Ctrl+Space) :param event: QKeyEvent :return: bool
[ "Checks", "if", "the", "event", "s", "key", "and", "modifiers", "make", "the", "completion", "shortcut", "(", "Ctrl", "+", "Space", ")" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/code_completion.py#L519-L532
pyQode/pyqode.core
pyqode/core/modes/code_completion.py
CodeCompletionMode._hide_popup
def _hide_popup(self): """ Hides the completer popup """ debug('hide popup') if (self._completer.popup() is not None and self._completer.popup().isVisible()): self._completer.popup().hide() self._last_cursor_column = -1 self._la...
python
def _hide_popup(self): """ Hides the completer popup """ debug('hide popup') if (self._completer.popup() is not None and self._completer.popup().isVisible()): self._completer.popup().hide() self._last_cursor_column = -1 self._la...
[ "def", "_hide_popup", "(", "self", ")", ":", "debug", "(", "'hide popup'", ")", "if", "(", "self", ".", "_completer", ".", "popup", "(", ")", "is", "not", "None", "and", "self", ".", "_completer", ".", "popup", "(", ")", ".", "isVisible", "(", ")", ...
Hides the completer popup
[ "Hides", "the", "completer", "popup" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/code_completion.py#L534-L544
pyQode/pyqode.core
pyqode/core/modes/code_completion.py
CodeCompletionMode._show_popup
def _show_popup(self, index=0): """ Shows the popup at the specified index. :param index: index :return: """ full_prefix = self._helper.word_under_cursor( select_whole_word=False).selectedText() if self._case_sensitive: self._completer.setC...
python
def _show_popup(self, index=0): """ Shows the popup at the specified index. :param index: index :return: """ full_prefix = self._helper.word_under_cursor( select_whole_word=False).selectedText() if self._case_sensitive: self._completer.setC...
[ "def", "_show_popup", "(", "self", ",", "index", "=", "0", ")", ":", "full_prefix", "=", "self", ".", "_helper", ".", "word_under_cursor", "(", "select_whole_word", "=", "False", ")", ".", "selectedText", "(", ")", "if", "self", ".", "_case_sensitive", ":"...
Shows the popup at the specified index. :param index: index :return:
[ "Shows", "the", "popup", "at", "the", "specified", "index", ".", ":", "param", "index", ":", "index", ":", "return", ":" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/code_completion.py#L559-L590
pyQode/pyqode.core
pyqode/core/modes/code_completion.py
CodeCompletionMode._update_model
def _update_model(self, completions): """ Creates a QStandardModel that holds the suggestion from the completion models for the QCompleter :param completionPrefix: """ # build the completion model cc_model = QtGui.QStandardItemModel() self._tooltips.clear...
python
def _update_model(self, completions): """ Creates a QStandardModel that holds the suggestion from the completion models for the QCompleter :param completionPrefix: """ # build the completion model cc_model = QtGui.QStandardItemModel() self._tooltips.clear...
[ "def", "_update_model", "(", "self", ",", "completions", ")", ":", "# build the completion model", "cc_model", "=", "QtGui", ".", "QStandardItemModel", "(", ")", "self", ".", "_tooltips", ".", "clear", "(", ")", "for", "completion", "in", "completions", ":", "...
Creates a QStandardModel that holds the suggestion from the completion models for the QCompleter :param completionPrefix:
[ "Creates", "a", "QStandardModel", "that", "holds", "the", "suggestion", "from", "the", "completion", "models", "for", "the", "QCompleter" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/code_completion.py#L602-L632
psphere-project/psphere
psphere/soap.py
create
def create(client, _type, **kwargs): """Create a suds object of the requested _type.""" obj = client.factory.create("ns0:%s" % _type) for key, value in kwargs.items(): setattr(obj, key, value) return obj
python
def create(client, _type, **kwargs): """Create a suds object of the requested _type.""" obj = client.factory.create("ns0:%s" % _type) for key, value in kwargs.items(): setattr(obj, key, value) return obj
[ "def", "create", "(", "client", ",", "_type", ",", "*", "*", "kwargs", ")", ":", "obj", "=", "client", ".", "factory", ".", "create", "(", "\"ns0:%s\"", "%", "_type", ")", "for", "key", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "...
Create a suds object of the requested _type.
[ "Create", "a", "suds", "object", "of", "the", "requested", "_type", "." ]
train
https://github.com/psphere-project/psphere/blob/83a252e037c3d6e4f18bcd37380998bc9535e591/psphere/soap.py#L48-L53
psphere-project/psphere
psphere/soap.py
invoke
def invoke(client, method, **kwargs): """Invoke a method on the underlying soap service.""" try: # Proxy the method to the suds service result = getattr(client.service, method)(**kwargs) except AttributeError: logger.critical("Unknown method: %s", method) raise except URL...
python
def invoke(client, method, **kwargs): """Invoke a method on the underlying soap service.""" try: # Proxy the method to the suds service result = getattr(client.service, method)(**kwargs) except AttributeError: logger.critical("Unknown method: %s", method) raise except URL...
[ "def", "invoke", "(", "client", ",", "method", ",", "*", "*", "kwargs", ")", ":", "try", ":", "# Proxy the method to the suds service", "result", "=", "getattr", "(", "client", ".", "service", ",", "method", ")", "(", "*", "*", "kwargs", ")", "except", "...
Invoke a method on the underlying soap service.
[ "Invoke", "a", "method", "on", "the", "underlying", "soap", "service", "." ]
train
https://github.com/psphere-project/psphere/blob/83a252e037c3d6e4f18bcd37380998bc9535e591/psphere/soap.py#L56-L91
bmwcarit/zubbi
zubbi/utils.py
prettydate
def prettydate(date): now = datetime.now(timezone.utc) """ Return the relative timeframe between the given date and now. e.g. 'Just now', 'x days ago', 'x hours ago', ... When the difference is greater than 7 days, the timestamp will be returned instead. """ diff = now - date # Sho...
python
def prettydate(date): now = datetime.now(timezone.utc) """ Return the relative timeframe between the given date and now. e.g. 'Just now', 'x days ago', 'x hours ago', ... When the difference is greater than 7 days, the timestamp will be returned instead. """ diff = now - date # Sho...
[ "def", "prettydate", "(", "date", ")", ":", "now", "=", "datetime", ".", "now", "(", "timezone", ".", "utc", ")", "diff", "=", "now", "-", "date", "# Show the timestamp rather than the relative timeframe when the difference", "# is greater than 7 days", "if", "diff", ...
Return the relative timeframe between the given date and now. e.g. 'Just now', 'x days ago', 'x hours ago', ... When the difference is greater than 7 days, the timestamp will be returned instead.
[ "Return", "the", "relative", "timeframe", "between", "the", "given", "date", "and", "now", "." ]
train
https://github.com/bmwcarit/zubbi/blob/b99dfd6113c0351f13876f4172648c2eb63468ba/zubbi/utils.py#L44-L59
psphere-project/psphere
examples/vidiscovery.py
Discovery.discovery
def discovery(self, compute_resource): """An example that discovers hosts and VMs in the inventory.""" # Find the first ClusterComputeResource if compute_resource is None: cr_list = ComputeResource.all(self.client) print("ERROR: You must specify a ComputeResource.") ...
python
def discovery(self, compute_resource): """An example that discovers hosts and VMs in the inventory.""" # Find the first ClusterComputeResource if compute_resource is None: cr_list = ComputeResource.all(self.client) print("ERROR: You must specify a ComputeResource.") ...
[ "def", "discovery", "(", "self", ",", "compute_resource", ")", ":", "# Find the first ClusterComputeResource", "if", "compute_resource", "is", "None", ":", "cr_list", "=", "ComputeResource", ".", "all", "(", "self", ".", "client", ")", "print", "(", "\"ERROR: You ...
An example that discovers hosts and VMs in the inventory.
[ "An", "example", "that", "discovers", "hosts", "and", "VMs", "in", "the", "inventory", "." ]
train
https://github.com/psphere-project/psphere/blob/83a252e037c3d6e4f18bcd37380998bc9535e591/examples/vidiscovery.py#L27-L53
bmwcarit/zubbi
zubbi/scraper/connections/github.py
GitHubConnection._get_app_auth_headers
def _get_app_auth_headers(self): """Set the correct auth headers to authenticate against GitHub.""" now = datetime.now(timezone.utc) expiry = now + timedelta(minutes=5) data = {"iat": now, "exp": expiry, "iss": self.app_id} app_token = jwt.encode(data, self.app_key, algorithm="R...
python
def _get_app_auth_headers(self): """Set the correct auth headers to authenticate against GitHub.""" now = datetime.now(timezone.utc) expiry = now + timedelta(minutes=5) data = {"iat": now, "exp": expiry, "iss": self.app_id} app_token = jwt.encode(data, self.app_key, algorithm="R...
[ "def", "_get_app_auth_headers", "(", "self", ")", ":", "now", "=", "datetime", ".", "now", "(", "timezone", ".", "utc", ")", "expiry", "=", "now", "+", "timedelta", "(", "minutes", "=", "5", ")", "data", "=", "{", "\"iat\"", ":", "now", ",", "\"exp\"...
Set the correct auth headers to authenticate against GitHub.
[ "Set", "the", "correct", "auth", "headers", "to", "authenticate", "against", "GitHub", "." ]
train
https://github.com/bmwcarit/zubbi/blob/b99dfd6113c0351f13876f4172648c2eb63468ba/zubbi/scraper/connections/github.py#L66-L79
bmwcarit/zubbi
zubbi/scraper/connections/github.py
GitHubConnection._get_installation_key
def _get_installation_key( self, project, user_id=None, install_id=None, reprime=False ): """Get the auth token for a project or installation id.""" installation_id = install_id if project is not None: installation_id = self.installation_map.get(project, {}).get( ...
python
def _get_installation_key( self, project, user_id=None, install_id=None, reprime=False ): """Get the auth token for a project or installation id.""" installation_id = install_id if project is not None: installation_id = self.installation_map.get(project, {}).get( ...
[ "def", "_get_installation_key", "(", "self", ",", "project", ",", "user_id", "=", "None", ",", "install_id", "=", "None", ",", "reprime", "=", "False", ")", ":", "installation_id", "=", "install_id", "if", "project", "is", "not", "None", ":", "installation_i...
Get the auth token for a project or installation id.
[ "Get", "the", "auth", "token", "for", "a", "project", "or", "installation", "id", "." ]
train
https://github.com/bmwcarit/zubbi/blob/b99dfd6113c0351f13876f4172648c2eb63468ba/zubbi/scraper/connections/github.py#L81-L131
bmwcarit/zubbi
zubbi/scraper/connections/github.py
GitHubConnection._prime_install_map
def _prime_install_map(self): """Fetch all installations and look up the ID for each.""" url = "{}/app/installations".format(self.api_url) headers = self._get_app_auth_headers() LOGGER.debug("Fetching installations for GitHub app") response = requests.get(url, headers=headers) ...
python
def _prime_install_map(self): """Fetch all installations and look up the ID for each.""" url = "{}/app/installations".format(self.api_url) headers = self._get_app_auth_headers() LOGGER.debug("Fetching installations for GitHub app") response = requests.get(url, headers=headers) ...
[ "def", "_prime_install_map", "(", "self", ")", ":", "url", "=", "\"{}/app/installations\"", ".", "format", "(", "self", ".", "api_url", ")", "headers", "=", "self", ".", "_get_app_auth_headers", "(", ")", "LOGGER", ".", "debug", "(", "\"Fetching installations fo...
Fetch all installations and look up the ID for each.
[ "Fetch", "all", "installations", "and", "look", "up", "the", "ID", "for", "each", "." ]
train
https://github.com/bmwcarit/zubbi/blob/b99dfd6113c0351f13876f4172648c2eb63468ba/zubbi/scraper/connections/github.py#L133-L170
bmwcarit/zubbi
zubbi/scraper/connections/github.py
GitHubConnection.create_github_client
def create_github_client(self, project): """Create a github3 client per repo/installation.""" token = self._get_installation_key(project=project) if not token: LOGGER.warning( "Could not find an authentication token for '%s'. Do you " "have access to t...
python
def create_github_client(self, project): """Create a github3 client per repo/installation.""" token = self._get_installation_key(project=project) if not token: LOGGER.warning( "Could not find an authentication token for '%s'. Do you " "have access to t...
[ "def", "create_github_client", "(", "self", ",", "project", ")", ":", "token", "=", "self", ".", "_get_installation_key", "(", "project", "=", "project", ")", "if", "not", "token", ":", "LOGGER", ".", "warning", "(", "\"Could not find an authentication token for '...
Create a github3 client per repo/installation.
[ "Create", "a", "github3", "client", "per", "repo", "/", "installation", "." ]
train
https://github.com/bmwcarit/zubbi/blob/b99dfd6113c0351f13876f4172648c2eb63468ba/zubbi/scraper/connections/github.py#L172-L184
pyQode/pyqode.core
pyqode/core/modes/line_highlighter.py
LineHighlighterMode._clear_deco
def _clear_deco(self): """ Clear line decoration """ if self._decoration: self.editor.decorations.remove(self._decoration) self._decoration = None
python
def _clear_deco(self): """ Clear line decoration """ if self._decoration: self.editor.decorations.remove(self._decoration) self._decoration = None
[ "def", "_clear_deco", "(", "self", ")", ":", "if", "self", ".", "_decoration", ":", "self", ".", "editor", ".", "decorations", ".", "remove", "(", "self", ".", "_decoration", ")", "self", ".", "_decoration", "=", "None" ]
Clear line decoration
[ "Clear", "line", "decoration" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/line_highlighter.py#L68-L72
pyQode/pyqode.core
pyqode/core/modes/line_highlighter.py
LineHighlighterMode.refresh
def refresh(self): """ Updates the current line decoration """ if self.enabled and self.line: self._clear_deco() brush = QtGui.QBrush(self._color) self._decoration = TextDecoration( self.editor.textCursor(), start_line=self.line) ...
python
def refresh(self): """ Updates the current line decoration """ if self.enabled and self.line: self._clear_deco() brush = QtGui.QBrush(self._color) self._decoration = TextDecoration( self.editor.textCursor(), start_line=self.line) ...
[ "def", "refresh", "(", "self", ")", ":", "if", "self", ".", "enabled", "and", "self", ".", "line", ":", "self", ".", "_clear_deco", "(", ")", "brush", "=", "QtGui", ".", "QBrush", "(", "self", ".", "_color", ")", "self", ".", "_decoration", "=", "T...
Updates the current line decoration
[ "Updates", "the", "current", "line", "decoration" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/line_highlighter.py#L74-L86
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget.close_others
def close_others(self): """ Closes every editors tabs except the current one. """ current_widget = self.currentWidget() self._try_close_dirty_tabs(exept=current_widget) i = 0 while self.count() > 1: widget = self.widget(i) if widget != curr...
python
def close_others(self): """ Closes every editors tabs except the current one. """ current_widget = self.currentWidget() self._try_close_dirty_tabs(exept=current_widget) i = 0 while self.count() > 1: widget = self.widget(i) if widget != curr...
[ "def", "close_others", "(", "self", ")", ":", "current_widget", "=", "self", ".", "currentWidget", "(", ")", "self", ".", "_try_close_dirty_tabs", "(", "exept", "=", "current_widget", ")", "i", "=", "0", "while", "self", ".", "count", "(", ")", ">", "1",...
Closes every editors tabs except the current one.
[ "Closes", "every", "editors", "tabs", "except", "the", "current", "one", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L89-L101
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget.save_current
def save_current(self, path=None): """ Save current editor content. Leave file to None to erase the previous file content. If the current editor's file_path is None and path is None, the function will call ``QtWidgets.QFileDialog.getSaveFileName`` to get a valid save filename. ...
python
def save_current(self, path=None): """ Save current editor content. Leave file to None to erase the previous file content. If the current editor's file_path is None and path is None, the function will call ``QtWidgets.QFileDialog.getSaveFileName`` to get a valid save filename. ...
[ "def", "save_current", "(", "self", ",", "path", "=", "None", ")", ":", "try", ":", "if", "not", "path", "and", "not", "self", ".", "_current", ".", "file", ".", "path", ":", "path", ",", "filter", "=", "QtWidgets", ".", "QFileDialog", ".", "getSaveF...
Save current editor content. Leave file to None to erase the previous file content. If the current editor's file_path is None and path is None, the function will call ``QtWidgets.QFileDialog.getSaveFileName`` to get a valid save filename. :param path: path of the file to save, leave it ...
[ "Save", "current", "editor", "content", ".", "Leave", "file", "to", "None", "to", "erase", "the", "previous", "file", "content", ".", "If", "the", "current", "editor", "s", "file_path", "is", "None", "and", "path", "is", "None", "the", "function", "will", ...
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L126-L160
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget.save_all
def save_all(self): """ Save all editors. """ initial_index = self.currentIndex() for i in range(self.count()): try: self.setCurrentIndex(i) self.save_current() except AttributeError: pass self.setCur...
python
def save_all(self): """ Save all editors. """ initial_index = self.currentIndex() for i in range(self.count()): try: self.setCurrentIndex(i) self.save_current() except AttributeError: pass self.setCur...
[ "def", "save_all", "(", "self", ")", ":", "initial_index", "=", "self", ".", "currentIndex", "(", ")", "for", "i", "in", "range", "(", "self", ".", "count", "(", ")", ")", ":", "try", ":", "self", ".", "setCurrentIndex", "(", "i", ")", "self", ".",...
Save all editors.
[ "Save", "all", "editors", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L162-L173
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget.index_from_filename
def index_from_filename(self, path): """ Checks if the path is already open in an editor tab. :param path: path to check :returns: The tab index if found or -1 """ if path: for i in range(self.count()): widget = self.widget(i) ...
python
def index_from_filename(self, path): """ Checks if the path is already open in an editor tab. :param path: path to check :returns: The tab index if found or -1 """ if path: for i in range(self.count()): widget = self.widget(i) ...
[ "def", "index_from_filename", "(", "self", ",", "path", ")", ":", "if", "path", ":", "for", "i", "in", "range", "(", "self", ".", "count", "(", ")", ")", ":", "widget", "=", "self", ".", "widget", "(", "i", ")", "try", ":", "if", "widget", ".", ...
Checks if the path is already open in an editor tab. :param path: path to check :returns: The tab index if found or -1
[ "Checks", "if", "the", "path", "is", "already", "open", "in", "an", "editor", "tab", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L191-L206
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget.add_code_edit
def add_code_edit(self, code_edit, name=None): """ Adds a code edit tab, sets its text as the editor.file.name and sets it as the active tab. The widget is only added if there is no other editor tab open with the same filename, else the already open tab is set as current. ...
python
def add_code_edit(self, code_edit, name=None): """ Adds a code edit tab, sets its text as the editor.file.name and sets it as the active tab. The widget is only added if there is no other editor tab open with the same filename, else the already open tab is set as current. ...
[ "def", "add_code_edit", "(", "self", ",", "code_edit", ",", "name", "=", "None", ")", ":", "# new empty editor widget (no path set)", "if", "code_edit", ".", "file", ".", "path", "==", "''", ":", "cnt", "=", "0", "for", "i", "in", "range", "(", "self", "...
Adds a code edit tab, sets its text as the editor.file.name and sets it as the active tab. The widget is only added if there is no other editor tab open with the same filename, else the already open tab is set as current. If the widget file path is empty, i.e. this is a new document th...
[ "Adds", "a", "code", "edit", "tab", "sets", "its", "text", "as", "the", "editor", ".", "file", ".", "name", "and", "sets", "it", "as", "the", "active", "tab", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L217-L275
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget.addTab
def addTab(self, elem, icon, name): """ Extends QTabWidget.addTab to keep an internal list of added tabs. :param elem: tab widget :param icon: tab icon :param name: tab name """ self._widgets.append(elem) return super(TabWidget, self).addTab(elem, icon, n...
python
def addTab(self, elem, icon, name): """ Extends QTabWidget.addTab to keep an internal list of added tabs. :param elem: tab widget :param icon: tab icon :param name: tab name """ self._widgets.append(elem) return super(TabWidget, self).addTab(elem, icon, n...
[ "def", "addTab", "(", "self", ",", "elem", ",", "icon", ",", "name", ")", ":", "self", ".", "_widgets", ".", "append", "(", "elem", ")", "return", "super", "(", "TabWidget", ",", "self", ")", ".", "addTab", "(", "elem", ",", "icon", ",", "name", ...
Extends QTabWidget.addTab to keep an internal list of added tabs. :param elem: tab widget :param icon: tab icon :param name: tab name
[ "Extends", "QTabWidget", ".", "addTab", "to", "keep", "an", "internal", "list", "of", "added", "tabs", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L277-L286
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget._name_exists
def _name_exists(self, name): """ Checks if we already have an opened tab with the same name. """ for i in range(self.count()): if self.tabText(i) == name: return True return False
python
def _name_exists(self, name): """ Checks if we already have an opened tab with the same name. """ for i in range(self.count()): if self.tabText(i) == name: return True return False
[ "def", "_name_exists", "(", "self", ",", "name", ")", ":", "for", "i", "in", "range", "(", "self", ".", "count", "(", ")", ")", ":", "if", "self", ".", "tabText", "(", "i", ")", "==", "name", ":", "return", "True", "return", "False" ]
Checks if we already have an opened tab with the same name.
[ "Checks", "if", "we", "already", "have", "an", "opened", "tab", "with", "the", "same", "name", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L288-L295
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget._rename_duplicate_tabs
def _rename_duplicate_tabs(self, current, name, path): """ Rename tabs whose title is the same as the name """ for i in range(self.count()): if self.widget(i)._tab_name == name and self.widget(i) != current: file_path = self.widget(i).file.path ...
python
def _rename_duplicate_tabs(self, current, name, path): """ Rename tabs whose title is the same as the name """ for i in range(self.count()): if self.widget(i)._tab_name == name and self.widget(i) != current: file_path = self.widget(i).file.path ...
[ "def", "_rename_duplicate_tabs", "(", "self", ",", "current", ",", "name", ",", "path", ")", ":", "for", "i", "in", "range", "(", "self", ".", "count", "(", ")", ")", ":", "if", "self", ".", "widget", "(", "i", ")", ".", "_tab_name", "==", "name", ...
Rename tabs whose title is the same as the name
[ "Rename", "tabs", "whose", "title", "is", "the", "same", "as", "the", "name" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L310-L329
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget.removeTab
def removeTab(self, index): """ Removes tab at index ``index``. This method will emits tab_closed for the removed tab. :param index: index of the tab to remove. """ widget = self.widget(index) try: self._widgets.remove(widget) except ValueErr...
python
def removeTab(self, index): """ Removes tab at index ``index``. This method will emits tab_closed for the removed tab. :param index: index of the tab to remove. """ widget = self.widget(index) try: self._widgets.remove(widget) except ValueErr...
[ "def", "removeTab", "(", "self", ",", "index", ")", ":", "widget", "=", "self", ".", "widget", "(", "index", ")", "try", ":", "self", ".", "_widgets", ".", "remove", "(", "widget", ")", "except", "ValueError", ":", "pass", "self", ".", "tab_closed", ...
Removes tab at index ``index``. This method will emits tab_closed for the removed tab. :param index: index of the tab to remove.
[ "Removes", "tab", "at", "index", "index", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L349-L366
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget._try_close_dirty_tabs
def _try_close_dirty_tabs(self, exept=None): """ Tries to close dirty tabs. Uses DlgUnsavedFiles to ask the user what he wants to do. """ widgets, filenames = self._collect_dirty_tabs(exept=exept) if not len(filenames): return True dlg = DlgUnsavedFile...
python
def _try_close_dirty_tabs(self, exept=None): """ Tries to close dirty tabs. Uses DlgUnsavedFiles to ask the user what he wants to do. """ widgets, filenames = self._collect_dirty_tabs(exept=exept) if not len(filenames): return True dlg = DlgUnsavedFile...
[ "def", "_try_close_dirty_tabs", "(", "self", ",", "exept", "=", "None", ")", ":", "widgets", ",", "filenames", "=", "self", ".", "_collect_dirty_tabs", "(", "exept", "=", "exept", ")", "if", "not", "len", "(", "filenames", ")", ":", "return", "True", "dl...
Tries to close dirty tabs. Uses DlgUnsavedFiles to ask the user what he wants to do.
[ "Tries", "to", "close", "dirty", "tabs", ".", "Uses", "DlgUnsavedFiles", "to", "ask", "the", "user", "what", "he", "wants", "to", "do", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L389-L410
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget._collect_dirty_tabs
def _collect_dirty_tabs(self, exept=None): """ Collects the list of dirty tabs """ widgets = [] filenames = [] for i in range(self.count()): widget = self.widget(i) try: if widget.dirty and widget != exept: widge...
python
def _collect_dirty_tabs(self, exept=None): """ Collects the list of dirty tabs """ widgets = [] filenames = [] for i in range(self.count()): widget = self.widget(i) try: if widget.dirty and widget != exept: widge...
[ "def", "_collect_dirty_tabs", "(", "self", ",", "exept", "=", "None", ")", ":", "widgets", "=", "[", "]", "filenames", "=", "[", "]", "for", "i", "in", "range", "(", "self", ".", "count", "(", ")", ")", ":", "widget", "=", "self", ".", "widget", ...
Collects the list of dirty tabs
[ "Collects", "the", "list", "of", "dirty", "tabs" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L412-L426
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
TabWidget._on_dirty_changed
def _on_dirty_changed(self, dirty): """ Adds a star in front of a dirtt tab and emits dirty_changed. """ try: title = self._current._tab_name index = self.indexOf(self._current) if dirty: self.setTabText(index, "* " + title) ...
python
def _on_dirty_changed(self, dirty): """ Adds a star in front of a dirtt tab and emits dirty_changed. """ try: title = self._current._tab_name index = self.indexOf(self._current) if dirty: self.setTabText(index, "* " + title) ...
[ "def", "_on_dirty_changed", "(", "self", ",", "dirty", ")", ":", "try", ":", "title", "=", "self", ".", "_current", ".", "_tab_name", "index", "=", "self", ".", "indexOf", "(", "self", ".", "_current", ")", "if", "dirty", ":", "self", ".", "setTabText"...
Adds a star in front of a dirtt tab and emits dirty_changed.
[ "Adds", "a", "star", "in", "front", "of", "a", "dirtt", "tab", "and", "emits", "dirty_changed", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L428-L441
pyQode/pyqode.core
pyqode/core/dialogs/encodings.py
DlgPreferredEncodingsEditor.get_preferred_encodings
def get_preferred_encodings(self): """ Gets the list of preferred encodings. :return: list """ encodings = [] for row in range(self.ui.tableWidgetPreferred.rowCount()): item = self.ui.tableWidgetPreferred.item(row, 0) encodings.append(item.data(QtC...
python
def get_preferred_encodings(self): """ Gets the list of preferred encodings. :return: list """ encodings = [] for row in range(self.ui.tableWidgetPreferred.rowCount()): item = self.ui.tableWidgetPreferred.item(row, 0) encodings.append(item.data(QtC...
[ "def", "get_preferred_encodings", "(", "self", ")", ":", "encodings", "=", "[", "]", "for", "row", "in", "range", "(", "self", ".", "ui", ".", "tableWidgetPreferred", ".", "rowCount", "(", ")", ")", ":", "item", "=", "self", ".", "ui", ".", "tableWidge...
Gets the list of preferred encodings. :return: list
[ "Gets", "the", "list", "of", "preferred", "encodings", ".", ":", "return", ":", "list" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/dialogs/encodings.py#L111-L120
pyQode/pyqode.core
pyqode/core/dialogs/encodings.py
DlgPreferredEncodingsEditor.edit_encoding
def edit_encoding(cls, parent): """ Static helper method that shows the encoding editor dialog If the dialog was accepted the new encodings are added to the settings. :param parent: parent widget :return: True in case of succes, False otherwise """ dlg = cls(par...
python
def edit_encoding(cls, parent): """ Static helper method that shows the encoding editor dialog If the dialog was accepted the new encodings are added to the settings. :param parent: parent widget :return: True in case of succes, False otherwise """ dlg = cls(par...
[ "def", "edit_encoding", "(", "cls", ",", "parent", ")", ":", "dlg", "=", "cls", "(", "parent", ")", "if", "dlg", ".", "exec_", "(", ")", "==", "dlg", ".", "Accepted", ":", "settings", "=", "Cache", "(", ")", "settings", ".", "preferred_encodings", "=...
Static helper method that shows the encoding editor dialog If the dialog was accepted the new encodings are added to the settings. :param parent: parent widget :return: True in case of succes, False otherwise
[ "Static", "helper", "method", "that", "shows", "the", "encoding", "editor", "dialog", "If", "the", "dialog", "was", "accepted", "the", "new", "encodings", "are", "added", "to", "the", "settings", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/dialogs/encodings.py#L123-L137
pyQode/pyqode.core
pyqode/core/dialogs/encodings.py
DlgEncodingsChoice.choose_encoding
def choose_encoding(cls, parent, path, encoding): """ Show the encodings dialog and returns the user choice. :param parent: parent widget. :param path: file path :param encoding: current file encoding :return: selected encoding """ dlg = cls(parent, path,...
python
def choose_encoding(cls, parent, path, encoding): """ Show the encodings dialog and returns the user choice. :param parent: parent widget. :param path: file path :param encoding: current file encoding :return: selected encoding """ dlg = cls(parent, path,...
[ "def", "choose_encoding", "(", "cls", ",", "parent", ",", "path", ",", "encoding", ")", ":", "dlg", "=", "cls", "(", "parent", ",", "path", ",", "encoding", ")", "dlg", ".", "exec_", "(", ")", "return", "dlg", ".", "ui", ".", "comboBoxEncodings", "."...
Show the encodings dialog and returns the user choice. :param parent: parent widget. :param path: file path :param encoding: current file encoding :return: selected encoding
[ "Show", "the", "encodings", "dialog", "and", "returns", "the", "user", "choice", "." ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/dialogs/encodings.py#L162-L173
pyQode/pyqode.core
pyqode/core/widgets/pty_wrapper.py
pty_wrapper_main
def pty_wrapper_main(): """ Main function of the pty wrapper script """ # make sure we can import _pty even if pyqode is not installed (this is the case in HackEdit where pyqode has # been vendored). sys.path.insert(0, os.path.dirname(__file__)) import _pty # fixme: find a way to use a ...
python
def pty_wrapper_main(): """ Main function of the pty wrapper script """ # make sure we can import _pty even if pyqode is not installed (this is the case in HackEdit where pyqode has # been vendored). sys.path.insert(0, os.path.dirname(__file__)) import _pty # fixme: find a way to use a ...
[ "def", "pty_wrapper_main", "(", ")", ":", "# make sure we can import _pty even if pyqode is not installed (this is the case in HackEdit where pyqode has", "# been vendored).", "sys", ".", "path", ".", "insert", "(", "0", ",", "os", ".", "path", ".", "dirname", "(", "__file_...
Main function of the pty wrapper script
[ "Main", "function", "of", "the", "pty", "wrapper", "script" ]
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/pty_wrapper.py#L5-L15
pyQode/pyqode.core
pyqode/core/modes/caret_line_highlight.py
CaretLineHighlighterMode.background
def background(self): """ Background color of the caret line. Default is to use a color slightly darker/lighter than the background color. You can override the automatic color by setting up this property """ if self._color or not self.editor: return self._colo...
python
def background(self): """ Background color of the caret line. Default is to use a color slightly darker/lighter than the background color. You can override the automatic color by setting up this property """ if self._color or not self.editor: return self._colo...
[ "def", "background", "(", "self", ")", ":", "if", "self", ".", "_color", "or", "not", "self", ".", "editor", ":", "return", "self", ".", "_color", "else", ":", "return", "drift_color", "(", "self", ".", "editor", ".", "background", ",", "110", ")" ]
Background color of the caret line. Default is to use a color slightly darker/lighter than the background color. You can override the automatic color by setting up this property
[ "Background", "color", "of", "the", "caret", "line", ".", "Default", "is", "to", "use", "a", "color", "slightly", "darker", "/", "lighter", "than", "the", "background", "color", ".", "You", "can", "override", "the", "automatic", "color", "by", "setting", "...
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/caret_line_highlight.py#L14-L23