diff options
Diffstat (limited to '')
-rw-r--r-- | portato/gui/qt/dialogs.py | 3 | ||||
-rw-r--r-- | portato/gui/qt/terminal.py | 20 | ||||
-rw-r--r-- | portato/gui/qt/ui/MainWindow.ui | 13 | ||||
-rw-r--r-- | portato/gui/qt/uncheckbox.py | 38 | ||||
-rw-r--r-- | portato/gui/qt/windows.py | 65 |
5 files changed, 127 insertions, 12 deletions
diff --git a/portato/gui/qt/dialogs.py b/portato/gui/qt/dialogs.py index cf32439..7b5609e 100644 --- a/portato/gui/qt/dialogs.py +++ b/portato/gui/qt/dialogs.py @@ -36,3 +36,6 @@ def remove_deps_dialog (parent): def remove_queue_dialog (parent): return QMessageBox.question(parent, "Portato", "Do you really want to clear the whole queue?", QMessageBox.Yes | QMessageBox.No) + +def changed_flags_dialog (parent, what = "flags"): + return QMessageBox.information(parent, "Portato", "You have changed %s. Portato will write these changes into the appropriate files. Please backup them if you think it is necessairy." % what, QMessageBox.Ok) diff --git a/portato/gui/qt/terminal.py b/portato/gui/qt/terminal.py index 9fbc39c..eabe467 100644 --- a/portato/gui/qt/terminal.py +++ b/portato/gui/qt/terminal.py @@ -99,21 +99,29 @@ class QtConsole (Console, QtGui.QTextEdit): def write(self, text): self.emit(QtCore.SIGNAL("doSomeWriting"), text) + def start_new_thread (self): + self.run = True + self.current = Thread(target=self.__run) + self.current.setDaemon(True) # close application even if this thread is running + self.current.start() + def set_pty (self, pty): if not self.running: self.pty = pty - - t = Thread(target=self.__run) - t.setDaemon(True) # close application even if this thread is running - t.start() - + self.start_new_thread() self.running = True + else: + # quit current thread + self.run = False + # self.current.join() self.clear() + self.pty = pty # set this after clearing to lose no chars :) + self.start_new_thread() def __run (self): - while True: + while self.run: s = read(self.pty, 1) if s == "": break diff --git a/portato/gui/qt/ui/MainWindow.ui b/portato/gui/qt/ui/MainWindow.ui index 5a8f950..f942ea7 100644 --- a/portato/gui/qt/ui/MainWindow.ui +++ b/portato/gui/qt/ui/MainWindow.ui @@ -167,11 +167,11 @@ p, li { white-space: pre-wrap; } </widget> </item> <item> - <widget class="QCheckBox" name="installedCheck" > + <widget class="UncheckBox" name="installedCheck" > <property name="sizePolicy" > <sizepolicy> - <hsizetype>3</hsizetype> - <vsizetype>0</vsizetype> + <hsizetype>13</hsizetype> + <vsizetype>13</vsizetype> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -428,6 +428,13 @@ p, li { white-space: pre-wrap; } </property> </action> </widget> + <customwidgets> + <customwidget> + <class>UncheckBox</class> + <extends>QCheckBox</extends> + <header>portato/gui/qt/uncheckbox.h</header> + </customwidget> + </customwidgets> <resources/> <connections> <connection> diff --git a/portato/gui/qt/uncheckbox.py b/portato/gui/qt/uncheckbox.py new file mode 100644 index 0000000..d87fb06 --- /dev/null +++ b/portato/gui/qt/uncheckbox.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# +# File: portato/gui/qt/uncheckbox.py +# This file is part of the Portato-Project, a graphical portage-frontend. +# +# Copyright (C) 2007 René 'Necoro' Neumann +# This is free software. You may redistribute copies of it under the terms of +# the GNU General Public License version 2. +# There is NO WARRANTY, to the extent permitted by law. +# +# Written by René 'Necoro' Neumann <necoro@necoro.net> + +from PyQt4.QtGui import QCheckBox +from PyQt4.QtCore import Qt + +class UncheckBox (QCheckBox): + """A checkbox which looks like a normal one, but cannot be checked by the user. + Focusing and hovering are disabled too.""" + + def __init__ (self, *args): + QCheckBox.__init__(self, *args) + self.setFocusPolicy(Qt.NoFocus) + + def mousePressEvent (self, event): + if event.button() == Qt.LeftButton: # ignore leftbutton clicks + pass + else: + QCheckBox.mousePressEvent(self, event) + + def keyPressEvent (self, event): + if event.key() == Qt.Key_Space: # ignore space + pass + else: + QCheckBox.keyPressEvent(self, event) + + def enterEvent (self, event): + # disable hovering - this is set to True somewhere I cannot fix ;) + self.setAttribute(Qt.WA_Hover, False) diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py index e6fc7bc..46d9ec6 100644 --- a/portato/gui/qt/windows.py +++ b/portato/gui/qt/windows.py @@ -86,8 +86,8 @@ class SearchDialog (Window): @type parent: QtGui.QWidget @param list: list of results to show @type list: string[] - @param jump_to: function to call if "OK"-Button is hit - @type jump_to: function(string)""" + @param jumpTo: function to call if "OK"-Button is hit + @type jumpTo: function(string)""" Window.__init__(self, parent) @@ -109,8 +109,16 @@ class PackageDetails: self.window.pkgTab.setHidden(True) self.window.tabWidget.removeTab(0) + self.window.installedCheck.blockSignals(True) + QtCore.QObject.connect(self.window.versCombo, QtCore.SIGNAL("currentIndexChanged(int)"), self.cb_combo_changed) + QtCore.QObject.connect(self.window.pkgEmergeBtn, QtCore.SIGNAL("clicked()"), self.cb_emerge_clicked) + QtCore.QObject.connect(self.window.pkgUnmergeBtn, QtCore.SIGNAL("clicked()"), self.cb_unmerge_clicked) + QtCore.QObject.connect(self.window.pkgRevertBtn, QtCore.SIGNAL("clicked()"), self.cb_revert_clicked) + + #QtCore.QObject.connect(self.window.maskedCheck, QtCore.SIGNAL("clicked(bool)"), self.cb_masked_clicked) + #QtCore.QObject.connect(self.window.testingCheck, QtCore.SIGNAL("clicked(bool)"), self.cb_testing_clicked) def update (self, cp, queue = None, version = None, doEmerge = True, instantChange = False): """Updates the table to show the contents for the package. @@ -237,7 +245,26 @@ class PackageDetails: self.window.tabWidget.setCurrentIndex(self.window.QUEUE_PAGE) return True - def cb_combo_changed (self, combo): + def cb_unmerge_clicked (self): + """Callback for pressed unmerge-button. Adds the package to the EmergeQueue.""" + if not am_i_root(): + not_root_dialog(self.window) + else: + self._update_keywords(False) + self.window.tabWidget.setCurrentIndex(self.window.QUEUE_PAGE) + return True + + def cb_revert_clicked (self, button): + """Callback for pressed revert-button.""" + self.actual_package().remove_new_use_flags() + self.actual_package().remove_new_masked() + self.actual_package().remove_new_testing() + self.cb_combo_changed() + if self.instantChange: + self._update_keywords(True, update = True) + return True + + def cb_combo_changed (self): """Callback for the changed ComboBox. It then rebuilds the useList and the checkboxes.""" @@ -419,6 +446,38 @@ class MainWindow (Window): self.queue.remove_with_children(selected) self.doUpdate = False + @QtCore.pyqtSignature("") + def on_emergeBtn_clicked (self): + """Do emerge.""" + + self.tabWidget.setCurrentIndex(self.CONSOLE_PAGE) + + if len(flags.newUseFlags) > 0: + changed_flags_dialog(self, "use flags") + flags.write_use_flags() + + if len(flags.new_masked)>0 or len(flags.new_unmasked)>0 or len(flags.newTesting)>0: + debug("new masked:",flags.new_masked) + debug("new unmasked:", flags.new_unmasked) + debug("new testing:", flags.newTesting) + changed_flags_dialog(self, "masking keywords") + flags.write_masked() + flags.write_testing() + system.reload_settings() + + if not self.doUpdate: + self.queue.emerge(force=True, options = ["--nospinner"]) + else: + self.queue.update_world(force=True, newuse = self.cfg.get_boolean("newuse_opt"), deep = self.cfg.get_boolean("deep_opt"), options = ["--nospinner"]) + self.doUpdate = False + + @QtCore.pyqtSignature("") + def on_unmergeBtn_clicked (self): + """Do unmerge.""" + + self.tabWidget.setCurrentIndex(self.CONSOLE_PAGE) + self.queue.unmerge(force = True) + def cb_cat_list_selected (self, index, prev): self.selCatName = str(index.data().toString()) self.fill_pkg_list(self.selCatName) |