예제 #1
0
 def populate_list(self):
     if type(self.plugin_keys) == dict:
         for key in self.plugin_keys.keys():
             self.listy.addItem(QListWidgetItem(key))
     else:
         for key in self.plugin_keys:
             self.listy.addItem(QListWidgetItem(key))
예제 #2
0
 def _display_choices(self):
     self.values_list.clear()
     choices = self.mm.search(self.mi.title)
     if choices is None or len(choices) == 0:
         item = QListWidgetItem(get_icon('images/books.png'),
                                _('there seem to be no matches'),
                                self.values_list)
         self.values_list.addItem(item)
     for id, name in choices.items():
         item = QListWidgetItem(get_icon('images/books.png'), name,
                                self.values_list)
         item.setData(1, (id, ))
         self.values_list.addItem(item)
    def _addToTab(self, submission, submissionURL, lst):
        """
        Add a submission and its representative image to the lst under its tab.

        :type submission: praw.objects.Submission
        :type submissionURL: str
        :type lst: QListWidget
        """
        imagePath = submission.representativeImage
        if imagePath is not None and imagePath.exists():
            item = QListWidgetItem(submissionURL, lst)
            item.setTextColor(Qt.transparent)
            labelWidget = QLabel()
            labelWidget.setOpenExternalLinks(True)
            labelWidget.setTextFormat(Qt.RichText)
            size = QSize(128, 158)
            item.setSizeHint(size)
            size = QSize(128, 128)
            if imagePath.suffix == ".webm":
                imagePath = pathlib.Path("RedditDataExtractor", "images",
                                         "videoImage.png").resolve()
            pixmap = QPixmap(str(imagePath))
            pixmap = pixmap.scaled(size, Qt.KeepAspectRatio)
            height = pixmap.height()
            width = pixmap.width()
            submissionTitle = submissionURL[submissionURL[0:-1].rfind("/") +
                                            1:-1]
            labelWidget.setText('<a href="' + submissionURL + '"><img src="' +
                                str(imagePath) + '" height="' + str(height) +
                                '" width="' + str(width) + '"><p>' +
                                submissionTitle)
            lst.setItemWidget(item, labelWidget)
예제 #4
0
 def _display_choices(self, choices):
     self.values_list.clear()
     for id, name in choices.items():
         item = QListWidgetItem(get_icon('images/books.png'), name,
                                self.values_list)
         item.setData(1, (id, ))
         self.values_list.addItem(item)
예제 #5
0
 def refreshList(self, layerSet):
     if layerSet:
         for l in layerSet.rawLayers:
             if not self._layerSet.contains(l):
                 print l.name()
                 self.addItem(QListWidgetItem(l.name(), self))
                 self._layerSet.addLayers(l)
예제 #6
0
    def initialize(self, name, db):  #not working properly to update
        from calibre.library.catalogs import FIELDS

        self.all_fields = [x for x in FIELDS if x != 'all']
        #add custom columns
        for x in sorted(db.custom_field_keys()):
            self.all_fields.append(x)
            if db.field_metadata[x]['datatype'] == 'series':
                self.all_fields.append(x + '_index')
        #populate
        for x in self.all_fields:
            QListWidgetItem(x, self.db_fields)

        self.name = name
        fields = gprefs.get(name + '_db_fields', self.all_fields)
        # Restore the activated db_fields from last use
        for x in xrange(self.db_fields.count()):
            item = self.db_fields.item(x)
            item.setSelected(unicode(item.text()) in fields)
        self.bibfile_enc.clear()
        self.bibfile_enc.addItems(['utf-8', 'cp1252', 'ascii/LaTeX'])
        self.bibfile_enctag.clear()
        self.bibfile_enctag.addItems(
            ['strict', 'replace', 'ignore', 'backslashreplace'])
        self.bib_entry.clear()
        self.bib_entry.addItems(['mixed', 'misc', 'book'])
        # Update dialog fields from stored options
        for opt in self.OPTION_FIELDS:
            opt_value = gprefs.get(self.name + '_' + opt[0], opt[1])
            if opt[0] in ['bibfile_enc', 'bibfile_enctag', 'bib_entry']:
                getattr(self, opt[0]).setCurrentIndex(opt_value)
            elif opt[0] in ['impcit', 'addfiles']:
                getattr(self, opt[0]).setChecked(opt_value)
            else:
                getattr(self, opt[0]).setText(opt_value)
예제 #7
0
 def refill_all_boxes(self):
     if self.refilling:
         return
     self.refilling = True
     self.current_device = None
     self.current_format = None
     self.clear_fields(new_boxes=True)
     self.edit_format.clear()
     self.edit_format.addItem('')
     for format_ in self.current_plugboards:
         self.edit_format.addItem(format_)
     self.edit_format.setCurrentIndex(0)
     self.edit_device.clear()
     self.ok_button.setEnabled(False)
     self.del_button.setEnabled(False)
     self.existing_plugboards.clear()
     for f in self.formats:
         if f not in self.current_plugboards:
             continue
         for d in self.devices:
             if d not in self.current_plugboards[f]:
                 continue
             ops = []
             for op in self.current_plugboards[f][d]:
                 ops.append('([' + op[0] + '] -> ' + op[1] + ')')
             txt = '%s:%s = %s\n' % (f, d, ', '.join(ops))
             item = QListWidgetItem(txt)
             item.setData(Qt.UserRole, (f, d))
             self.existing_plugboards.addItem(item)
     self.refilling = False
예제 #8
0
    def __init__(self, gui, initial_panel=None):
        QDialog.__init__(self, gui)
        self.l = l = QGridLayout(self)
        self.setLayout(l)
        self.setWindowTitle(_('Preferences for Edit Book'))
        self.setWindowIcon(QIcon(I('config.png')))

        self.stacks = QStackedWidget(self)
        l.addWidget(self.stacks, 0, 1, 1, 1)

        self.categories_list = cl = QListWidget(self)
        cl.currentRowChanged.connect(self.stacks.setCurrentIndex)
        cl.clearPropertyFlags()
        cl.setViewMode(cl.IconMode)
        cl.setFlow(cl.TopToBottom)
        cl.setMovement(cl.Static)
        cl.setWrapping(False)
        cl.setSpacing(15)
        cl.setWordWrap(True)
        l.addWidget(cl, 0, 0, 1, 1)

        self.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        bb.accepted.connect(self.accept)
        bb.rejected.connect(self.reject)
        self.rdb = b = bb.addButton(_('Restore all defaults'), bb.ResetRole)
        b.setToolTip(_('Restore defaults for all preferences'))
        b.clicked.connect(self.restore_all_defaults)
        self.rcdb = b = bb.addButton(_('Restore current defaults'), bb.ResetRole)
        b.setToolTip(_('Restore defaults for currently displayed preferences'))
        b.clicked.connect(self.restore_current_defaults)
        l.addWidget(bb, 1, 0, 1, 2)

        self.resize(800, 600)
        geom = tprefs.get('preferences_geom', None)
        if geom is not None:
            self.restoreGeometry(geom)

        self.keyboard_panel = ShortcutConfig(self)
        self.keyboard_panel.initialize(gui.keyboard)
        self.editor_panel = EditorSettings(self)
        self.integration_panel = IntegrationSettings(self)

        for name, icon, panel in [
            (_('Editor settings'), 'modified.png', 'editor'),
            (_('Keyboard shortcuts'), 'keyboard-prefs.png', 'keyboard'),
            (_('Integration with calibre'), 'lt.png', 'integration'),
        ]:
            i = QListWidgetItem(QIcon(I(icon)), name, cl)
            cl.addItem(i)
            self.stacks.addWidget(getattr(self, panel + '_panel'))

        cl.setCurrentRow(0)
        cl.item(0).setSelected(True)
        w, h = cl.sizeHintForColumn(0), 0
        for i in xrange(cl.count()):
            h = max(h, cl.sizeHintForRow(i))
            cl.item(i).setSizeHint(QSize(w, h))

        cl.setMaximumWidth(cl.sizeHintForColumn(0) + 35)
        cl.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
예제 #9
0
    def insertItems(self, row, items, setAsDefault = True):
        """
        Insert the <items> specified items in this list widget. 
        The list widget shows item name string , as a QListwidgetItem. 

        This QListWidgetItem object defines a 'key' of a dictionary 
        (self._itemDictionary) and the 'value' of this key is the object 
        specified by the 'item' itself.         
        Example: self._itemDictionary['C6'] = instance of class Atom. 

        @param row: The row number for the item. 
        @type row: int

        @param items: A list of objects. These objects are treated as values in 
                      the self._itemDictionary
        @type items: list 

        @param setAsDefault: Not used here. See PM_ListWidget.insertItems where 
                             it is used.

        @see: self.renameItemValue() for a comment about 
              self._suppress_itemChanged_signal

        """       

        #delete unused argument. Should this be provided as an argument in this
        #class method ?  
        del setAsDefault

        #self.__init__ for a comment about this flag
        self._suppress_itemChanged_signal = True

        #Clear the previous contents of the self._itemDictionary 
        self._itemDictionary.clear()

        #Clear the contents of this list widget, using QListWidget.clear()
        #See U{<http://doc.trolltech.com/4.2/qlistwidget.html>} for details
        self.clear()

        for item in items:
            if hasattr(item.__class__, 'name'):
                itemName = item.name
            else:
                itemName = str(item)
            listWidgetItem = QListWidgetItem(itemName, self)

            #When we support editing list widget items , uncomment out the 
            #following line . See also self.editItems -- Ninad 2008-01-16
            listWidgetItem.setFlags( listWidgetItem.flags()| Qt.ItemIsEditable)

            if hasattr(item.__class__, 'iconPath'):
                try:
                    listWidgetItem.setIcon(geticon(item.iconPath))
                except:
                    print_compact_traceback()

            self._itemDictionary[listWidgetItem] = item  

        #Reset the flag that temporarily suppresses itemChange signal.   
        self._suppress_itemChanged_signal = False
예제 #10
0
 def __init__(self, parent, duplicates, loc):
     QDialog.__init__(self, parent)
     l = QVBoxLayout()
     self.setLayout(l)
     self.la = la = QLabel(_('Books with the same title and author as the following already exist in the library %s.'
                             ' Select which books you want copied anyway.') %
                           os.path.basename(loc))
     la.setWordWrap(True)
     l.addWidget(la)
     self.setWindowTitle(_('Duplicate books'))
     self.books = QListWidget(self)
     self.items = []
     for book_id, (title, authors) in duplicates.iteritems():
         i = QListWidgetItem(_('{0} by {1}').format(title, ' & '.join(authors[:3])), self.books)
         i.setData(Qt.UserRole, book_id)
         i.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
         i.setCheckState(Qt.Checked)
         self.items.append(i)
     l.addWidget(self.books)
     self.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
     bb.accepted.connect(self.accept)
     bb.rejected.connect(self.reject)
     self.a = b = bb.addButton(_('Select &all'), bb.ActionRole)
     b.clicked.connect(self.select_all), b.setIcon(QIcon(I('plus.png')))
     self.n = b = bb.addButton(_('Select &none'), bb.ActionRole)
     b.clicked.connect(self.select_none), b.setIcon(QIcon(I('minus.png')))
     self.ctc = b = bb.addButton(_('&Copy to clipboard'), bb.ActionRole)
     b.clicked.connect(self.copy_to_clipboard), b.setIcon(QIcon(I('edit-copy.png')))
     l.addWidget(bb)
     self.resize(600, 400)
예제 #11
0
 def _display_choices(self):
     self.values_list.clear()
     for author, author_sort in self.choices.items():
         item = QListWidgetItem(get_icon('images/books.png'), author,
                                self.values_list)
         item.setData(1, (author_sort, ))
         self.values_list.addItem(item)
예제 #12
0
    def __init__(self, all_formats, format_map):
        QWidget.__init__(self)
        self.l = l = QGridLayout()
        self.setLayout(l)

        self.f = f = QListWidget(self)
        l.addWidget(f, 0, 0, 3, 1)
        unchecked_formats = sorted(all_formats - set(format_map))
        for fmt in format_map + unchecked_formats:
            item = QListWidgetItem(fmt, f)
            item.setData(Qt.UserRole, fmt)
            item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable
                          | Qt.ItemIsSelectable)
            item.setCheckState(Qt.Checked if fmt in
                               format_map else Qt.Unchecked)

        self.button_up = b = QToolButton(self)
        b.setIcon(QIcon(I('arrow-up.png')))
        l.addWidget(b, 0, 1)
        b.clicked.connect(self.up)

        self.button_down = b = QToolButton(self)
        b.setIcon(QIcon(I('arrow-down.png')))
        l.addWidget(b, 2, 1)
        b.clicked.connect(self.down)
예제 #13
0
 def indicate_no_items(self):
     self.no_valid_items = True
     self.items.clear()
     self.items.addItem(QListWidgetItem(_('**No items found**')))
     self.books_label.setText(
         _('Click in a column  in the library view '
           'to see the information for that book'))
예제 #14
0
 def _display_issues(self):
     self.values_list.clear()
     issues = self.mm.get_all_issues(True)
     for id, issue in issues:
         item = QListWidgetItem(get_icon('images/books.png'), issue,
                                self.values_list)
         item.setData(1, (id, ))
         self.values_list.addItem(item)
예제 #15
0
    def build_lists(self):
        self.available.clear(), self.current.clear()
        name = self.current_name
        if not name:
            return
        items = self.current_settings[name]
        applied = set(items)
        all_items = toolbar_actions if name.startswith(
            'global_') else editor_toolbar_actions[name.split('_')[1]]
        blank = QIcon(I('blank.png'))

        def to_item(key, ac, parent):
            ic = ac.icon()
            if not ic or ic.isNull():
                ic = blank
            ans = QListWidgetItem(ic,
                                  unicode(ac.text()).replace('&', ''), parent)
            ans.setData(Qt.UserRole, key)
            ans.setToolTip(ac.toolTip())
            return ans

        for key, ac in sorted(all_items.iteritems(),
                              key=lambda k_ac: unicode(k_ac[1].text())):
            if key not in applied:
                to_item(key, ac, self.available)
        if name == 'global_book_toolbar' and 'donate' not in applied:
            QListWidgetItem(QIcon(I('donate.png')), _('Donate'),
                            self.available).setData(Qt.UserRole, 'donate')

        QListWidgetItem(blank, '--- %s ---' % _('Separator'), self.available)
        for key in items:
            if key is None:
                QListWidgetItem(blank, '--- %s ---' % _('Separator'),
                                self.current)
            else:
                if key == 'donate':
                    QListWidgetItem(QIcon(I('donate.png')), _('Donate'),
                                    self.current).setData(
                                        Qt.UserRole, 'donate')
                else:
                    try:
                        ac = all_items[key]
                    except KeyError:
                        pass
                    to_item(key, ac, self.current)
예제 #16
0
 def to_item(key, ac, parent):
     ic = ac.icon()
     if not ic or ic.isNull():
         ic = blank
     ans = QListWidgetItem(ic,
                           unicode(ac.text()).replace('&', ''), parent)
     ans.setData(Qt.UserRole, key)
     ans.setToolTip(ac.toolTip())
     return ans
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setupUi(self)
        from calibre.library.catalogs import FIELDS
        self.all_fields = []
        for x in FIELDS:
            if x != 'all':
                self.all_fields.append(x)
                QListWidgetItem(x, self.db_fields)

        db = db_()
        for x in sorted(db.custom_field_keys()):
            self.all_fields.append(x)
            QListWidgetItem(x, self.db_fields)

            fm = db.field_metadata[x]
            if fm['datatype'] == 'series':
                QListWidgetItem(x + '_index', self.db_fields)
예제 #18
0
 def setter(w, val):
     order_map = {x: i for i, x in enumerate(val)}
     items = list(w.defaults)
     limit = len(items)
     items.sort(key=lambda x: order_map.get(x, limit))
     w.clear()
     for x in items:
         i = QListWidgetItem(w)
         i.setText(x)
         i.setFlags(i.flags() | Qt.ItemIsDragEnabled)
예제 #19
0
    def __init__(self, parent, layerSet=None):
        QListWidget.__init__(self, parent)
        self.setSelectionMode(QAbstractItemView.SingleSelection)
        if layerSet:
            self._layerSet = layerSet
        else:
            self._layerSet = GLayerSet()

        if layerSet:
            for l in layerSet.rawLayers:
                self.addItem(QListWidgetItem(l.name(), self))
        self.show()
예제 #20
0
파일: Managers.py 프로젝트: dwhite91/Rudy
    def listMatters(self):
        matterTypes = MtrFuncs.listMatters(
            activeOnly=self.ui.showInactive.checkState() == 0)

        self.ui.matterList.clear()
        for i in matterTypes.index:
            mType = matterTypes.loc[i]
            matterLabel = QtGui.QLabel(mType.matterdescr)
            matterLabel.mType = mType
            item = QListWidgetItem()
            self.ui.matterList.addItem(item)
            self.ui.matterList.setItemWidget(item, matterLabel)
예제 #21
0
파일: Managers.py 프로젝트: dwhite91/Rudy
    def listUsers(self):
        userListData = UsrFuncs.getUserList(
            activeOnly=self.ui.showInactive.checkState() == 0)

        self.ui.userList.clear()
        for i in userListData.index:
            item = QListWidgetItem()
            itemLabel = QtGui.QLabel(userListData.username[i])
            itemLabel.data = userListData.loc[i]

            self.ui.userList.addItem(item)
            self.ui.userList.setItemWidget(item, itemLabel)
예제 #22
0
 def _accept_clicked(self):
     #self._save_preferences()
     one_liner = unicode(self.one_liner_str.text())
     if one_liner == '':
         self.values_list.clear()
         item = QListWidgetItem(get_icon('images/books.png'),
                                _('you need to enter a short description'),
                                self.values_list)
         self.values_list.addItem(item)
     else:
         self.one_line_description = one_liner
     self.accept()
예제 #23
0
    def refresh(self, idx):
        if self.lock_qv.isChecked():
            return

        bv_row = idx.row()
        self.current_column = idx.column()
        key = self.view.model().column_map[self.current_column]
        book_id = self.view.model().id(bv_row)

        if self.current_book_id == book_id and self.current_key == key:
            return

        # Only show items for categories
        if not self.db.field_metadata[key]['is_category']:
            if self.current_key is None:
                self.indicate_no_items()
                return
            key = self.current_key
        self.items_label.setText(
            _('&Item: {0} ({1})').format(self.db.field_metadata[key]['name'],
                                         key))

        self.items.blockSignals(True)
        self.items.clear()
        self.books_table.setRowCount(0)

        mi = self.db.get_metadata(book_id,
                                  index_is_id=True,
                                  get_user_categories=False)
        vals = mi.get(key, None)

        if vals:
            self.no_valid_items = False
            if self.db.field_metadata[key]['datatype'] == 'rating':
                vals = unicode(vals / 2)
            if not isinstance(vals, list):
                vals = [vals]
            vals.sort(key=sort_key)

            for v in vals:
                a = QListWidgetItem(v)
                self.items.addItem(a)
            self.items.setCurrentRow(0)

            self.current_book_id = book_id
            self.current_key = key

            self.fill_in_books_box(vals[0])
        else:
            self.indicate_no_items()

        self.items.blockSignals(False)
예제 #24
0
 def init_input_order(self, defaults=False):
     if defaults:
         input_map = prefs.defaults['input_format_order']
     else:
         input_map = prefs['input_format_order']
     all_formats = set()
     self.opt_input_order.clear()
     for fmt in all_input_formats().union(set(['ZIP', 'RAR'])):
         all_formats.add(fmt.upper())
     for format in input_map + list(all_formats.difference(input_map)):
         item = QListWidgetItem(format, self.opt_input_order)
         item.setData(Qt.UserRole, QVariant(format))
         item.setFlags(Qt.ItemIsEnabled|Qt.ItemIsSelectable)
예제 #25
0
 def set_bookmarks(self, bookmarks=None):
     if bookmarks is None:
         bookmarks = self.original_bookmarks
     self.bookmarks_list.clear()
     for bm in bookmarks:
         i = QListWidgetItem(bm['title'])
         i.setData(Qt.UserRole, self.bm_to_item(bm))
         i.setFlags(i.flags() | Qt.ItemIsEditable)
         self.bookmarks_list.addItem(i)
     if len(bookmarks) > 0:
         self.bookmarks_list.setCurrentItem(
             self.bookmarks_list.item(0),
             QItemSelectionModel.ClearAndSelect)
예제 #26
0
    def link_stylesheets(self, names):
        s = self.categories['styles']
        sheets = [
            unicode(s.child(i).data(0, NAME_ROLE).toString())
            for i in xrange(s.childCount())
        ]
        if not sheets:
            return error_dialog(
                self,
                _('No stylesheets'),
                _('This book currently has no stylesheets. You must first create a stylesheet'
                  ' before linking it.'),
                show=True)
        d = QDialog(self)
        d.l = l = QVBoxLayout(d)
        d.setLayout(l)
        d.setWindowTitle(_('Choose stylesheets'))
        d.la = la = QLabel(
            _('Choose the stylesheets to link. Drag and drop to re-arrange'))

        la.setWordWrap(True)
        l.addWidget(la)
        d.s = s = QListWidget(d)
        l.addWidget(s)
        s.setDragEnabled(True)
        s.setDropIndicatorShown(True)
        s.setDragDropMode(self.InternalMove)
        s.setAutoScroll(True)
        s.setDefaultDropAction(Qt.MoveAction)
        for name in sheets:
            i = QListWidgetItem(name, s)
            flags = Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled | Qt.ItemIsSelectable
            i.setFlags(flags)
            i.setCheckState(Qt.Checked)
        d.r = r = QCheckBox(_('Remove existing links to stylesheets'))
        r.setChecked(tprefs['remove_existing_links_when_linking_sheets'])
        l.addWidget(r)
        d.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)
        bb.accepted.connect(d.accept), bb.rejected.connect(d.reject)
        l.addWidget(bb)
        if d.exec_() == d.Accepted:
            tprefs['remove_existing_links_when_linking_sheets'] = r.isChecked()
            sheets = [
                unicode(s.item(il).text()) for il in xrange(s.count())
                if s.item(il).checkState() == Qt.Checked
            ]
            if sheets:
                self.link_stylesheets_requested.emit(names, sheets,
                                                     r.isChecked())
예제 #27
0
 def _display_formats(self):
     self.values_list.clear()
     formats = self.dm.get_download_info(self.casanova_id)
     if isinstance(formats, list):
         for format in formats:
             item = QListWidgetItem(get_icon('images/books.png'),
                                    format['type'], self.values_list)
             item.setData(1, (format, ))
             self.values_list.addItem(item)
     else:
         return error_dialog(self.gui,
                             'Casanova message',
                             unicode(formats),
                             show=True)
예제 #28
0
    def initialize(self):
        self.devices.blockSignals(True)
        self.devices.clear()
        for dev in self.gui.device_manager.devices:
            for d, name in dev.get_user_blacklisted_devices().iteritems():
                item = QListWidgetItem('%s [%s]' % (name, d), self.devices)
                item.setData(Qt.UserRole, (dev, d))
                item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable
                              | Qt.ItemIsSelectable)
                item.setCheckState(Qt.Checked)
        self.devices.blockSignals(False)

        self.device_plugins.blockSignals(True)
        for dev in self.gui.device_manager.disabled_device_plugins:
            n = dev.get_gui_name()
            item = QListWidgetItem(n, self.device_plugins)
            item.setData(Qt.UserRole, dev)
            item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable
                          | Qt.ItemIsSelectable)
            item.setCheckState(Qt.Checked)
            item.setIcon(QIcon(I('plugins.png')))
        self.device_plugins.sortItems()
        self.device_plugins.blockSignals(False)
예제 #29
0
    def __init__(self, window, msg, formats):
        QDialog.__init__(self, window)
        Ui_ChooseFormatDialog.__init__(self)
        self.setupUi(self)
        self.formats.activated[QModelIndex].connect(self.activated_slot)

        self.msg.setText(msg)
        for format in formats:
            self.formats.addItem(
                QListWidgetItem(
                    file_icon_provider().icon_from_ext(format.lower()),
                    format.upper()))
        self._formats = formats
        self.formats.setCurrentRow(0)
        self._format = None
예제 #30
0
    def run_checks(self, container):
        with BusyCursor():
            self.show_busy()
            QApplication.processEvents()
            errors = run_checks(container)
            self.hide_busy()

        for err in sorted(errors, key=lambda e: (100 - e.level, e.name)):
            i = QListWidgetItem('%s\xa0\xa0\xa0\xa0[%s]' % (err.msg, err.name),
                                self.items)
            i.setData(Qt.UserRole, err)
            i.setIcon(icon_for_level(err.level))
        if errors:
            self.items.setCurrentRow(0)
            self.current_item_changed()
            self.items.setFocus(Qt.OtherFocusReason)
        else:
            self.clear_help(_('No problems found'))