diff options
author | necoro <> | 2007-04-10 20:09:37 +0000 |
---|---|---|
committer | necoro <> | 2007-04-10 20:09:37 +0000 |
commit | 2d76b0ba7f6d0040c42e53df87f1ffbcbbe2cba1 (patch) | |
tree | 1afe0cf0ba9bf2316c007635eeabb4029568a1de | |
parent | f6b57b91d9af93a463b9549a6977feb48169c765 (diff) | |
download | portato-2d76b0ba7f6d0040c42e53df87f1ffbcbbe2cba1.tar.gz portato-2d76b0ba7f6d0040c42e53df87f1ffbcbbe2cba1.tar.bz2 portato-2d76b0ba7f6d0040c42e53df87f1ffbcbbe2cba1.zip |
Some more functionality for the Qt-Frontend (complete emerge)
-rw-r--r-- | portato/gui/gtk/glade/portato.glade | 385 | ||||
-rw-r--r-- | portato/gui/gtk/windows.py | 2 | ||||
-rw-r--r-- | portato/gui/gui_helper.py | 38 | ||||
-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 |
8 files changed, 347 insertions, 217 deletions
diff --git a/portato/gui/gtk/glade/portato.glade b/portato/gui/gtk/glade/portato.glade index 7735975..f862b79 100644 --- a/portato/gui/gtk/glade/portato.glade +++ b/portato/gui/gtk/glade/portato.glade @@ -401,50 +401,74 @@ <property name="n_rows">4</property> <property name="n_columns">2</property> <child> - <widget class="GtkHBox" id="checkHB"> + <widget class="GtkScrolledWindow" id="useListScroll"> <property name="visible">True</property> - <property name="spacing">1</property> - <property name="homogeneous">True</property> - <child> - <widget class="GtkCheckButton" id="installedCheck"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes">Installed</property> - <property name="draw_indicator">True</property> - <signal name="button_press_event" handler="cb_button_pressed"/> - </widget> - <packing> - <property name="fill">False</property> - </packing> - </child> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <child> - <widget class="GtkCheckButton" id="maskedCheck"> + <widget class="GtkTreeView" id="useList"> <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes">Masked</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="cb_masked_toggled"/> </widget> - <packing> - <property name="fill">False</property> - <property name="position">1</property> - </packing> </child> + </widget> + <packing> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_padding">5</property> + <property name="y_padding">5</property> + </packing> + </child> + <child> + <widget class="GtkVBox" id="comboVB"> + <property name="visible">True</property> <child> - <widget class="GtkCheckButton" id="testingCheck"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes">Testing</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="cb_testing_toggled"/> - </widget> - <packing> - <property name="fill">False</property> - <property name="position">2</property> - </packing> + <placeholder/> </child> </widget> <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options">GTK_FILL</property> + <property name="x_padding">5</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="descLabel"> + <property name="visible">True</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="wrap">True</property> + </widget> + <packing> + <property name="right_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + <property name="y_padding">10</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="missingLabel"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes"><span foreground='red'><b>MISSING KEYWORD</b></span></property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="notInSysLabel"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes"><b>Installed, but not in portage anymore</b></property> + <property name="use_markup">True</property> + </widget> + <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">1</property> @@ -507,79 +531,55 @@ </packing> </child> <child> - <widget class="GtkLabel" id="notInSysLabel"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes"><b>Installed, but not in portage anymore</b></property> - <property name="use_markup">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="missingLabel"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes"><span foreground='red'><b>MISSING KEYWORD</b></span></property> - <property name="use_markup">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="descLabel"> - <property name="visible">True</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">True</property> - </widget> - <packing> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - <property name="y_padding">10</property> - </packing> - </child> - <child> - <widget class="GtkVBox" id="comboVB"> + <widget class="GtkHBox" id="checkHB"> <property name="visible">True</property> + <property name="spacing">1</property> + <property name="homogeneous">True</property> <child> - <placeholder/> + <widget class="GtkCheckButton" id="installedCheck"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">Installed</property> + <property name="draw_indicator">True</property> + <signal name="button_press_event" handler="cb_button_pressed"/> + </widget> + <packing> + <property name="fill">False</property> + </packing> </child> - </widget> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">GTK_FILL</property> - <property name="x_padding">5</property> - </packing> - </child> - <child> - <widget class="GtkScrolledWindow" id="useListScroll"> - <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <child> - <widget class="GtkTreeView" id="useList"> + <widget class="GtkCheckButton" id="maskedCheck"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">Masked</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="cb_masked_toggled"/> + </widget> + <packing> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkCheckButton" id="testingCheck"> <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">Testing</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="cb_testing_toggled"/> </widget> + <packing> + <property name="fill">False</property> + <property name="position">2</property> + </packing> </child> </widget> <packing> + <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">5</property> - <property name="y_padding">5</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options">GTK_FILL</property> </packing> </child> </widget> @@ -904,7 +904,8 @@ </child> <child> <widget class="GtkFrame" id="systemFrame"> - <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="no_show_all">True</property> <property name="label_xalign">0</property> <child> <widget class="GtkAlignment" id="alignment6"> @@ -1089,186 +1090,186 @@ <placeholder/> </child> <child> - <widget class="GtkEntry" id="useFileEdit"> + <widget class="GtkLabel" id="maskLabel"> <property name="visible">True</property> + <property name="xalign">0</property> + <property name="xpad">5</property> + <property name="label" translatable="yes"><u><i>Masking Keywords</i></u></property> + <property name="use_markup">True</property> + <property name="single_line_mode">True</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">7</property> + <property name="bottom_attach">8</property> + <property name="y_padding">5</property> </packing> </child> <child> - <widget class="GtkLabel" id="useEditLabel"> + <widget class="GtkLabel" id="testLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">File name to use, if package.use is a directory: </property> + <property name="xpad">5</property> + <property name="label" translatable="yes"><u><i>Testing Keywords</i></u></property> + <property name="use_markup">True</property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="y_padding">5</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="usePerVersionCheck"> + <widget class="GtkLabel" id="useLabel"> <property name="visible">True</property> - <property name="label" translatable="yes">Add only exact version to package.use</property> - <property name="draw_indicator">True</property> + <property name="xalign">0</property> + <property name="xpad">5</property> + <property name="label" translatable="yes"><u><i>Use-Flags</i></u></property> + <property name="use_markup">True</property> + <property name="single_line_mode">True</property> + </widget> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_padding">6</property> + </packing> + </child> + <child> + <widget class="GtkEventBox" id="hintEB"> + <property name="visible">True</property> + <child> + <widget class="GtkFrame" id="hintFrame"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">GTK_SHADOW_OUT</property> + <child> + <widget class="GtkLabel" id="hintLabel"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes"><u>You may use the following placeholders:</u> + + <i>$(cat)</i>: category + <i>$(pkg)</i>: package name + <i>$(cat-1)/$(cat-2)</i>: first/second part of the category</property> + <property name="use_markup">True</property> + </widget> + </child> + <child> + <placeholder/> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + </child> </widget> <packing> <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="testPerVersionCheck"> + <widget class="GtkCheckButton" id="maskPerVersionCheck"> <property name="visible">True</property> - <property name="label" translatable="yes">Add only exact version to package.keywords</property> + <property name="label" translatable="yes">Add only exact version to package.mask/package.unmask</property> <property name="draw_indicator">True</property> </widget> <packing> <property name="right_attach">2</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> + <property name="top_attach">8</property> + <property name="bottom_attach">9</property> </packing> </child> <child> - <widget class="GtkLabel" id="testEditLabel"> + <widget class="GtkLabel" id="maskEditLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">File name to use, if package.keywords is a directory: </property> + <property name="label" translatable="yes">File name to use, if package.mask/package.unmask is a directory: </property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> </packing> </child> <child> - <widget class="GtkEntry" id="testFileEdit"> + <widget class="GtkEntry" id="maskFileEdit"> <property name="visible">True</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> </packing> </child> <child> - <widget class="GtkEntry" id="maskFileEdit"> + <widget class="GtkEntry" id="testFileEdit"> <property name="visible">True</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> </packing> </child> <child> - <widget class="GtkLabel" id="maskEditLabel"> + <widget class="GtkLabel" id="testEditLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">File name to use, if package.mask/package.unmask is a directory: </property> + <property name="label" translatable="yes">File name to use, if package.keywords is a directory: </property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="maskPerVersionCheck"> + <widget class="GtkCheckButton" id="testPerVersionCheck"> <property name="visible">True</property> - <property name="label" translatable="yes">Add only exact version to package.mask/package.unmask</property> + <property name="label" translatable="yes">Add only exact version to package.keywords</property> <property name="draw_indicator">True</property> </widget> <packing> <property name="right_attach">2</property> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> </packing> </child> <child> - <widget class="GtkEventBox" id="hintEB"> + <widget class="GtkCheckButton" id="usePerVersionCheck"> <property name="visible">True</property> - <child> - <widget class="GtkFrame" id="hintFrame"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - <child> - <widget class="GtkLabel" id="hintLabel"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes"><u>You may use the following placeholders:</u> - - <i>$(cat)</i>: category - <i>$(pkg)</i>: package name - <i>$(cat-1)/$(cat-2)</i>: first/second part of the category</property> - <property name="use_markup">True</property> - </widget> - </child> - <child> - <placeholder/> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - </child> + <property name="label" translatable="yes">Add only exact version to package.use</property> + <property name="draw_indicator">True</property> </widget> <packing> <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> </packing> </child> <child> - <widget class="GtkLabel" id="useLabel"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="xpad">5</property> - <property name="label" translatable="yes"><u><i>Use-Flags</i></u></property> - <property name="use_markup">True</property> - <property name="single_line_mode">True</property> - </widget> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_padding">6</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="testLabel"> + <widget class="GtkLabel" id="useEditLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="xpad">5</property> - <property name="label" translatable="yes"><u><i>Testing Keywords</i></u></property> - <property name="use_markup">True</property> + <property name="label" translatable="yes">File name to use, if package.use is a directory: </property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="y_padding">5</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> </packing> </child> <child> - <widget class="GtkLabel" id="maskLabel"> + <widget class="GtkEntry" id="useFileEdit"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="xpad">5</property> - <property name="label" translatable="yes"><u><i>Masking Keywords</i></u></property> - <property name="use_markup">True</property> - <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - <property name="y_padding">5</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> </packing> </child> </widget> diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py index 3fa39a8..e62ed52 100644 --- a/portato/gui/gtk/windows.py +++ b/portato/gui/gtk/windows.py @@ -605,7 +605,7 @@ class PackageTable: return True def cb_package_revert_clicked (self, button): - """Callback for pressed cancel-button. Closes the window.""" + """Callback for pressed revert-button.""" self.actual_package().remove_new_use_flags() self.actual_package().remove_new_masked() self.actual_package().remove_new_testing() diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py index ecc3ba6..2b8ab44 100644 --- a/portato/gui/gui_helper.py +++ b/portato/gui/gui_helper.py @@ -499,11 +499,13 @@ class EmergeQueue: sub_emerge(command) - def emerge (self, force = False): + def emerge (self, force = False, options = None): """Emerges everything in the merge-queue. @param force: If False, '-pv' is send to emerge. Default: False. - @type force: boolean""" + @type force: boolean + @param options: Additional options to send to the emerge command + @type options: string[]""" def prepare(queue): """Prepares the list of iterators and the list of packages.""" @@ -522,6 +524,7 @@ class EmergeQueue: s = system.get_oneshot_option() if not force: s += system.get_pretend_option() + if options is not None: s += options self._emerge(s, list, its) @@ -532,14 +535,17 @@ class EmergeQueue: s = [] if not force: s = system.get_pretend_option() + if options is not None: s += options self._emerge(s, list, its) - def unmerge (self, force = False): + def unmerge (self, force = False, options = None): """Unmerges everything in the umerge-queue. @param force: If False, '-pv' is send to emerge. Default: False. - @type force: boolean""" + @type force: boolean + @param options: Additional options to send to the emerge command + @type options: string[]""" if len(self.unmergequeue) == 0: return # nothing in queue @@ -548,20 +554,28 @@ class EmergeQueue: # set options s = system.get_unmerge_option() if not force: s += system.get_pretend_option() + if options is not None: s += options self._emerge(s,list, [self.unmergeIt]) - def update_world(self, force = False, newuse = False, deep = False): + def update_world(self, force = False, newuse = False, deep = False, options = None): """Does an update world. newuse and deep are the arguments handed to emerge. @param force: If False, '-pv' is send to emerge. Default: False. - @type force: boolean""" - - options = system.get_update_option() - - if newuse: options += system.get_newuse_option() - if deep: options += system.get_deep_option() - if not force: options += system.get_pretend_option() + @type force: boolean + @param newuse: If True, append newuse options + @type force: boolean + @param deep: If True, append deep options + @type deep: boolean + @param options: Additional options to send to the emerge command + @type options: string[]""" + + opts = system.get_update_option() + + if newuse: opts += system.get_newuse_option() + if deep: opts += system.get_deep_option() + if not force: opts += system.get_pretend_option() + if options is not None: opts += options self._emerge(options, ["world"], [self.emergeIt]) 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) |