Пример #1
0
 def __init__(self, parent=None):
     QListView.__init__(self, parent)
     self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding)
     self.setAlternatingRowColors(True)
     self.setSpacing(5)
     self.setUniformItemSizes(True)
     self.setVerticalScrollMode(self.ScrollPerPixel)
Пример #2
0
 def __init__(self, parent):
     QListView.__init__(self, parent)
     setup_dnd_interface(self)
     self.setUniformItemSizes(True)
     self.setWrapping(True)
     self.setFlow(self.LeftToRight)
     # We cannot set layout mode to batched, because that breaks
     # restore_vpos()
     # self.setLayoutMode(self.Batched)
     self.setResizeMode(self.Adjust)
     self.setSelectionMode(self.ExtendedSelection)
     self.setVerticalScrollMode(self.ScrollPerPixel)
     self.delegate = CoverDelegate(self)
     self.delegate.animation.valueChanged.connect(self.animation_value_changed)
     self.delegate.animation.finished.connect(self.animation_done)
     self.setItemDelegate(self.delegate)
     self.setSpacing(self.delegate.spacing)
     self.padding_left = 0
     self.set_color()
     self.ignore_render_requests = Event()
     self.thumbnail_cache = ThumbnailCache(max_size=gprefs['cover_grid_disk_cache_size'],
         thumbnail_size=(self.delegate.cover_size.width(), self.delegate.cover_size.height()))
     self.render_thread = None
     self.update_item.connect(self.re_render, type=Qt.QueuedConnection)
     self.doubleClicked.connect(self.double_clicked)
     self.setCursor(Qt.PointingHandCursor)
     self.gui = parent
     self.context_menu = None
     self.update_timer = QTimer(self)
     self.update_timer.setInterval(200)
     self.update_timer.timeout.connect(self.update_viewport)
     self.update_timer.setSingleShot(True)
     self.resize_timer = t = QTimer(self)
     t.setInterval(200), t.setSingleShot(True)
     t.timeout.connect(self.update_memory_cover_cache_size)
Пример #3
0
 def __init__(self, parent=None):
     QListView.__init__(self, parent)
     self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
     f = self.font()
     f.setBold(True)
     self.setFont(f)
     self.setIconSize(QSize(48, 48))
     self.setFlow(self.TopToBottom)
     self.setSpacing(10)
Пример #4
0
 def __init__(self, parent=None):
     QListView.__init__(self, parent)
     self.setStyleSheet('''
     QListView { color: FG; background: BG }
     QListView::item:selected { border-radius: 8px; background: HB }
     '''.replace('HB', color('status bar highlight', 'palette(highlight)')).replace(
         'FG', color('tab tree foreground', 'palette(window-text)')).replace(
         'BG', color('tab tree background', 'palette(window)'))
     )
     self.setFrameStyle(QFrame.NoFrame)
     self.viewport().setAutoFillBackground(False)
     self.setIconSize(QSize(16, 16))
     self.setSpacing(2)
     self.setFocusPolicy(Qt.NoFocus)
     self.delegate = d = Delegate(self)
     self.setItemDelegate(d)
Пример #5
0
 def __init__(self, completer_widget, max_visible_items=7, sort_func=sort_key):
     QListView.__init__(self)
     self.disable_popup = False
     self.completer_widget = weakref.ref(completer_widget)
     self.setWindowFlags(Qt.Popup)
     self.max_visible_items = max_visible_items
     self.setEditTriggers(self.NoEditTriggers)
     self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setSelectionBehavior(self.SelectRows)
     self.setSelectionMode(self.SingleSelection)
     self.setAlternatingRowColors(True)
     self.setModel(CompleteModel(self, sort_func=sort_func))
     self.setMouseTracking(True)
     self.entered.connect(self.item_entered)
     self.activated.connect(self.item_chosen)
     self.pressed.connect(self.item_chosen)
     self.installEventFilter(self)
Пример #6
0
    def __init__(self, current_cover, parent=None):
        QListView.__init__(self, parent)
        self.m = CoversModel(current_cover, self)
        self.setModel(self.m)

        self.setFlow(self.LeftToRight)
        self.setWrapping(True)
        self.setResizeMode(self.Adjust)
        self.setGridSize(QSize(190, 260))
        self.setIconSize(QSize(150, 200))
        self.setSelectionMode(self.SingleSelection)
        self.setViewMode(self.IconMode)

        self.delegate = CoverDelegate(self)
        self.setItemDelegate(self.delegate)
        self.delegate.needs_redraw.connect(self.viewport().update, type=Qt.QueuedConnection)

        self.doubleClicked.connect(self.chosen, type=Qt.QueuedConnection)
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.show_context_menu)
Пример #7
0
 def __init__(self, parent=None):
     self.last_mouse_idx = -1
     QListView.__init__(self, parent)
     self._model = CharModel(self)
     self.setModel(self._model)
     self.delegate = CharDelegate(self)
     self.setItemDelegate(self.delegate)
     self.setFlow(self.LeftToRight)
     self.setWrapping(True)
     self.setMouseTracking(True)
     self.setSpacing(2)
     self.setUniformItemSizes(True)
     self.setContextMenuPolicy(Qt.CustomContextMenu)
     self.customContextMenuRequested.connect(self.context_menu)
     self.showing_favorites = False
     pi = plugins['progress_indicator'][0]
     if hasattr(pi, 'set_no_activate_on_click'):
         pi.set_no_activate_on_click(self)
     self.activated.connect(self.item_activated)
     self.clicked.connect(self.item_activated)
Пример #8
0
 def __init__(self,
              completer_widget,
              max_visible_items=7,
              sort_func=sort_key):
     QListView.__init__(self)
     self.disable_popup = False
     self.completer_widget = weakref.ref(completer_widget)
     self.setWindowFlags(Qt.Popup)
     self.max_visible_items = max_visible_items
     self.setEditTriggers(self.NoEditTriggers)
     self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setSelectionBehavior(self.SelectRows)
     self.setSelectionMode(self.SingleSelection)
     self.setAlternatingRowColors(True)
     self.setModel(CompleteModel(self, sort_func=sort_func))
     self.setMouseTracking(True)
     self.entered.connect(self.item_entered)
     self.activated.connect(self.item_chosen)
     self.pressed.connect(self.item_chosen)
     self.installEventFilter(self)
Пример #9
0
 def __init__(self, parent=None):
     self.last_mouse_idx = -1
     QListView.__init__(self, parent)
     self._model = CharModel(self)
     self.setModel(self._model)
     self.delegate = CharDelegate(self)
     self.setItemDelegate(self.delegate)
     self.setFlow(self.LeftToRight)
     self.setWrapping(True)
     self.setMouseTracking(True)
     self.setSpacing(2)
     self.setUniformItemSizes(True)
     self.setContextMenuPolicy(Qt.CustomContextMenu)
     self.customContextMenuRequested.connect(self.context_menu)
     self.showing_favorites = False
     pi = plugins['progress_indicator'][0]
     if hasattr(pi, 'set_no_activate_on_click'):
         pi.set_no_activate_on_click(self)
     self.activated.connect(self.item_activated)
     self.clicked.connect(self.item_activated)
Пример #10
0
 def __init__(self, parent):
     QListView.__init__(self, parent)
     self._ncols = None
     self.gesture_manager = GestureManager(self)
     setup_dnd_interface(self)
     self.setUniformItemSizes(True)
     self.setWrapping(True)
     self.setFlow(self.LeftToRight)
     # We cannot set layout mode to batched, because that breaks
     # restore_vpos()
     # self.setLayoutMode(self.Batched)
     self.setResizeMode(self.Adjust)
     self.setSelectionMode(self.ExtendedSelection)
     self.setVerticalScrollMode(self.ScrollPerPixel)
     self.delegate = CoverDelegate(self)
     self.delegate.animation.valueChanged.connect(
         self.animation_value_changed)
     self.delegate.animation.finished.connect(self.animation_done)
     self.setItemDelegate(self.delegate)
     self.setSpacing(self.delegate.spacing)
     self.set_color()
     self.ignore_render_requests = Event()
     dpr = self.device_pixel_ratio
     self.thumbnail_cache = ThumbnailCache(
         max_size=gprefs['cover_grid_disk_cache_size'],
         thumbnail_size=(int(dpr * self.delegate.cover_size.width()),
                         int(dpr * self.delegate.cover_size.height())))
     self.render_thread = None
     self.update_item.connect(self.re_render,
                              type=Qt.ConnectionType.QueuedConnection)
     self.doubleClicked.connect(self.double_clicked)
     self.setCursor(Qt.CursorShape.PointingHandCursor)
     self.gui = parent
     self.context_menu = None
     self.update_timer = QTimer(self)
     self.update_timer.setInterval(200)
     self.update_timer.timeout.connect(self.update_viewport)
     self.update_timer.setSingleShot(True)
     self.resize_timer = t = QTimer(self)
     t.setInterval(200), t.setSingleShot(True)
     t.timeout.connect(self.update_memory_cover_cache_size)
Пример #11
0
    def __init__(self, current_cover, parent=None):
        QListView.__init__(self, parent)
        self.m = CoversModel(current_cover, self)
        self.setModel(self.m)

        self.setFlow(self.LeftToRight)
        self.setWrapping(True)
        self.setResizeMode(self.Adjust)
        self.setGridSize(QSize(190, 260))
        self.setIconSize(QSize(*CoverDelegate.ICON_SIZE))
        self.setSelectionMode(self.SingleSelection)
        self.setViewMode(self.IconMode)

        self.delegate = CoverDelegate(self)
        self.setItemDelegate(self.delegate)
        self.delegate.needs_redraw.connect(self.viewport().update,
                                           type=Qt.QueuedConnection)

        self.doubleClicked.connect(self.chosen, type=Qt.QueuedConnection)
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.show_context_menu)
Пример #12
0
 def __init__(self, parent):
     QListView.__init__(self, parent)
     self.setSelectionMode(self.SingleSelection)
     self.setAlternatingRowColors(True)
     self.d = FontFamilyDelegate(self)
     self.setItemDelegate(self.d)
Пример #13
0
 def __init__(self, parent):
     QListView.__init__(self, parent)
     self.setSelectionMode(self.SingleSelection)
     self.setAlternatingRowColors(True)
     self.d = FontFamilyDelegate(self)
     self.setItemDelegate(self.d)
Пример #14
0
 def __init__(self, parent=None):
     QListView.__init__(self, parent)
     self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding)
     self.setAlternatingRowColors(True)
     self.setSpacing(5)
     self.setVerticalScrollMode(self.ScrollPerPixel)
Пример #15
0
 def __init__(self, parent, enable_convert_buttons_function):
     QListView.__init__(self, parent)
     self.enable_convert_buttons_function = enable_convert_buttons_function
Пример #16
0
 def __init__(self, parent):
     QListView.__init__(self, parent)
     self.selectedIndexChanged.connect(self._handle_selected_index_changed)
     self._updating_selection = False