summaryrefslogtreecommitdiff
path: root/portato/gui
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/gui/gtk/glade/portato.glade487
-rw-r--r--portato/gui/gtk/windows.py65
-rw-r--r--portato/gui/gui_helper.py18
3 files changed, 345 insertions, 225 deletions
diff --git a/portato/gui/gtk/glade/portato.glade b/portato/gui/gtk/glade/portato.glade
index 811dced..8956a2d 100644
--- a/portato/gui/gtk/glade/portato.glade
+++ b/portato/gui/gtk/glade/portato.glade
@@ -21,19 +21,41 @@
<widget class="GtkMenu" id="menu1">
<property name="visible">True</property>
<child>
- <widget class="GtkMenuItem" id="prefItem">
+ <widget class="GtkImageMenuItem" id="prefItem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Preferences</property>
<property name="use_underline">True</property>
<signal name="activate" handler="cb_preferences_clicked"/>
+ <child internal-child="image">
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-preferences</property>
+ <property name="icon_size">1</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
</widget>
</child>
<child>
- <widget class="GtkMenuItem" id="reloadItem">
+ <widget class="GtkImageMenuItem" id="reloadItem">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Reload Portage</property>
+ <property name="label" translatable="yes">Re_load Portage</property>
<property name="use_underline">True</property>
<signal name="activate" handler="cb_reload_clicked"/>
+ <child internal-child="image">
+ <widget class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-refresh</property>
+ <property name="icon_size">1</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
</widget>
</child>
<child>
@@ -42,11 +64,22 @@
</widget>
</child>
<child>
- <widget class="GtkMenuItem" id="closeItem">
+ <widget class="GtkImageMenuItem" id="closeItem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Close</property>
<property name="use_underline">True</property>
<signal name="activate" handler="cb_destroy"/>
+ <child internal-child="image">
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-quit</property>
+ <property name="icon_size">1</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
</widget>
</child>
</widget>
@@ -86,6 +119,11 @@
</widget>
</child>
<child>
+ <widget class="GtkSeparatorMenuItem" id="separatormenuitem2">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+ <child>
<widget class="GtkMenuItem" id="syncItem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Sync</property>
@@ -101,6 +139,30 @@
<signal name="activate" handler="cb_save_flags_clicked"/>
</widget>
</child>
+ <child>
+ <widget class="GtkSeparatorMenuItem" id="separatormenuitem3">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="killItem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Kill Emerge</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="cb_kill_clicked"/>
+ <child internal-child="image">
+ <widget class="GtkImage" id="image25">
+ <property name="visible">True</property>
+ <property name="stock">gtk-stop</property>
+ <property name="icon_size">1</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
</widget>
</child>
</widget>
@@ -114,11 +176,22 @@
<widget class="GtkMenu" id="menu3">
<property name="visible">True</property>
<child>
- <widget class="GtkMenuItem" id="aboutItem">
+ <widget class="GtkImageMenuItem" id="aboutItem">
<property name="visible">True</property>
<property name="label" translatable="yes">_About</property>
<property name="use_underline">True</property>
<signal name="activate" handler="cb_about_clicked"/>
+ <child internal-child="image">
+ <widget class="GtkImage" id="image31">
+ <property name="visible">True</property>
+ <property name="stock">gtk-about</property>
+ <property name="icon_size">1</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
</widget>
</child>
</widget>
@@ -230,72 +303,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>
@@ -349,55 +398,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>
@@ -781,186 +854,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>
@@ -1024,4 +1097,26 @@
</widget>
</child>
</widget>
+ <widget class="GtkMenu" id="consolePopup">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkImageMenuItem" id="killItem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Kill Process</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="cb_kill_clicked"/>
+ <child internal-child="image">
+ <widget class="GtkImage" id="image51">
+ <property name="visible">True</property>
+ <property name="stock">gtk-stop</property>
+ <property name="icon_size">1</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
</glade-interface>
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index eb5e3c5..239606a 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -3,7 +3,7 @@
# File: portato/gui/gtk/windows.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
-# Copyright (C) 2006 René 'Necoro' Neumann
+# Copyright (C) 2006-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.
@@ -35,9 +35,11 @@ import vte
# other
from portage_util import unique_array
+GLADE_FILE = DATA_DIR+"portato.glade"
+
class Window:
def __init__ (self):
- self.tree = gtk.glade.XML(DATA_DIR+"portato.glade", root = self.__class__.__name__)
+ self.tree = gtk.glade.XML(GLADE_FILE, root = self.__class__.__name__)
self.tree.signal_autoconnect(self)
self.window = self.tree.get_widget(self.__class__.__name__)
@@ -60,6 +62,11 @@ class Window:
return ret
return wrapper
+ def create_popup (self, name):
+ popupTree = gtk.glade.XML(GLADE_FILE, root = name)
+ popupTree.signal_autoconnect(self)
+ return popupTree.get_widget(name)
+
class AbstractDialog (Window):
"""A class all our dialogs get derived from. It sets useful default vars and automatically handles the ESC-Button."""
@@ -106,7 +113,7 @@ class AboutWindow (AbstractDialog):
A Portage-GUI
This software is licensed under the terms of the GPLv2.
-Copyright (C) 2006 René 'Necoro' Neumann &lt;necoro@necoro.net&gt;
+Copyright (C) 2006-2007 René 'Necoro' Neumann &lt;necoro@necoro.net&gt;
<small>Thanks to Fred for support and ideas :P</small>
""" % VERSION)
@@ -598,16 +605,14 @@ class MainWindow (Window):
self.build_queue_list()
# the terminal
- term = vte.Terminal()
- term.set_scrollback_lines(1024)
- term.set_scroll_on_output(True)
- term.set_font_from_string("Monospace 11")
- # XXX why is this not working with the colors
- term.set_color_background(gtk.gdk.color_parse("white"))
- term.set_color_foreground(gtk.gdk.color_parse("black"))
+ self.console = vte.Terminal()
+ self.console.set_scrollback_lines(1024)
+ self.console.set_scroll_on_output(True)
+ self.console.set_font_from_string("Monospace 11")
+ self.console.connect("button-press-event", self.cb_right_click)
self.termHB = self.tree.get_widget("termHB")
- termScroll = gtk.VScrollbar(term.get_adjustment())
- self.termHB.pack_start(term, True, True)
+ termScroll = gtk.VScrollbar(self.console.get_adjustment())
+ self.termHB.pack_start(self.console, True, True)
self.termHB.pack_start(termScroll, False)
# notebook
@@ -618,14 +623,13 @@ class MainWindow (Window):
self.packageTable = PackageTable(self)
self.packageTable.table.hide_all()
- # popup
- popupTree = gtk.glade.XML(DATA_DIR+"portato.glade", root = "queuePopup")
- popupTree.signal_autoconnect(self)
- self.queuePopup = popupTree.get_widget("queuePopup")
+ # popups
+ self.queuePopup = self.create_popup("queuePopup")
+ self.consolePopup = self.create_popup("consolePopup")
# set emerge queue
self.queueTree = GtkTree(self.queueList.get_model())
- self.queue = EmergeQueue(console = GtkConsole(term), tree = self.queueTree, db = self.db, title_update = self.title_update)
+ self.queue = EmergeQueue(console = GtkConsole(self.console), tree = self.queueTree, db = self.db, title_update = self.title_update)
def show_package (self, *args, **kwargs):
self.packageTable.update(*args, **kwargs)
@@ -865,21 +869,27 @@ class MainWindow (Window):
AboutWindow(self.window)
return True
- def cb_queue_right_click (self, queue, event):
+ def cb_right_click (self, object, event):
if event.button == 3:
x = int(event.x)
y = int(event.y)
time = event.time
- pthinfo = queue.get_path_at_pos(x, y)
- if pthinfo is not None:
- path, col, cellx, celly = pthinfo
- if self.queueTree.is_in_emerge(self.queueTree.get_original().get_iter(path)):
- queue.grab_focus()
- queue.set_cursor(path, col, 0)
- self.queuePopup.popup(None, None, None, event.button, time)
- return True
+
+ if object == self.queueList:
+ pthinfo = object.get_path_at_pos(x, y)
+ if pthinfo is not None:
+ path, col, cellx, celly = pthinfo
+ if self.queueTree.is_in_emerge(self.queueTree.get_original().get_iter(path)):
+ object.grab_focus()
+ object.set_cursor(path, col, 0)
+ self.queuePopup.popup(None, None, None, event.button, time)
+ return True
+ elif object == self.console:
+ self.consolePopup.popup(None, None, None, event.button, time)
else:
return False
+ else:
+ return False
def cb_oneshot_clicked (self, action):
sel = self.queueList.get_selection()
@@ -893,6 +903,9 @@ class MainWindow (Window):
self.cfg.set_local(package, "oneshot_opt", set)
self.queue.append(package, update = True, oneshot = set, forceUpdate = True)
+
+ def cb_kill_clicked (self, action):
+ self.queue.kill_emerge()
def cb_destroy (self, widget):
"""Calls main_quit()."""
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index 7d8ead8..759752e 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -3,7 +3,7 @@
# File: portato/gui/gui_helper.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
-# Copyright (C) 2006 René 'Necoro' Neumann
+# Copyright (C) 2006-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.
@@ -26,6 +26,8 @@ from subprocess import Popen, PIPE, STDOUT
from threading import Thread
import pty
import time
+import os
+import signal
class Config:
"""Wrapper around a ConfigParser and for additional local configurations."""
@@ -469,10 +471,10 @@ class EmergeQueue:
self.console.set_pty(master)
# start emerge
- process = Popen(command+options+packages, stdout = slave, stderr = STDOUT, shell = False)
+ self.process = Popen(command+options+packages, stdout = slave, stderr = STDOUT, shell = False)
# start thread waiting for the stop of emerge
- Thread(name="Emerge-Thread", target=self._update_packages, args=(packages+self.deps.keys(), process)).start()
+ Thread(name="Emerge-Thread", target=self._update_packages, args=(packages+self.deps.keys(), self.process)).start()
# remove
for i in it:
@@ -555,6 +557,16 @@ class EmergeQueue:
else:
self._emerge([],[],[], command = command)
+ def kill_emerge (self):
+ """Kills the emerge process."""
+ try:
+ os.kill(self.process.pid, signal.SIGTERM)
+ debug("Process should be killed")
+ except AttributeError:
+ debug("AttributeError occured ==> process not exisiting - ignore")
+ except OSError:
+ debug("OSError occured ==> process already stopped - ignore")
+
def remove_with_children (self, it, removeNewFlags = True):
"""Convenience function which removes all children of an iterator and than the iterator itself.