def _init_gitmenu(self): """ Will build the git-menu in the gedit-menu. """ plugin_path = os.path.dirname(__file__) self._actions = Gtk.ActionGroup("AddiksGitMenuActions") for actionName, title, shortcut, callbackName in ACTIONS: action = Gio.SimpleAction(name=actionName) callback = None if callbackName != None: callback = getattr(self, callbackName) action.connect('activate', callback) self.window.add_action(action) self.window.lookup_action(actionName).set_enabled(True) self._actions.add_actions([(actionName, Gtk.STOCK_INFO, title, shortcut, "", callback),]) if "get_ui_manager" in dir(self.window):# build menu for gedit 3.10 (global menu per window) manager = self.window.get_ui_manager() self._gitAction = self._actions.get_action("GitAction") manager.insert_action_group(self._actions) self._ui_merge_id = manager.add_ui_from_string(file_get_contents(plugin_path + "/menubar.xml")) manager.ensure_update()
def _init_gitmenu(self): """ Will build the git-menu in the gedit-menu. """ plugin_path = os.path.dirname(__file__) self._actions = Gtk.ActionGroup("AddiksGitMenuActions") for actionName, title, shortcut, callbackName in ACTIONS: action = Gio.SimpleAction(name=actionName) callback = None if callbackName != None: callback = getattr(self, callbackName) action.connect('activate', callback) self.window.add_action(action) self.window.lookup_action(actionName).set_enabled(True) self._actions.add_actions([ (actionName, Gtk.STOCK_INFO, title, shortcut, "", callback), ]) if "get_ui_manager" in dir( self.window ): # build menu for gedit 3.10 (global menu per window) manager = self.window.get_ui_manager() self._gitAction = self._actions.get_action("GitAction") manager.insert_action_group(self._actions) self._ui_merge_id = manager.add_ui_from_string( file_get_contents(plugin_path + "/menubar.xml")) manager.ensure_update()
def get_all_breakpoints(self): if self._breakpoints is None: self._breakpoints = {} filePath = self._get_breakpoints_filepath() if os.path.exists(filePath): self._breakpoints = eval(file_get_contents(filePath)) return self._breakpoints
def get_profile(self, name=None): if name is None: name = self.get_active_profile() path = self.__get_profiles_path() filePath = path + "/" + name profileData = file_get_contents(filePath) profile = eval(profileData) return profile
def _get_diff_viewer(self): diff_viewer = 'meld %s %s' plugin_path = os.path.dirname(__file__) diffrc_path = plugin_path + "/diffrc" if os.path.exists(diffrc_path): diff_viewer = file_get_contents(diffrc_path) return diff_viewer
def get_active_profile(self): file_path = self.__get_active_profile_filepath() if not os.path.exists(file_path): file_put_contents(file_path, "default") return file_get_contents(file_path)