Beispiel #1
0
    def __init__(self, prefs, fm, pref_name, parent=None):
        QAbstractListModel.__init__(self, parent)

        self.fm = fm
        self.pref_name = pref_name
        if pref_name == 'column_color_rules':
            self.rule_kind = 'color'
            rules = list(prefs[pref_name])
            self.rules = []
            for col, template in rules:
                if col not in self.fm and col != color_row_key: continue
                try:
                    rule = rule_from_template(self.fm, template)
                except:
                    rule = template
                self.rules.append(('color', col, rule))
        else:
            self.rule_kind = 'icon'
            rules = list(prefs[pref_name])
            self.rules = []
            for kind, col, template in rules:
                if col not in self.fm and col != color_row_key: continue
                try:
                    rule = rule_from_template(self.fm, template)
                except:
                    rule = template
                self.rules.append((kind, col, rule))
Beispiel #2
0
    def __init__(self, prefs, fm, pref_name, parent=None):
        QAbstractListModel.__init__(self, parent)

        self.fm = fm
        self.pref_name = pref_name
        if pref_name == 'column_color_rules':
            self.rule_kind = 'color'
            rules = list(prefs[pref_name])
            self.rules = []
            for col, template in rules:
                if col not in self.fm and col != color_row_key: continue
                try:
                    rule = rule_from_template(self.fm, template)
                except:
                    rule = template
                self.rules.append(('color', col, rule))
        else:
            self.rule_kind = 'icon'
            rules = list(prefs[pref_name])
            self.rules = []
            for kind, col, template in rules:
                if col not in self.fm and col != color_row_key: continue
                try:
                    rule = rule_from_template(self.fm, template)
                except:
                    rule = template
                self.rules.append((kind, col, rule))
Beispiel #3
0
    def __init__(self, current_cover, parent=None):
        QAbstractListModel.__init__(self, parent)

        if current_cover is None:
            current_cover = QPixmap(I('default_cover.png'))

        self.blank = QPixmap(I('blank.png')).scaled(150, 200)
        self.cc = current_cover
        self.reset_covers(do_reset=False)
Beispiel #4
0
    def __init__(self, current_cover, parent=None):
        QAbstractListModel.__init__(self, parent)

        if current_cover is None:
            current_cover = QPixmap(I('default_cover.png'))

        self.blank = QPixmap(I('blank.png')).scaled(150, 200)
        self.cc = current_cover
        self.reset_covers(do_reset=False)
Beispiel #5
0
    def __init__(self, prefs, fm, parent=None):
        QAbstractListModel.__init__(self, parent)

        self.fm = fm
        rules = list(prefs['column_color_rules'])
        self.rules = []
        for col, template in rules:
            try:
                rule = rule_from_template(self.fm, template)
            except:
                rule = template
            self.rules.append((col, rule))
Beispiel #6
0
    def __init__(self, prefs, fm, parent=None):
        QAbstractListModel.__init__(self, parent)

        self.fm = fm
        rules = list(prefs['column_color_rules'])
        self.rules = []
        for col, template in rules:
            try:
                rule = rule_from_template(self.fm, template)
            except:
                rule = template
            self.rules.append((col, rule))
Beispiel #7
0
 def __init__(self, *args):
     QAbstractListModel.__init__(self, *args)
     from calibre.utils.fonts import fontconfig
     try:
         self.families = fontconfig.find_font_families()
     except:
         self.families = []
         print 'WARNING: Could not load fonts'
         traceback.print_exc()
     # Restrict to Qt families as Qt tends to crash
     qt_families = set([unicode(x) for x in QFontDatabase().families()])
     self.families = list(qt_families.intersection(set(self.families)))
     self.families.sort()
     self.families[:0] = [_('None')]
     self.font = QFont('Verdana' if iswindows else 'sansserif')
Beispiel #8
0
 def __init__(self, *args):
     QAbstractListModel.__init__(self, *args)
     from calibre.utils.fonts import fontconfig
     try:
         self.families = fontconfig.find_font_families()
     except:
         self.families = []
         print 'WARNING: Could not load fonts'
         traceback.print_exc()
     # Restrict to Qt families as Qt tends to crash
     qt_families = set([unicode(x) for x in QFontDatabase().families()])
     self.families = list(qt_families.intersection(set(self.families)))
     self.families.sort()
     self.families[:0] = [_('None')]
     self.font = QFont('Arial' if iswindows else 'sansserif')
Beispiel #9
0
    def __init__(self, shortcuts, config_file_base_name, parent=None):
        QAbstractListModel.__init__(self, parent)

        self.descriptions = {}
        for k, v in shortcuts.items():
            self.descriptions[k] = v[-1]
        self.keys = {}
        for k, v in shortcuts.items():
            self.keys[k] = v[0]
        self.order = list(shortcuts)
        self.order.sort(key=lambda x: sort_key(self.descriptions[x]))
        self.sequences = {}
        for k, v in self.keys.items():
            self.sequences[k] = [QKeySequence(x) for x in v]

        self.custom = XMLConfig(config_file_base_name)
Beispiel #10
0
 def __init__(self, fmt_count):
     QAbstractListModel.__init__(self)
     self.fmts = sorted(set(fmt_count))
     self.counts = fmt_count
     self.fi = file_icon_provider()
Beispiel #11
0
 def __init__(self, parent):
     QAbstractListModel.__init__(self, parent)
     self.searches = tprefs['saved_searches']
     self.filtered_searches = list(xrange(len(self.searches)))
Beispiel #12
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.all_items = self.current_items = ()
     self.current_prefix = ''
Beispiel #13
0
 def __init__(self, manufacturer):
     QAbstractListModel.__init__(self)
     self.devices = get_devices_of(manufacturer)
Beispiel #14
0
 def __init__(self, parent):
     QAbstractListModel.__init__(self, parent)
     self.searches = tprefs['saved_searches']
     self.filtered_searches = list(xrange(len(self.searches)))
Beispiel #15
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.states = []
     self.pos = 0
Beispiel #16
0
    def __init__(self, db, parent=None):
        QAbstractListModel.__init__(self, parent)

        self.fields = []
        self.db = db
        self.changed = False
Beispiel #17
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.chars = []
     self.allow_dnd = False
Beispiel #18
0
 def __init__(self, recipe_model):
     QAbstractListModel.__init__(self)
     self.recipe_model = recipe_model
Beispiel #19
0
 def __init__(self, names, parent=None):
     self.items = []
     self.names = []
     QAbstractListModel.__init__(self, parent=parent)
Beispiel #20
0
 def __init__(self, names, parent=None):
     self.items = []
     QAbstractListModel.__init__(self, parent)
     self.set_names(names)
Beispiel #21
0
 def __init__(self, widgets):
     self.widgets = widgets
     QAbstractListModel.__init__(self)
Beispiel #22
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.chars = []
     self.allow_dnd = False
Beispiel #23
0
 def __init__(self, manufacturer):
     QAbstractListModel.__init__(self)
     self.devices = get_devices_of(manufacturer)
Beispiel #24
0
 def __init__(self, parent=None, sort_func=sort_key):
     QAbstractListModel.__init__(self, parent)
     self.sort_func = sort_func
     self.all_items = self.current_items = ()
     self.current_prefix = ''
Beispiel #25
0
 def __init__(self, profiles):
     QAbstractListModel.__init__(self)
     self.profiles = list(profiles)
Beispiel #26
0
 def __init__(self):
     QAbstractListModel.__init__(self)
     self.manufacturers = get_manufacturers()
 def __init__(self, fmt_count):
     QAbstractListModel.__init__(self)
     self.fmts = sorted(set(fmt_count))
     self.counts = fmt_count
     self.fi = file_icon_provider()
Beispiel #28
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.items = []
     self.sorting = QCompleter.UnsortedModel
Beispiel #29
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.states = []
     self.pos = 0
Beispiel #30
0
 def __init__(self, recipe_model):
     QAbstractListModel.__init__(self)
     self.recipe_model = recipe_model
Beispiel #31
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.items = []
     self.sorting = QCompleter.UnsortedModel
Beispiel #32
0
 def __init__(self):
     QAbstractListModel.__init__(self)
     self.manufacturers = get_manufacturers()
Beispiel #33
0
 def __init__(self, parent):
     QAbstractListModel.__init__(self, parent)
     self.icon_size = parent.iconSize()
     self.build()
Beispiel #34
0
 def __init__(self, parent):
     QAbstractListModel.__init__(self, parent)
     self.icon_size = parent.iconSize()
     self.build()
Beispiel #35
0
 def __init__(self, names, parent=None):
     self.items = []
     QAbstractListModel.__init__(self, parent)
     self.set_names(names)
Beispiel #36
0
 def __init__(self, widgets):
     self.widgets = widgets
     QAbstractListModel.__init__(self)
Beispiel #37
0
 def __init__(self, names, parent=None):
     self.items = []
     self.names = []
     QAbstractListModel.__init__(self, parent=parent)
Beispiel #38
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.all_items = self.current_items = ()
     self.current_prefix = ''
Beispiel #39
0
    def __init__(self, parent=None):
        QAbstractListModel.__init__(self, parent)
        SearchQueryParser.__init__(self, ['all'])
        raw_defaults, raw_custom = read_raw_tweaks()

        self.parse_tweaks(raw_defaults, raw_custom)
Beispiel #40
0
 def __init__(self, parent=None, sort_func=sort_key):
     QAbstractListModel.__init__(self, parent)
     self.sort_func = sort_func
     self.all_items = self.current_items = ()
     self.current_prefix = ''
Beispiel #41
0
    def __init__(self, parent=None):
        QAbstractListModel.__init__(self, parent)
        SearchQueryParser.__init__(self, ['all'])
        raw_defaults, raw_custom = read_raw_tweaks()

        self.parse_tweaks(raw_defaults, raw_custom)