summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to 'portato')
-rw-r--r--portato/gui/gui_helper.py1
-rw-r--r--portato/gui/qt/terminal.py12
-rw-r--r--portato/gui/qt/tree.py7
-rw-r--r--portato/gui/qt/ui/MainWindow.ui58
-rw-r--r--portato/gui/qt/windows.py54
5 files changed, 117 insertions, 15 deletions
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index e52b3f3..d50eb72 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -624,6 +624,7 @@ class EmergeQueue:
childIt = self.tree.first_child_iter(parentIt)
while childIt:
+ debug("childIt", self.tree.get_value(childIt, 0))
if (self.tree.iter_has_children(childIt)): # recursive call
self.remove_children(childIt, removeNewFlags)
temp = childIt
diff --git a/portato/gui/qt/terminal.py b/portato/gui/qt/terminal.py
index fd01e05..2734aaf 100644
--- a/portato/gui/qt/terminal.py
+++ b/portato/gui/qt/terminal.py
@@ -101,7 +101,7 @@ class QtConsole (Console, Qt.QTextEdit):
def start_new_thread (self):
self.run = True
- self.current = Thread(target=self.__run)
+ self.current = Thread(target=self.__run, name="QtTerminal Listener")
self.current.setDaemon(True) # close application even if this thread is running
self.current.start()
@@ -167,9 +167,13 @@ class QtConsole (Console, Qt.QTextEdit):
format = self.virgin_format()
break
- if attr[s] is not None:
- format.merge(attr[s])
- else:
+ try:
+ if attr[s] is not None:
+ format.merge(attr[s])
+ else:
+ format = self.virgin_format()
+ break
+ except KeyError: # no such attribute
format = self.virgin_format()
break
diff --git a/portato/gui/qt/tree.py b/portato/gui/qt/tree.py
index a8c3e66..6e9950f 100644
--- a/portato/gui/qt/tree.py
+++ b/portato/gui/qt/tree.py
@@ -70,7 +70,12 @@ class QtTree (Tree):
def next_iter (self, it):
iter = Qt.QTreeWidgetItemIterator(it)
iter += 1 # next iter ...
- return iter.value()
+
+ newIt = iter.value()
+ if newIt.parent() != it.parent(): # stop if we left the current parent
+ return None
+ else:
+ return newIt
def get_value (self, it, column):
return str(it.text(column))
diff --git a/portato/gui/qt/ui/MainWindow.ui b/portato/gui/qt/ui/MainWindow.ui
index d75f0d3..80c5c12 100644
--- a/portato/gui/qt/ui/MainWindow.ui
+++ b/portato/gui/qt/ui/MainWindow.ui
@@ -86,7 +86,7 @@
</widget>
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="pkgTab" >
<attribute name="title" >
@@ -315,6 +315,9 @@ p, li { white-space: pre-wrap; }
</property>
<item>
<widget class="QTreeWidget" name="queueList" >
+ <property name="contextMenuPolicy" >
+ <enum>Qt::ActionsContextMenu</enum>
+ </property>
<property name="editTriggers" >
<set>QAbstractItemView::NoEditTriggers</set>
</property>
@@ -400,6 +403,15 @@ p, li { white-space: pre-wrap; }
<height>27</height>
</rect>
</property>
+ <widget class="QMenu" name="menuFile" >
+ <property name="title" >
+ <string>&amp;File</string>
+ </property>
+ <addaction name="prefAction" />
+ <addaction name="reloadAction" />
+ <addaction name="separator" />
+ <addaction name="quitAction" />
+ </widget>
<widget class="QMenu" name="menuHelp" >
<property name="title" >
<string>&amp;?</string>
@@ -414,13 +426,10 @@ p, li { white-space: pre-wrap; }
<addaction name="unmergeAction" />
<addaction name="updateAction" />
<addaction name="separator" />
- </widget>
- <widget class="QMenu" name="menuFile" >
- <property name="title" >
- <string>&amp;File</string>
- </property>
- <addaction name="prefAction" />
- <addaction name="quitAction" />
+ <addaction name="syncAction" />
+ <addaction name="saveAction" />
+ <addaction name="separator" />
+ <addaction name="killAction" />
</widget>
<addaction name="menuFile" />
<addaction name="menu_Emerge" />
@@ -439,13 +448,16 @@ p, li { white-space: pre-wrap; }
<string>&amp;Quit</string>
</property>
<property name="menuRole" >
- <enum>QAction::TextHeuristicRole</enum>
+ <enum>QAction::QuitRole</enum>
</property>
</action>
<action name="aboutAction" >
<property name="text" >
<string>&amp;About</string>
</property>
+ <property name="menuRole" >
+ <enum>QAction::AboutRole</enum>
+ </property>
</action>
<action name="emergeAction" >
<property name="text" >
@@ -466,6 +478,34 @@ p, li { white-space: pre-wrap; }
<property name="text" >
<string>&amp;Preferences</string>
</property>
+ <property name="menuRole" >
+ <enum>QAction::PreferencesRole</enum>
+ </property>
+ </action>
+ <action name="syncAction" >
+ <property name="text" >
+ <string>S&amp;ync</string>
+ </property>
+ </action>
+ <action name="saveAction" >
+ <property name="text" >
+ <string>Save &amp;Flage</string>
+ </property>
+ </action>
+ <action name="killAction" >
+ <property name="text" >
+ <string>Ki&amp;ll Emerge</string>
+ </property>
+ </action>
+ <action name="reloadAction" >
+ <property name="text" >
+ <string>&amp;Reload Portage</string>
+ </property>
+ </action>
+ <action name="oneshotAction" >
+ <property name="text" >
+ <string>&amp;Oneshot</string>
+ </property>
</action>
</widget>
<customwidgets>
diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py
index b4662a7..f6d5103 100644
--- a/portato/gui/qt/windows.py
+++ b/portato/gui/qt/windows.py
@@ -567,6 +567,7 @@ class MainWindow (Window):
Qt.QObject.connect(self, Qt.SIGNAL("doTitleUpdate"), self._title_update)
# build queueList
+ self.queueList.addAction(self.oneshotAction)
self.queueList.setHeaderLabels(["Package", "Additional infos"])
self.queueTree = QtTree(self.queueList)
Qt.QObject.connect(self.queueList.model(), Qt.SIGNAL("rowsInserted (const QModelIndex&, int, int)"), self.cb_queue_list_items_added)
@@ -628,7 +629,58 @@ class MainWindow (Window):
@Qt.pyqtSignature("")
def on_prefAction_triggered (self):
PreferenceWindow(self, self.cfg).exec_()
-
+
+ @Qt.pyqtSignature("")
+ @Window.watch_cursor
+ def on_reloadAction_triggered (self):
+ """Reloads the portage settings and the database."""
+ system.reload_settings()
+ del self.db
+ self.db = Database()
+ self.db.populate()
+
+ @Qt.pyqtSignature("")
+ def on_killAction_triggered (self):
+ self.queue.kill_emerge()
+
+ @Qt.pyqtSignature("")
+ def cb_saveAction_triggered (self):
+ if not am_i_root():
+ not_root_dialog(self)
+ else:
+ flags.write_use_flags()
+ flags.write_testing()
+ flags.write_masked()
+
+ @Qt.pyqtSignature("")
+ def on_syncAction_triggered (self):
+ if not am_i_root():
+ not_root_dialog(self)
+ else:
+ self.tabWidget.setCurrentIndex(self.CONSOLE_PAGE)
+ cmd = self.cfg.get("syncCmd_opt")
+
+ if cmd != "emerge --sync":
+ cmd = cmd.split()
+ self.queue.sync(cmd)
+ else:
+ self.queue.sync()
+
+ @Qt.pyqtSignature("")
+ def on_oneshotAction_triggered (self):
+ current = self.queueList.currentItem()
+
+ if self.queueTree.is_in_emerge(current) and self.queueTree.iter_has_parent(current):
+ pkg = self.queueTree.get_value(current, self.queueTree.get_cpv_column())
+
+ if not self.cfg.get_local(pkg, "oneshot_opt"):
+ set = True
+ else:
+ set = False
+
+ self.cfg.set_local(pkg, "oneshot_opt", set)
+ self.queue.append(pkg, update = True, oneshot = set, forceUpdate = True)
+
@Qt.pyqtSignature("")
@Window.watch_cursor
def on_searchBtn_clicked (self):