コード例 #1
0
ファイル: webdb.py プロジェクト: RaphaelRochet/puddletag
 def saveSettings(self):
     settings = PuddleConfig()
     settings.filename = os.path.join(CONFIGDIR, 'tagsources.conf')
     settings.set('tagsources', 'lastsource', self.sourcelist.currentText())
     for i, ts in enumerate(self.__sources):
         settings.set('tagsourcetags', ts.name, self.__sourceFields[i])
     settings.set('tagsources', 'lastsort', self.listbox.lastSortIndex)
     settings.set('tagsources', 'existing', self.__updateEmpty.isChecked())
     settings.set('tagsources', 'autoretrieve',
         self.__autoRetrieve.isChecked())
コード例 #2
0
def get_menus(section, filepath=None):
    cparser = PuddleConfig()
    if not filepath:
        filepath = menu_path
    cparser.filename = filepath
    menus = []
    settings = cparser.data
    temp = settings[section]
    menus = [(z, temp[z]) for z in settings[section + 'attrs']['order']]
    return menus
コード例 #3
0
ファイル: webdb.py プロジェクト: korala1968/tago
 def saveSettings(self):
     settings = PuddleConfig()
     settings.filename = os.path.join(CONFIGDIR, 'tagsources.conf')
     settings.set('tagsources', 'lastsource', self.sourcelist.currentText())
     for i, ts in enumerate(self.__sources):
         settings.set('tagsourcetags', ts.name, self.__sourceFields[i])
     settings.set('tagsources', 'lastsort', self.listbox.lastSortIndex)
     settings.set('tagsources', 'existing', self.__updateEmpty.isChecked())
     settings.set('tagsources', 'autoretrieve',
                  self.__autoRetrieve.isChecked())
コード例 #4
0
ファイル: loadshortcuts.py プロジェクト: korala1968/tago
def get_menus(section, filepath=None):
    cparser = PuddleConfig()
    if not filepath:
        filepath = menu_path
    cparser.filename = filepath
    menus = []
    settings = cparser.data
    temp = settings[section]
    menus = [(z, temp[z]) for z in settings[section + 'attrs']['order']]
    return menus
コード例 #5
0
def get_actions(parent, filepath=None):
    cparser = PuddleConfig()
    if not filepath:
        filepath = shortcut_path
    cparser.filename = filepath
    setting = cparser.data
    actions = []
    for section in cparser.sections():
        if section.startswith('shortcut'):
            values = dict([(str(k), v) for k,v in  setting[section].items()])
            actions.append(create_action(parent, **values))
    return actions
コード例 #6
0
ファイル: loadshortcuts.py プロジェクト: korala1968/tago
def get_actions(parent, filepath=None):
    cparser = PuddleConfig()
    if not filepath:
        filepath = shortcut_path
    cparser.filename = filepath
    setting = cparser.data
    actions = []
    for section in cparser.sections():
        if section.startswith('shortcut'):
            values = dict([(str(k), v) for k, v in setting[section].items()])
            actions.append(create_action(parent, **values))
    return actions
コード例 #7
0
def context_menu(section, actions, filepath=None):
    cparser = PuddleConfig(filepath)
    if not filepath:
        filepath = menu_path
        cparser.filename = filepath
    order = [translate('Menus', z) for z in cparser.get(section, 'order', [])]
    if not order:
        return
    texts = [unicode(action.text()) for action in actions]
    menu = QMenu()
    for action in order:
        if action in texts:
            menu.addAction(actions[texts.index(action)])
        elif action == SEPARATOR:
            menu.addSeparator()
    return menu
コード例 #8
0
ファイル: loadshortcuts.py プロジェクト: korala1968/tago
def context_menu(section, actions, filepath=None):
    cparser = PuddleConfig(filepath)
    if not filepath:
        filepath = menu_path
        cparser.filename = filepath
    order = [translate('Menus', z) for z in cparser.get(section, 'order', [])]
    if not order:
        return
    texts = [unicode(action.text()) for action in actions]
    menu = QMenu()
    for action in order:
        if action in texts:
            menu.addAction(actions[texts.index(action)])
        elif action == SEPARATOR:
            menu.addSeparator()
    return menu