def loadSettings(self, filename=None, actions=None): self._names = [] self._hotkeys = [] if filename is None: filename = os.path.join(ACTIONDIR, 'action_shortcuts') self._listbox.clear() cparser = PuddleConfig(filename) if actions is None: self._actions = load_actions() else: self._actions = actions from puddlestuff.puddletag import status if status['actions']: shortcuts = dict( (unicode(a.text()), unicode(a.shortcut().toString())) for a in status['actions']) else: shortcuts = {} for section in sorted(cparser.sections()): if section.startswith('Shortcut'): name = cparser.get(section, NAME, 'Default') self._names.append(name) filenames = cparser.get(section, FILENAMES, []) shortcut = shortcuts.get(name, u'') self.addShortcut(name, filenames, shortcut, select=False) self._hotkeys.append(shortcut)
def loadSettings(self, filename=None, actions=None): self._names = [] self._hotkeys = [] if filename is None: filename = os.path.join(ACTIONDIR, 'action_shortcuts') self._listbox.clear() cparser = PuddleConfig(filename) if actions is None: self._actions = load_actions() else: self._actions = actions from puddlestuff.puddletag import status if status['actions']: shortcuts = dict((unicode(a.text()), unicode(a.shortcut().toString())) for a in status['actions']) else: shortcuts = {} for section in sorted(cparser.sections()): if section.startswith('Shortcut'): name = cparser.get(section, NAME, 'Default') self._names.append(name) filenames = cparser.get(section, FILENAMES, []) shortcut = shortcuts.get(name, u'') self.addShortcut(name, filenames, shortcut, select=False) self._hotkeys.append(shortcut)
def load_settings(filename=None, actions=None): if filename is None: filename = FILENAME if not os.path.exists(os.path.dirname(filename)): os.makedirs(os.path.dirname(filename)) cparser = PuddleConfig(filename) actions = load_actions() if actions is None else actions shortcuts = [] for section in sorted(cparser.sections()): if section.startswith(SHORTCUT_SECTION): name = cparser.get(section, NAME, 'Default') filenames = cparser.get(section, FILENAMES, []) shortcuts.append([name, filenames]) return actions, shortcuts
def load_settings(filename=None, actions=None): if filename is None: filename = FILENAME if not os.path.exists(os.path.dirname(filename)): os.makedirs(os.path.dirname(filename)) cparser = PuddleConfig(filename) actions = load_actions() if actions is None else actions shortcuts = [] for section in sorted(cparser.sections()): if section.startswith(SHORTCUT_SECTION): name = cparser.get(section, NAME, 'Default') filenames = cparser.get(section, FILENAMES, []) shortcuts.append([name, filenames]) return actions, shortcuts
from puddlestuff.puddletag import status if status['actions']: shortcuts = dict( (unicode(a.text()), unicode(a.shortcut().toString())) for a in status['actions']) else: shortcuts = {} for section in sorted(cparser.sections()): if section.startswith('Shortcut'): name = cparser.get(section, NAME, 'Default') self._names.append(name) filenames = cparser.get(section, FILENAMES, []) shortcut = shortcuts.get(name, u'') self.addShortcut(name, filenames, shortcut, select=False) self._hotkeys.append(shortcut) def names(self): return [item.actionName for item in self._listbox.items()] if __name__ == '__main__': import sys app = QApplication([]) actions = load_actions() win = ShortcutEditor(buttons=True) win.loadSettings() win.show() app.exec_()
else: self._actions = actions from puddlestuff.puddletag import status if status['actions']: shortcuts = dict((unicode(a.text()), unicode(a.shortcut().toString())) for a in status['actions']) else: shortcuts = {} for section in sorted(cparser.sections()): if section.startswith('Shortcut'): name = cparser.get(section, NAME, 'Default') self._names.append(name) filenames = cparser.get(section, FILENAMES, []) shortcut = shortcuts.get(name, u'') self.addShortcut(name, filenames, shortcut, select=False) self._hotkeys.append(shortcut) def names(self): return [item.actionName for item in self._listbox.items()] if __name__ == '__main__': import sys app = QApplication([]) actions = load_actions() win = ShortcutEditor(buttons=True) win.loadSettings() win.show() app.exec_()