def removeShortcut(self, name): """ Deletes the given action if existing. """ resolvedName = self.resolveName(name) action = self._collection.action(resolvedName) if action: action.deleteLater() KGlobal.config().group(self._manager.configGroup).deleteEntry(resolvedName)
def tabWidth(self): """Returns the width of the tab character in this document.""" v = self.kateVariable("tab-width") if v and v.isdigit(): return int(v) group = KGlobal.config().group("Kate Document Defaults") return group.readEntry("Tab Width", 8)
def __init__(self, servicePrefix): # We manage our own documents. self.documents = [] self.history = [] # latest shown documents # KApplication needs to be instantiated before any D-Bus stuff self.kapp = KApplication() # Here we can setup config() stuff before MainWindow and its tools # are created. config = KGlobal.config().group("") # root group self.setupConfiguration(config) config.sync() # DBus init serviceName = "{0}{1}".format(servicePrefix, os.getpid()) DBusItem.__init__(self, serviceName, '/MainApp') # We support only one MainWindow. self.mainwin = self.createMainWindow() self.kapp.setTopWidget(self.mainwin) # Get our beloved editor :-) self.editor = KTextEditor.EditorChooser.editor() self.editor.readConfig() # restore session etc. self._sessionStartedFromCommandLine = False
def indentationWidth(self): """Returns the indent-width for the current document.""" v = self.kateVariable("indent-width") if v and v.isdigit(): return int(v) group = KGlobal.config().group("Kate Document Defaults") return group.readEntry("Indentation Width", 2)
def saveOnRunWarning(): """ Copy old setting to the new save on run notification setting (1.1.2)""" c = KGlobal.config() group = c.group("preferences") if group.readEntry("save on run", False): group = c.group("Notification Messages") group.writeEntry("save_on_run", False) c.sync()
def run(self, sender=None): """ Last minute setup and enter the KDE event loop. At the very last, instantiates one empty doc if nothing loaded yet. """ if self.kapp.isSessionRestored(): self.mainwin.restore(1, False) elif (len(self.documents) == 0 and not self._sessionStartedFromCommandLine): # restore named session? action = config("preferences").readEntry("default session", "") if action == "lastused": self.mainwin.sessionManager().restoreLastSession() elif action == "custom": session = config("preferences").readEntry("custom session", "") if session in self.mainwin.sessionManager().names(): self.mainwin.sessionManager().switch(session) if len(self.documents) == 0: self.createDocument().setActive() sys.excepthook = self.handleException self.mainwin.show() self.kapp.exec_() KGlobal.config().sync()
def newLilyPondConfig(): """ Take old lilypond path preference over to new multi-version config (1.1.0) """ c = KGlobal.config() group = c.group("lilypond") if not group.hasKey("default"): cmds = c.group("commands") lily = cmds.readEntry("lilypond", "lilypond") conv = cmds.readEntry("convert-ly", "convert-ly") if (os.path.isabs(lily) and os.path.isabs(conv) and os.path.dirname(lily) == os.path.dirname(conv)): conv = os.path.basename(conv) group.writeEntry("default", lily) group.writeEntry("paths", [lily]) group = group.group(lily) group.writeEntry("convert-ly", conv) c.sync()
def config(group="installertools"): return KGlobal.config().group(group)
def config(group): return KGlobal.config().group(group)
def config(group="blankpaper"): return KGlobal.config().group(group)
def config(group="rumor"): return KGlobal.config().group(group)
def config(group="hyphenation"): return KGlobal.config().group(group)
def config(): return KGlobal.config().group("charselect")
def config(group=None): c = KGlobal.config().group("scorewiz") if group: c = c.group(group) return c
def config(): return KGlobal.config().group("expand manager")
def config(group="kateshell"): return KGlobal.config().group(group)