summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/gui/gtk/glade/portato.glade382
-rw-r--r--portato/gui/gtk/windows.py4
-rw-r--r--portato/gui/qt/__init__.py4
-rw-r--r--portato/gui/qt/helper.py22
-rw-r--r--portato/gui/qt/terminal.py34
-rw-r--r--portato/gui/qt/tree.py63
-rw-r--r--portato/gui/qt/ui/MainWindow.ui18
-rw-r--r--portato/gui/qt/ui/PreferenceWindow.ui273
-rw-r--r--portato/gui/qt/windows.py189
9 files changed, 710 insertions, 279 deletions
diff --git a/portato/gui/gtk/glade/portato.glade b/portato/gui/gtk/glade/portato.glade
index f862b79..0ac888e 100644
--- a/portato/gui/gtk/glade/portato.glade
+++ b/portato/gui/gtk/glade/portato.glade
@@ -401,72 +401,48 @@
<property name="n_rows">4</property>
<property name="n_columns">2</property>
<child>
- <widget class="GtkScrolledWindow" id="useListScroll">
+ <widget class="GtkHBox" id="checkHB">
<property name="visible">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="spacing">1</property>
+ <property name="homogeneous">True</property>
<child>
- <widget class="GtkTreeView" id="useList">
+ <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="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>
- <placeholder/>
+ <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="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">&lt;span foreground='red'&gt;&lt;b&gt;MISSING KEYWORD&lt;/b&gt;&lt;/span&gt;</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">&lt;b&gt;Installed, but not in portage anymore&lt;/b&gt;</property>
- <property name="use_markup">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -531,55 +507,79 @@
</packing>
</child>
<child>
- <widget class="GtkHBox" id="checkHB">
+ <widget class="GtkLabel" id="notInSysLabel">
+ <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Installed, but not in portage anymore&lt;/b&gt;</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">&lt;span foreground='red'&gt;&lt;b&gt;MISSING KEYWORD&lt;/b&gt;&lt;/span&gt;</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">
<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>
<child>
- <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>
+ <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="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="GtkCheckButton" id="testingCheck">
+ <widget class="GtkTreeView" id="useList">
<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">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options">GTK_FILL</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>
</widget>
@@ -1090,186 +1090,186 @@
<placeholder/>
</child>
<child>
- <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">&lt;u&gt;&lt;i&gt;Masking Keywords&lt;/i&gt;&lt;/u&gt;</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>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="testLabel">
+ <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">&lt;u&gt;&lt;i&gt;Testing Keywords&lt;/i&gt;&lt;/u&gt;</property>
- <property name="use_markup">True</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="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="useLabel">
+ <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">&lt;u&gt;&lt;i&gt;Use-Flags&lt;/i&gt;&lt;/u&gt;</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">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_padding">6</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</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">&lt;u&gt;You may use the following placeholders:&lt;/u&gt;
-
- &lt;i&gt;$(cat)&lt;/i&gt;: category
- &lt;i&gt;$(pkg)&lt;/i&gt;: package name
- &lt;i&gt;$(cat-1)/$(cat-2)&lt;/i&gt;: 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="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="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="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="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="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="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="GtkCheckButton" id="usePerVersionCheck">
+ <widget class="GtkEventBox" id="hintEB">
<property name="visible">True</property>
- <property name="label" translatable="yes">Add only exact version to package.use</property>
- <property name="draw_indicator">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">&lt;u&gt;You may use the following placeholders:&lt;/u&gt;
+
+&lt;i&gt;$(cat)&lt;/i&gt;: category
+&lt;i&gt;$(pkg)&lt;/i&gt;: package name
+&lt;i&gt;$(cat-1)/$(cat-2)&lt;/i&gt;: 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="GtkLabel" id="useEditLabel">
+ <widget class="GtkLabel" id="useLabel">
<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">&lt;u&gt;&lt;i&gt;Use-Flags&lt;/i&gt;&lt;/u&gt;</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">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_padding">6</property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="useFileEdit">
+ <widget class="GtkLabel" id="testLabel">
<property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes">&lt;u&gt;&lt;i&gt;Testing Keywords&lt;/i&gt;&lt;/u&gt;</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">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="y_padding">5</property>
+ </packing>
+ </child>
+ <child>
+ <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">&lt;u&gt;&lt;i&gt;Masking Keywords&lt;/i&gt;&lt;/u&gt;</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>
</packing>
</child>
</widget>
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index f70d2bb..d2151ab 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -932,8 +932,8 @@ class MainWindow (Window):
store = self.queueTree
if len(path) > 1:
iterator = store.get_original().get_iter(path)
- if store.is_in_emerge(iterator):
- package = store.get_value(iterator, 0)
+ if store.iter_has_parent(iterator):
+ package = store.get_value(iterator, store.get_cpv_column())
cat, name, vers, rev = system.split_cpv(package)
if rev != "r0": vers = vers+"-"+rev
self.show_package(cat+"/"+name, queue = self.queue, version = vers, instantChange = True, doEmerge = False)
diff --git a/portato/gui/qt/__init__.py b/portato/gui/qt/__init__.py
index c714757..df49473 100644
--- a/portato/gui/qt/__init__.py
+++ b/portato/gui/qt/__init__.py
@@ -10,8 +10,10 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from PyQt4.Qt import QApplication
from windows import MainWindow
def run():
+ app = QApplication([])
m = MainWindow()
- m.main()
+ app.exec_()
diff --git a/portato/gui/qt/helper.py b/portato/gui/qt/helper.py
new file mode 100644
index 0000000..1b7dbdc
--- /dev/null
+++ b/portato/gui/qt/helper.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+#
+# File: portato/gui/qt/helper.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 import Qt
+
+def qCheck (check):
+ if check:
+ return Qt.Qt.Checked
+ else:
+ return Qt.Qt.Unchecked
+
+def qIsChecked (check):
+ return check == Qt.Qt.Checked
diff --git a/portato/gui/qt/terminal.py b/portato/gui/qt/terminal.py
index eabe467..fd01e05 100644
--- a/portato/gui/qt/terminal.py
+++ b/portato/gui/qt/terminal.py
@@ -10,7 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from PyQt4 import QtGui, QtCore
+from PyQt4 import Qt
from threading import Thread, Lock
from os import read
@@ -18,24 +18,24 @@ from os import read
from portato.gui.wrapper import Console
from portato.helper import debug
-class BoldFormat (QtGui.QTextCharFormat):
+class BoldFormat (Qt.QTextCharFormat):
def __init__(self):
- QtGui.QTextCharFormat.__init__(self)
- self.setFontWeight(QtGui.QFont.Bold)
+ Qt.QTextCharFormat.__init__(self)
+ self.setFontWeight(Qt.QFont.Bold)
-class UnderlineFormat (QtGui.QTextCharFormat):
+class UnderlineFormat (Qt.QTextCharFormat):
def __init__(self):
- QtGui.QTextCharFormat.__init__(self)
+ Qt.QTextCharFormat.__init__(self)
self.setFontUnderline(True)
-class ColorFormat (QtGui.QTextCharFormat):
+class ColorFormat (Qt.QTextCharFormat):
def __init__(self, color):
- QtGui.QTextCharFormat.__init__(self)
+ Qt.QTextCharFormat.__init__(self)
- self.setForeground(QtGui.QBrush(QtGui.QColor(color)))
+ self.setForeground(Qt.QBrush(Qt.QColor(color)))
# we only support a subset of the commands
esc_seq = ("\x1b", "[")
@@ -60,10 +60,10 @@ attr[36] = ColorFormat("cyan")
attr[37] = ColorFormat("white")
attr[39] = None # default
-class QtConsole (Console, QtGui.QTextEdit):
+class QtConsole (Console, Qt.QTextEdit):
def __init__ (self, parent):
- QtGui.QTextEdit.__init__(self, parent)
+ Qt.QTextEdit.__init__(self, parent)
self.pty = None
self.running = False
@@ -74,8 +74,8 @@ class QtConsole (Console, QtGui.QTextEdit):
self.setReadOnly(True)
- QtCore.QObject.connect(self, QtCore.SIGNAL("doSomeWriting"), self._write)
- QtCore.QObject.connect(self, QtCore.SIGNAL("deletePrevChar()"), self._deletePrev)
+ Qt.QObject.connect(self, Qt.SIGNAL("doSomeWriting"), self._write)
+ Qt.QObject.connect(self, Qt.SIGNAL("deletePrevChar()"), self._deletePrev)
def _deletePrev (self):
self.textCursor().deletePreviousChar()
@@ -87,7 +87,7 @@ class QtConsole (Console, QtGui.QTextEdit):
if not self.textCursor().atEnd(): # move cursor and re-set format
f = self.currentCharFormat()
- self.moveCursor(QtGui.QTextCursor.End)
+ self.moveCursor(Qt.QTextCursor.End)
self.setCurrentCharFormat(f)
# insert the text
@@ -97,7 +97,7 @@ class QtConsole (Console, QtGui.QTextEdit):
self.ensureCursorVisible()
def write(self, text):
- self.emit(QtCore.SIGNAL("doSomeWriting"), text)
+ self.emit(Qt.SIGNAL("doSomeWriting"), text)
def start_new_thread (self):
self.run = True
@@ -126,7 +126,7 @@ class QtConsole (Console, QtGui.QTextEdit):
if s == "": break
if ord(s) == backspace:
- self.emit(QtCore.SIGNAL("deletePrevChar()"))
+ self.emit(Qt.SIGNAL("deletePrevChar()"))
continue
if s == esc_seq[0]: # -> 0x27
@@ -198,4 +198,4 @@ class QtConsole (Console, QtGui.QTextEdit):
return f
def virgin_format (self):
- return QtGui.QTextCharFormat(self.stdFormat)
+ return Qt.QTextCharFormat(self.stdFormat)
diff --git a/portato/gui/qt/tree.py b/portato/gui/qt/tree.py
index fd616b6..a8c3e66 100644
--- a/portato/gui/qt/tree.py
+++ b/portato/gui/qt/tree.py
@@ -10,9 +10,12 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from PyQt4 import QtGui, QtCore
+from PyQt4 import Qt
from portato.gui.wrapper import Tree
+from portato.helper import debug
+from portato.backend import system # for the tooltips
+
class QtTree (Tree):
def __init__ (self, treeWidget, col = 0):
@@ -20,8 +23,8 @@ class QtTree (Tree):
self.tree = treeWidget
self.col = col
- self.emergeIt = QtGui.QTreeWidgetItem(self.tree, ["Emerge", ""])
- self.unmergeIt = QtGui.QTreeWidgetItem(self.tree, ["Unmerge", ""])
+ self.emergeIt = Qt.QTreeWidgetItem(self.tree, ["Emerge", ""])
+ self.unmergeIt = Qt.QTreeWidgetItem(self.tree, ["Unmerge", ""])
def build_append_value (self, cpv, oneshot = False, update = False, version = None):
string = ""
@@ -65,7 +68,7 @@ class QtTree (Tree):
return (it.childCount() > 0)
def next_iter (self, it):
- iter = QtGui.QTreeWidgetItemIterator(it)
+ iter = Qt.QTreeWidgetItemIterator(it)
iter += 1 # next iter ...
return iter.value()
@@ -82,8 +85,10 @@ class QtTree (Tree):
if parent is None:
parent = self.tree
-
- return QtGui.QTreeWidgetItem(parent, values)
+
+ item = Qt.QTreeWidgetItem(parent, values)
+ self.make_tooltip(item)
+ return item
def remove (self, it):
# a somehow strange approach ;) - go to the parent and delete the child
@@ -96,4 +101,50 @@ class QtTree (Tree):
def get_cpv_column (self):
return self.col
+
+ def make_tooltip (self, item):
+ tooltip = self.__get_flags(str(item.text(0)))
+ item.setToolTip(self.col, tooltip)
+
+ def __get_flags(self, cpv):
+
+ try:
+ pkg = system.new_package(cpv)
+ except ValueError: # no CPV
+ return ""
+
+ enabled = []
+ disabled = []
+ expanded = set()
+
+ pkg_flags = pkg.get_all_use_flags()
+ if not pkg_flags: # no flags - stop here
+ return ""
+
+ pkg_flags.sort()
+ for use in pkg_flags:
+ exp = pkg.use_expanded(use)
+ if exp:
+ expanded.add(exp)
+
+ else:
+ if pkg.is_use_flag_enabled(use):
+ enabled.append(use)
+ else:
+ disabled.append(use)
+
+ string = ""
+
+ if enabled:
+ string = "<b>+%s</b>" % ("<br>+".join(enabled),)
+ if len(disabled) > 0:
+ string = string + "<br>"
+
+ if disabled:
+ string = string+"<i>- %s</i>" % ("<br>- ".join(disabled),)
+
+ if expanded:
+ string = string+"<br><br>"+"<br>".join(expanded)
+
+ return string
diff --git a/portato/gui/qt/ui/MainWindow.ui b/portato/gui/qt/ui/MainWindow.ui
index 2830291..14127c9 100644
--- a/portato/gui/qt/ui/MainWindow.ui
+++ b/portato/gui/qt/ui/MainWindow.ui
@@ -394,12 +394,6 @@ p, li { white-space: pre-wrap; }
<height>31</height>
</rect>
</property>
- <widget class="QMenu" name="menuFile" >
- <property name="title" >
- <string>&amp;File</string>
- </property>
- <addaction name="quitAction" />
- </widget>
<widget class="QMenu" name="menuHelp" >
<property name="title" >
<string>&amp;?</string>
@@ -415,6 +409,13 @@ p, li { white-space: pre-wrap; }
<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" />
+ </widget>
<addaction name="menuFile" />
<addaction name="menu_Emerge" />
<addaction name="menuHelp" />
@@ -455,6 +456,11 @@ p, li { white-space: pre-wrap; }
<string>Update &amp;World</string>
</property>
</action>
+ <action name="prefAction" >
+ <property name="text" >
+ <string>&amp;Preferences</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
diff --git a/portato/gui/qt/ui/PreferenceWindow.ui b/portato/gui/qt/ui/PreferenceWindow.ui
new file mode 100644
index 0000000..f65c2fa
--- /dev/null
+++ b/portato/gui/qt/ui/PreferenceWindow.ui
@@ -0,0 +1,273 @@
+<ui version="4.0" >
+ <class>PreferencesWindow</class>
+ <widget class="QDialog" name="PreferencesWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>582</width>
+ <height>706</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Preferences</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="generalBox" >
+ <property name="title" >
+ <string>General Options</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignLeading</set>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="debugCheck" >
+ <property name="text" >
+ <string>Debug</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="syncBox" >
+ <property name="title" >
+ <string>Sync Options</string>
+ </property>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Sync command:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="syncCmdEdit" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="updateBox" >
+ <property name="title" >
+ <string>Update World Options</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="deepCheck" >
+ <property name="text" >
+ <string>--deep</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="newUseCheck" >
+ <property name="text" >
+ <string>--newuse</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="flagBox" >
+ <property name="title" >
+ <string>Use Flag and Keyword Options</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="7" column="0" >
+ <widget class="QLabel" name="label_7" >
+ <property name="text" >
+ <string>&lt;u>&lt;i>Masking Keywords&lt;/u>&lt;/i></string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>&lt;i>&lt;u>Use Flags&lt;/u>&lt;/i></string>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="1" >
+ <widget class="QLineEdit" name="maskEdit" >
+ <property name="text" >
+ <string>portato</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" >
+ <widget class="QCheckBox" name="testingCheck" >
+ <property name="text" >
+ <string>Add only exact version to package.keywords</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" >
+ <widget class="QLabel" name="label_6" >
+ <property name="text" >
+ <string>File name to use, if package.keywords is a directory</string>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="0" >
+ <widget class="QLabel" name="label_8" >
+ <property name="text" >
+ <string>File name to use if package.mask/.unmask is a directory</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QCheckBox" name="useCheck" >
+ <property name="text" >
+ <string>Add only exact version to package.use</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QLineEdit" name="useEdit" >
+ <property name="text" >
+ <string>portato</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="label_5" >
+ <property name="text" >
+ <string>&lt;i>&lt;u>Testing Keywords&lt;/u>&lt;/i></string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="label_4" >
+ <property name="text" >
+ <string>File name to use, if package.use is a directory</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0" >
+ <widget class="QCheckBox" name="maskCheck" >
+ <property name="text" >
+ <string>Add only exact version to package.mask/.unmask</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1" >
+ <widget class="QLineEdit" name="testingEdit" >
+ <property name="text" >
+ <string>portato</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="hintLabel" >
+ <property name="autoFillBackground" >
+ <bool>true</bool>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal; text-decoration:none;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" text-decoration: underline;">You may use the following placeholders:&lt;/span> &lt;/p>
+&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;/p>
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-style:italic;">$(cat)&lt;/span>: category&lt;/p>
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-style:italic;">$(pkg)&lt;/span>: package name&lt;/p>
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-style:italic;">$(cat-1)/$(cat-2)&lt;/span>: first/second part of the category&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ </property>
+ <property name="centerButtons" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>PreferencesWindow</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>227</x>
+ <y>676</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>PreferencesWindow</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>295</x>
+ <y>682</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py
index 4c62d8f..3b1de2b 100644
--- a/portato/gui/qt/windows.py
+++ b/portato/gui/qt/windows.py
@@ -11,7 +11,7 @@
# Written by René 'Necoro' Neumann <necoro@necoro.net>
# qt4
-from PyQt4 import QtGui, uic, QtCore
+from PyQt4 import Qt, uic
import sip
# our backend stuff
@@ -26,20 +26,11 @@ from portato.gui.gui_helper import Database, Config, EmergeQueue
from terminal import QtConsole
from tree import QtTree
from dialogs import *
+from helper import qCheck, qIsChecked
-UI_DIR = DATA_DIR+"ui/"
-
-#XXX: global variables are bad
-app = QtGui.QApplication([])
+import types
-def qCheck (check):
- if check:
- return QtCore.Qt.Checked
- else:
- return QtCore.Qt.Unchecked
-
-def qIsChecked (check):
- return check == QtCore.Qt.Checked
+UI_DIR = DATA_DIR+"ui/"
class WindowMeta (sip.wrappertype, type):
@@ -54,7 +45,7 @@ class WindowMeta (sip.wrappertype, type):
del dict["_bases"]
super(WindowMeta, cls).__init__(name, b+bases, dict)
-class Window:
+class Window (object):
def __init__(self, parent = None):
self._qt_base.__init__(self, parent)
@@ -66,11 +57,11 @@ class Window:
def wrapper (*args, **kwargs):
ret = None
- QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
+ Qt.QApplication.setOverrideCursor(Qt.Qt.WaitCursor)
try:
ret = func(*args, **kwargs)
finally:
- QtGui.QApplication.restoreOverrideCursor()
+ Qt.QApplication.restoreOverrideCursor()
return ret
@@ -102,7 +93,7 @@ class SearchDialog (Window):
"""Constructor.
@param parent: parent-window
- @type parent: QtGui.QWidget
+ @type parent: Qt.QWidget
@param list: list of results to show
@type list: string[]
@param jumpTo: function to call if "OK"-Button is hit
@@ -114,13 +105,87 @@ class SearchDialog (Window):
self.comboBox.setCurrentIndex(0)
self.jumpTo = jumpTo
- QtCore.QObject.connect(self, QtCore.SIGNAL("accepted()"), self.finish)
+ Qt.QObject.connect(self, Qt.SIGNAL("accepted()"), self.finish)
def finish (self):
s = str(self.comboBox.currentText())
self.done(0)
self.jumpTo(s)
+class PreferenceWindow (Window):
+ """Window displaying some preferences."""
+
+ __metaclass__ = WindowMeta
+
+ # all checkboxes in the window
+ # widget name -> option name
+ checkboxes = {
+ "debugCheck" : "debug_opt",
+ "deepCheck" : "deep_opt",
+ "newUseCheck" : "newuse_opt",
+ "maskCheck" : "maskPerVersion_opt",
+ "useCheck" : "usePerVersion_opt",
+ "testingCheck" : "testingPerVersion_opt"
+ }
+
+ # all edits in the window
+ # widget name -> option name
+ edits = {
+ "maskEdit" : "maskFile_opt",
+ "testingEdit" : "testingFile_opt",
+ "useEdit" : "useFile_opt",
+ "syncCmdEdit" : "syncCmd_opt"
+ }
+
+ def __init__ (self, parent, cfg):
+
+ Window.__init__(self, parent)
+
+ self.cfg = cfg
+
+ palette = self.hintLabel.palette()
+ palette.setColor(Qt.QPalette.Active, Qt.QPalette.Window, Qt.QColor(Qt.Qt.yellow))
+ self.hintLabel.setPalette(palette)
+
+ # the checkboxes
+ for box in self.checkboxes:
+ val = self.checkboxes[box]
+ box = self.__getattribute__(box)
+ if type(val) == types.TupleType:
+ box.setCheckState(qCheck(self.cfg.get_boolean(val[0], section = self.cfg.const[val[1]])))
+ else:
+ box.setCheckState(qCheck(self.cfg.get_boolean(val)))
+
+ # the edits
+ for edit in self.edits:
+ _edit = self.__getattribute__(edit)
+ _edit.setText(self.cfg.get(self.edits[edit]))
+
+ Qt.QObject.connect(self, Qt.SIGNAL("accepted()"), self.finish)
+
+ def _save (self):
+ """Sets all options in the Config-instance."""
+
+ for box in self.checkboxes:
+ val = self.checkboxes[box]
+ box = self.__getattribute__(box)
+ if type(val) == types.TupleType:
+ self.cfg.set_boolean(val[0], qIsChecked(box.checkState()), section = self.cfg.const[val[1]])
+ else:
+ self.cfg.set_boolean(val, qIsChecked(box.checkState()))
+
+ for edit in self.edits:
+ _edit = self.__getattribute__(edit)
+ self.cfg.set(self.edits[edit], _edit.text())
+
+ def finish (self):
+ """Saves and writes to config-file."""
+ self._save()
+ try:
+ self.cfg.write()
+ except IOError, e:
+ io_ex_dialog(self, e)
+
class PackageDetails:
def __init__ (self, window):
@@ -131,21 +196,21 @@ class PackageDetails:
self.window.installedCheck.blockSignals(True)
# combo
- QtCore.QObject.connect(self.window.versCombo, QtCore.SIGNAL("currentIndexChanged(int)"), self.cb_combo_changed)
+ Qt.QObject.connect(self.window.versCombo, Qt.SIGNAL("currentIndexChanged(int)"), self.cb_combo_changed)
# buttons
- 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)
+ Qt.QObject.connect(self.window.pkgEmergeBtn, Qt.SIGNAL("clicked()"), self.cb_emerge_clicked)
+ Qt.QObject.connect(self.window.pkgUnmergeBtn, Qt.SIGNAL("clicked()"), self.cb_unmerge_clicked)
+ Qt.QObject.connect(self.window.pkgRevertBtn, Qt.SIGNAL("clicked()"), self.cb_revert_clicked)
# checkboxes
- 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)
+ Qt.QObject.connect(self.window.maskedCheck, Qt.SIGNAL("clicked(bool)"), self.cb_masked_clicked)
+ Qt.QObject.connect(self.window.testingCheck, Qt.SIGNAL("clicked(bool)"), self.cb_testing_clicked)
# useflags
- QtCore.QObject.connect(self.window.useList, QtCore.SIGNAL("itemClicked(QTreeWidgetItem*, int)"), self.cb_use_flag_changed)
+ Qt.QObject.connect(self.window.useList, Qt.SIGNAL("itemClicked(QTreeWidgetItem*, int)"), self.cb_use_flag_changed)
- def update (self, cp, queue = None, version = None, doEmerge = True, instantChange = False):
+ def update (self, cp, queue = None, version = None, doEmerge = True, instantChange = None):
"""Updates the table to show the contents for the package.
@param cp: the selected package
@@ -156,8 +221,8 @@ class PackageDetails:
@type version: string
@param doEmerge: if False, the emerge buttons are disabled
@type doEmerge: False
- @param instantChange: if True the changed keywords are updated instantly
- @type instantChange: boolean"""
+ @param instantChange: if not None, the item given is updated immediatly
+ @type instantChange: Qt.QTreeWidgetItem"""
self.cp = cp
self.version = version
@@ -227,13 +292,13 @@ class PackageDetails:
exp = pkg.use_expanded(use, suggest = actual_exp)
if exp is not None:
if exp != actual_exp:
- actual_exp_it = QtGui.QTreeWidgetItem(self.window.useList, ["", exp, ""])
+ actual_exp_it = Qt.QTreeWidgetItem(self.window.useList, ["", exp, ""])
actual_exp = exp
else:
actual_exp_it = self.window.useList
actual_exp = None
- item = QtGui.QTreeWidgetItem(actual_exp_it, ["", use, system.get_use_desc(use, self.cp)])
+ item = Qt.QTreeWidgetItem(actual_exp_it, ["", use, system.get_use_desc(use, self.cp)])
item.setCheckState(0, qCheck(pkg.is_use_flag_enabled(use)))
def _update_keywords (self, emerge, update = False):
@@ -242,7 +307,7 @@ class PackageDetails:
try:
self.queue.append(self.actual_package().get_cpv(), unmerge = False, update = update)
except PackageNotFoundException, e:
- if unmask_dialog(self.window, e[0]) == QtGui.QMessageBox.Yes :
+ if unmask_dialog(self.window, e[0]) == Qt.QMessageBox.Yes :
self.queue.append(self.actual_package().get_cpv(), unmerge = False, unmask = True, update = update)
except BlockedException, e:
blocked_dialog(self.window, e[0], e[1])
@@ -361,6 +426,7 @@ class PackageDetails:
pkg.set_use_flag(prefix+flag)
if self.instantChange:
self._update_keywords(True, update = True)
+ self.window.queueTree.make_tooltip(self.instantChange)
def cb_combo_changed (self):
"""Callback for the changed ComboBox.
@@ -370,8 +436,8 @@ class PackageDetails:
self.build_use_list()
pkg = self.actual_package()
- shown = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
- hidden = QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Fixed)
+ shown = Qt.QSizePolicy(Qt.QSizePolicy.MinimumExpanding, Qt.QSizePolicy.Fixed)
+ hidden = Qt.QSizePolicy(Qt.QSizePolicy.Ignored, Qt.QSizePolicy.Fixed)
#
# rebuild the buttons and checkboxes in all the different manners which are possible
@@ -459,23 +525,25 @@ class MainWindow (Window):
# the two lists
self.build_pkg_list()
self.build_cat_list()
- QtCore.QObject.connect(self.selCatListModel, QtCore.SIGNAL("currentChanged(QModelIndex, QModelIndex)"), self.cb_cat_list_selected)
- QtCore.QObject.connect(self.selPkgListModel, QtCore.SIGNAL("currentChanged(QModelIndex, QModelIndex)"), self.cb_pkg_list_selected)
+ 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)
# build console
self.console = QtConsole(self.consoleTab)
- self.consoleLayout = QtGui.QVBoxLayout()
+ self.consoleLayout = Qt.QVBoxLayout()
self.consoleLayout.setMargin(0)
self.consoleLayout.setSpacing(0)
self.consoleTab.setLayout(self.consoleLayout)
self.consoleLayout.addWidget(self.console)
- QtCore.QObject.connect(self, QtCore.SIGNAL("doTitleUpdate"), self._title_update)
+ Qt.QObject.connect(self, Qt.SIGNAL("doTitleUpdate"), self._title_update)
# build queueList
self.queueList.setHeaderLabels(["Package", "Additional infos"])
self.queueTree = QtTree(self.queueList)
- QtCore.QObject.connect(self.queueList.model(), QtCore.SIGNAL("rowsInserted (const QModelIndex&, int, int)"), self.cb_queue_list_items_added)
- QtCore.QObject.connect(self.queueList, QtCore.SIGNAL("expanded (const QModelIndex&)"), self.cb_queue_list_items_added)
+ Qt.QObject.connect(self.queueList.model(), Qt.SIGNAL("rowsInserted (const QModelIndex&, int, int)"), self.cb_queue_list_items_added)
+ Qt.QObject.connect(self.queueList, Qt.SIGNAL("expanded (const QModelIndex&)"), self.cb_queue_list_items_added)
+ Qt.QObject.connect(self.queueList, Qt.SIGNAL("itemActivated (QTreeWidgetItem*, int)"), self.cb_queue_list_item_selected)
+ Qt.QObject.connect(self.queueList, Qt.SIGNAL("itemDoubleClicked (QTreeWidgetItem*, int)"), self.cb_queue_list_item_selected)
# set emerge queue
self.queue = EmergeQueue(console = self.console, tree = self.queueTree, db = self.db, title_update = self.title_update)
@@ -483,7 +551,7 @@ class MainWindow (Window):
self.show()
def title_update (self, title):
- self.emit(QtCore.SIGNAL("doTitleUpdate"), title)
+ self.emit(Qt.SIGNAL("doTitleUpdate"), title)
def _title_update (self, title):
if title == None: title = "Console"
@@ -499,24 +567,28 @@ class MainWindow (Window):
self.pkgListModel.setStringList([name for (name,inst) in self.db.get_cat(cat)])
def build_pkg_list (self):
- self.pkgListModel = QtGui.QStringListModel([])
+ self.pkgListModel = Qt.QStringListModel([])
self.pkgListModel.sort(0)
- self.selPkgListModel = QtGui.QItemSelectionModel(self.pkgListModel)
+ self.selPkgListModel = Qt.QItemSelectionModel(self.pkgListModel)
self.pkgList.setModel(self.pkgListModel)
self.pkgList.setSelectionModel(self.selPkgListModel)
def build_cat_list (self):
- self.catListModel = QtGui.QStringListModel(system.list_categories())
+ self.catListModel = Qt.QStringListModel(system.list_categories())
self.catListModel.sort(0)
- self.selCatListModel = QtGui.QItemSelectionModel(self.catListModel)
+ self.selCatListModel = Qt.QItemSelectionModel(self.catListModel)
self.catList.setModel(self.catListModel)
self.catList.setSelectionModel(self.selCatListModel)
- @QtCore.pyqtSignature("")
+ @Qt.pyqtSignature("")
def on_aboutAction_triggered (self):
AboutDialog(self).exec_()
- @QtCore.pyqtSignature("")
+ @Qt.pyqtSignature("")
+ def on_prefAction_triggered (self):
+ PreferenceWindow(self, self.cfg).exec_()
+
+ @Qt.pyqtSignature("")
@Window.watch_cursor
def on_searchBtn_clicked (self):
"""Do a search."""
@@ -532,7 +604,7 @@ class MainWindow (Window):
else:
SearchDialog(self, packages, self.jump_to).exec_()
- @QtCore.pyqtSignature("")
+ @Qt.pyqtSignature("")
def on_removeBtn_clicked (self):
"""Removes a selected item in the (un)emerge-queue if possible."""
selected = self.queueList.currentItem()
@@ -540,7 +612,7 @@ class MainWindow (Window):
if selected:
if not selected.parent(): # top-level
if self.queueTree.iter_has_children(selected): # and has children which can be removed :)
- if remove_queue_dialog(self) == QtGui.QMessageBox.Yes :
+ if remove_queue_dialog(self) == Qt.QMessageBox.Yes :
self.queue.remove_children(selected)
self.doUpdate = False
@@ -550,7 +622,7 @@ class MainWindow (Window):
self.queue.remove_with_children(selected)
self.doUpdate = False
- @QtCore.pyqtSignature("")
+ @Qt.pyqtSignature("")
def on_emergeBtn_clicked (self):
"""Do emerge."""
@@ -575,14 +647,14 @@ class MainWindow (Window):
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("")
+ @Qt.pyqtSignature("")
def on_unmergeBtn_clicked (self):
"""Do unmerge."""
self.tabWidget.setCurrentIndex(self.CONSOLE_PAGE)
self.queue.unmerge(force = True)
- @QtCore.pyqtSignature("")
+ @Qt.pyqtSignature("")
@Window.watch_cursor
def on_updateBtn_clicked (self):
if not am_i_root():
@@ -597,7 +669,7 @@ class MainWindow (Window):
for pkg, old_pkg in updating:
self.queue.append(pkg.get_cpv(), unmask = False)
except PackageNotFoundException, e:
- if unmask_dialog(self, e[0]) == QtGui.QMessageBox.Yes:
+ if unmask_dialog(self, e[0]) == Qt.QMessageBox.Yes:
for pkg, old_pkg in updating:
self.queue.append(pkg.get_cpv(), unmask = True)
@@ -607,6 +679,15 @@ class MainWindow (Window):
if len(updating): self.doUpdate = True
+ def cb_queue_list_item_selected (self, item, col):
+ if col == -1: return # nothing selected
+
+ if self.queueTree.iter_has_parent(item):
+ package = self.queueTree.get_value(item, self.queueTree.get_cpv_column())
+ cat, name, vers, rev = system.split_cpv(package)
+ if rev != "r0": vers = vers+"-"+rev
+ self.pkgDetails.update(cat+"/"+name, queue = self.queue, version = vers, instantChange = item, doEmerge = False)
+
def cb_queue_list_items_added (self, *args):
self.queueList.resizeColumnToContents(0)
@@ -616,7 +697,3 @@ class MainWindow (Window):
def cb_pkg_list_selected (self, index, prev):
self.pkgDetails.update(self.selCatName+"/"+str(index.data().toString()), self.queue)
-
- def main (self):
- app.exec_()
-