def activate_tab(self, file): """ Activate the GeditTab containing the given File or open a new tab for it (this is called by the WindowContext) @param file: a File object """ for tab, tab_decorator in self._tab_decorators.items(): if tab_decorator.file and tab_decorator.file == file: self.window.set_active_tab(tab) return # not found, open file in a new tab... uri = file.uri gfile = Gio.file_new_for_uri(uri) if Gedit.utils_is_valid_location(gfile): LOG.debug("GeditWindow.create_tab_from_uri(%s)" % uri) try: view = self.window.get_active_view() encoding = view.get_buffer().get_encoding() except AttributeError: # No document open encoding = None self.window.create_tab_from_location(gfile, encoding, 1, 1, False, True) else: LOG.error("Gedit.utils.uri_is_valid(%s) = False" % uri)
def activate_tab(self, file): """ Activate the GeditTab containing the given File or open a new tab for it (this is called by the WindowContext) @param file: a File object """ for tab, tab_decorator in self._tab_decorators.items(): if tab_decorator.file and tab_decorator.file == file: self.window.set_active_tab(tab) return # not found, open file in a new tab... uri = file.uri gfile = Gio.file_new_for_uri(uri) if Gedit.utils_is_valid_location(gfile): LOG.debug("GeditWindow.create_tab_from_uri(%s)" % uri) try: view = self.window.get_active_view() encoding = view.get_buffer().get_encoding() except AttributeError: # No document open encoding = None self.window.create_tab_from_location( gfile, encoding, 1, 1, False, True) else: LOG.error("Gedit.utils.uri_is_valid(%s) = False" % uri)
def _direct_file(self): uri = self._entry.get_text() gfile = Gio.file_new_for_uri(uri) if Gedit.utils_is_valid_location(gfile) or (os.path.isabs(uri) and gfile.query_exists()): return gfile else: return None
def _direct_file(self): uri = self._entry.get_text() gfile = Gio.file_new_for_uri(uri) if Gedit.utils_is_valid_location(gfile) or \ (os.path.isabs(uri) and gfile.query_exists()): return gfile else: return None
def activate_tab(self, file): """ Activate the GeditTab containing the given File or open a new tab for it (this is called by the WindowContext) @param file: a File object """ for tab, tab_decorator in self._tab_decorators.iteritems(): if tab_decorator.file and tab_decorator.file == file: self.window.set_active_tab(tab) return # not found, open file in a new tab... uri = file.uri gfile = Gio.file_new_for_uri(uri) if Gedit.utils_is_valid_location(gfile): LOG.debug("GeditWindow.create_tab_from_uri(%s)" % uri) self.window.create_tab_from_location(gfile, Gedit.encoding_get_current(), 1, 1, False, True) else: LOG.error("Gedit.utils.uri_is_valid(%s) = False" % uri)
def activate_tab(self, file): """ Activate the GeditTab containing the given File or open a new tab for it (this is called by the WindowContext) @param file: a File object """ for tab, tab_decorator in self._tab_decorators.iteritems(): if tab_decorator.file and tab_decorator.file == file: self.window.set_active_tab(tab) return # not found, open file in a new tab... uri = file.uri gfile = Gio.file_new_for_uri(uri) if Gedit.utils_is_valid_location(gfile): LOG.debug("GeditWindow.create_tab_from_uri(%s)" % uri) self.window.create_tab_from_location( gfile, Gedit.encoding_get_current(), 1, 1, False, True) else: LOG.error("Gedit.utils.uri_is_valid(%s) = False" % uri)