def lookup(self, path): if path.startswith('/'): return None for doc in cedit.app_get_default().get_documents(): if doc.is_local(): location = doc.get_location() if location and location.get_uri().endswith(path): return location return None
def create_configure_dialog(self): if not self.dlg: self.dlg = Manager(self.get_data_dir()) else: self.dlg.run() window = cedit.app_get_default().get_active_window() if window: self.dlg.dlg.set_transient_for(window) return self.dlg.dlg
def open_dialog(self): if not self._manager: self._manager = Manager(self.get_data_dir()) if self._manager_default_size: self._manager.dialog.set_default_size(*self._manager_default_size) self._manager.dialog.connect('destroy', self.on_manager_destroy) window = cedit.app_get_default().get_active_window() self._manager.run(window) return self._manager.dialog
def lookup(self, path): if path.startswith('/'): return None for doc in cedit.app_get_default().get_documents(): if doc.is_local(): location = doc.get_location() if location: rel_path = location.get_parent().get_path() joined_path = os.path.join(rel_path, path) if os.path.isfile(joined_path): return gio.File(joined_path) return None
def build_model(self, force_reload = False): window = cedit.app_get_default().get_active_window() if window: view = window.get_active_view() if not view: current_lang = None else: current_lang = view.get_buffer().get_language() source_view = self['source_view_snippet'] else: current_lang = None tree_view = self['tree_view_snippets'] expand = None if not self.model or force_reload: self.model = gtk.TreeStore(str, str, object) self.model.set_sort_column_id(self.SORT_COLUMN, gtk.SORT_ASCENDING) manager = get_language_manager() langs = cedit.language_manager_list_languages_sorted(manager, True) piter = self.model.append(None, (_('Global'), '', None)) # Add dummy node self.model.append(piter, ('', '', None)) nm = None if current_lang: nm = current_lang.get_name() for lang in langs: name = lang.get_name() parent = self.model.append(None, (name, name, lang)) # Add dummy node self.model.append(parent, ('', '', None)) if (nm == name): expand = parent else: if current_lang: piter = self.model.get_iter_first() nm = current_lang.get_name() while piter: lang = self.model.get_value(piter, \ self.SORT_COLUMN) if lang == nm: expand = piter break; piter = self.model.iter_next(piter) tree_view.set_model(self.model) if not expand: expand = self.model.get_iter_root() tree_view.expand_row(self.model.get_path(expand), False) self.select_iter(expand)
def on_tool_manager_dialog_focus_out(self, dialog, event): self.save_current_tool() for window in cedit.app_get_default().get_windows(): helper = window.get_data("ExternalToolsPluginWindowData") helper.menu.update()