summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/portato.cfg8
-rw-r--r--portato/gui/gui_helper.py2
-rw-r--r--portato/gui/qt/ui/MainWindow.ui12
-rw-r--r--portato/gui/qt/ui/PreferenceWindow.ui7
-rw-r--r--portato/gui/qt/windows.py35
5 files changed, 50 insertions, 14 deletions
diff --git a/etc/portato.cfg b/etc/portato.cfg
index e177714..0692e88 100644
--- a/etc/portato.cfg
+++ b/etc/portato.cfg
@@ -55,4 +55,12 @@ useperversion = True
; control whether usetips are shown for a package in the Queue - boolean values
showusetips = on
+#
+# Qt-Section for options of the Qt-Frontend
+#
+[Qt]
+
+; control whether to show icons instead of checkboxes in the package list
+packageicons = off
+
# vim:ts=4:sw=4:ft=cfg
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index 2b8ab44..e52b3f3 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -35,6 +35,7 @@ class Config:
const = {
"main_sec" : "Main",
"gtk_sec" : "Gtk",
+ "qt_sec" : "Qt",
"usePerVersion_opt" : "usePerVersion",
"useFile_opt" : "usefile",
"maskFile_opt" : "maskfile",
@@ -47,6 +48,7 @@ class Config:
"newuse_opt" : "newuse",
"syncCmd_opt" : "synccommand",
"useTips_opt" : "showusetips",
+ "pkgIcons_opt" : "packageIcons",
"system_opt" : "system"
}
diff --git a/portato/gui/qt/ui/MainWindow.ui b/portato/gui/qt/ui/MainWindow.ui
index 14127c9..d75f0d3 100644
--- a/portato/gui/qt/ui/MainWindow.ui
+++ b/portato/gui/qt/ui/MainWindow.ui
@@ -70,17 +70,23 @@
</widget>
</item>
<item>
- <widget class="QListView" name="pkgList" >
+ <widget class="QListWidget" name="pkgList" >
<property name="editTriggers" >
<set>QAbstractItemView::NoEditTriggers</set>
</property>
+ <property name="showDropIndicator" stdset="0" >
+ <bool>false</bool>
+ </property>
+ <property name="sortingEnabled" >
+ <bool>true</bool>
+ </property>
</widget>
</item>
</layout>
</widget>
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
- <number>1</number>
+ <number>0</number>
</property>
<widget class="QWidget" name="pkgTab" >
<attribute name="title" >
@@ -391,7 +397,7 @@ p, li { white-space: pre-wrap; }
<x>0</x>
<y>0</y>
<width>466</width>
- <height>31</height>
+ <height>27</height>
</rect>
</property>
<widget class="QMenu" name="menuHelp" >
diff --git a/portato/gui/qt/ui/PreferenceWindow.ui b/portato/gui/qt/ui/PreferenceWindow.ui
index 6ac29e8..fd4ccfa 100644
--- a/portato/gui/qt/ui/PreferenceWindow.ui
+++ b/portato/gui/qt/ui/PreferenceWindow.ui
@@ -41,6 +41,13 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="pkgIconsCheck" >
+ <property name="text" >
+ <string>Use icons in package list</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py
index b2949bd..b4662a7 100644
--- a/portato/gui/qt/windows.py
+++ b/portato/gui/qt/windows.py
@@ -150,7 +150,8 @@ class PreferenceWindow (Window):
"newUseCheck" : "newuse_opt",
"maskCheck" : "maskPerVersion_opt",
"useCheck" : "usePerVersion_opt",
- "testingCheck" : "testingPerVersion_opt"
+ "testingCheck" : "testingPerVersion_opt",
+ "pkgIconsCheck" : ("pkgIcons_opt", "qt_sec")
}
# all edits in the window
@@ -552,10 +553,9 @@ class MainWindow (Window):
self.cfg.modify_external_configs()
# the two lists
- self.build_pkg_list()
self.build_cat_list()
Qt.QObject.connect(self.selCatListModel, Qt.SIGNAL("currentChanged(QModelIndex, QModelIndex)"), self.cb_cat_list_selected)
- Qt.QObject.connect(self.selPkgListModel, Qt.SIGNAL("currentChanged(QModelIndex, QModelIndex)"), self.cb_pkg_list_selected)
+ Qt.QObject.connect(self.pkgList, Qt.SIGNAL("currentItemChanged(QListWidgetItem*, QListWidgetItem*)"), self.cb_pkg_list_selected)
# build console
self.console = QtConsole(self.consoleTab)
@@ -593,14 +593,26 @@ class MainWindow (Window):
self.pkgDetails.update(cp, self.queue)
def fill_pkg_list (self, cat):
- self.pkgListModel.setStringList([name for (name,inst) in self.db.get_cat(cat)])
+ use_icons = self.cfg.get_boolean("pkgIcons_opt", section = self.cfg.const["qt_sec"])
+
+ # installed icon
+ if use_icons:
+ yes = Qt.QApplication.style().standardIcon(Qt.QStyle.SP_DialogYesButton)
+ no = Qt.QApplication.style().standardIcon(Qt.QStyle.SP_DialogNoButton)
+
+ self.pkgList.clear()
- def build_pkg_list (self):
- self.pkgListModel = Qt.QStringListModel([])
- self.pkgListModel.sort(0)
- self.selPkgListModel = Qt.QItemSelectionModel(self.pkgListModel)
- self.pkgList.setModel(self.pkgListModel)
- self.pkgList.setSelectionModel(self.selPkgListModel)
+ for name, inst in self.db.get_cat(cat):
+ if use_icons:
+ if inst:
+ icon = yes
+ else:
+ icon = no
+ Qt.QListWidgetItem(icon, name, self.pkgList)
+ else: # use checkboxes
+ item = Qt.QListWidgetItem(name, self.pkgList)
+ item.setCheckState(qCheck(inst))
+ item.setFlags(Qt.Qt.ItemIsSelectable | Qt.Qt.ItemIsEnabled)
def build_cat_list (self):
self.catListModel = Qt.QStringListModel(system.list_categories())
@@ -725,4 +737,5 @@ class MainWindow (Window):
self.fill_pkg_list(self.selCatName)
def cb_pkg_list_selected (self, index, prev):
- self.pkgDetails.update(self.selCatName+"/"+str(index.data().toString()), self.queue)
+ if not index is None:
+ self.pkgDetails.update(self.selCatName+"/"+str(index.text()), self.queue)