summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/gui/gtk/basic.py1
-rw-r--r--portato/gui/gtk/windows.py23
-rw-r--r--portato/gui/templates/portato.glade168
3 files changed, 108 insertions, 84 deletions
diff --git a/portato/gui/gtk/basic.py b/portato/gui/gtk/basic.py
index 02caaf5..27c932e 100644
--- a/portato/gui/gtk/basic.py
+++ b/portato/gui/gtk/basic.py
@@ -70,6 +70,7 @@ class AbstractDialog (Window):
# set parent
self.window.set_transient_for(parent)
+ self.parent = parent
# catch the ESC-key
self.window.connect("key-press-event", self.cb_key_pressed)
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index d154ab1..fb9836c 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -105,7 +105,7 @@ class UpdateWindow (AbstractDialog):
def __init__ (self, parent, packages, queue, jump_to):
AbstractDialog.__init__(self, parent)
-
+
self.queue = queue
self.jump = jump_to
@@ -132,6 +132,21 @@ class UpdateWindow (AbstractDialog):
for p in self.packages:
store.append([False, p.get_cpv()])
+ def cb_set_size (self, *args):
+ """
+ This callback is called shortly before drawing.
+ It calculates the optimal size of the window.
+ The optimum is defined as: as large as possible w/o scrollbars
+ """
+
+ bb = self.tree.get_widget("updateBB")
+ vals = (self.view.get_vadjustment().upper+bb.size_request()[1]+10, # max size of list + size of BB + constant
+ self.parent.get_size()[1]) # size of the parent -> maximum size
+ debug("Size values for the list and for the parent: %d / %d", *vals)
+ val = int(min(vals))
+ debug("Minimum value: %d", val)
+ self.window.set_geometry_hints(self.window, min_height = val)
+
def cb_select_all_clicked (self, btn):
model = self.view.get_model()
iter = model.get_iter_first()
@@ -789,9 +804,7 @@ class MainWindow (Window):
# main window stuff
Window.__init__(self)
self.window.set_title(self.main_title)
- mHeight = 800
- if gtk.gdk.screen_height() <= 800: mHeight = 600
- self.window.set_geometry_hints (self.window, min_width = 600, min_height = mHeight, max_height = gtk.gdk.screen_height(), max_width = gtk.gdk.screen_width())
+ self.window.set_geometry_hints (self.window, max_height = gtk.gdk.screen_height(), max_width = gtk.gdk.screen_width())
# booleans
self.doUpdate = False
@@ -837,7 +850,7 @@ class MainWindow (Window):
splash(_("Building frontend"))
# set vpaned position
self.vpaned = self.tree.get_widget("vpaned")
- self.vpaned.set_position(int(mHeight/2))
+ self.vpaned.set_position(int(self.window.get_size()[1]/2))
# cat and pkg list
self.sortPkgListByName = True
diff --git a/portato/gui/templates/portato.glade b/portato/gui/templates/portato.glade
index 2459ffb..64f4555 100644
--- a/portato/gui/templates/portato.glade
+++ b/portato/gui/templates/portato.glade
@@ -1754,85 +1754,6 @@
</widget>
</child>
</widget>
- <widget class="GtkWindow" id="UpdateWindow">
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="title" translatable="yes">Updateble Packages</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
- <property name="destroy_with_parent">True</property>
- <property name="urgency_hint">True</property>
- <child>
- <widget class="GtkVBox" id="mainVB">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="spacing">5</property>
- <child>
- <widget class="GtkTreeView" id="packageList">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="headers_visible">False</property>
- <property name="reorderable">True</property>
- <property name="rules_hint">True</property>
- <signal name="cursor_changed" handler="cb_package_selected"/>
- </widget>
- </child>
- <child>
- <widget class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="homogeneous">True</property>
- <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
- <child>
- <widget class="GtkButton" id="closeBtn">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Close</property>
- <property name="use_underline">True</property>
- <property name="response_id">0</property>
- <signal name="clicked" handler="close"/>
- </widget>
- </child>
- <child>
- <widget class="GtkButton" id="selectAllBtn">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">Select _All</property>
- <property name="use_underline">True</property>
- <property name="response_id">0</property>
- <signal name="clicked" handler="cb_select_all_clicked"/>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="installBtn">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Install Selected</property>
- <property name="use_underline">True</property>
- <property name="response_id">0</property>
- <signal name="clicked" handler="cb_install_clicked"/>
- </widget>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
<widget class="GtkWindow" id="PluginWindow">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
@@ -2007,4 +1928,93 @@ German - René 'Necoro' Neumann</property>
</widget>
</child>
</widget>
+ <widget class="GtkWindow" id="UpdateWindow">
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="title" translatable="yes">Updateble Packages</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="urgency_hint">True</property>
+ <signal name="realize" handler="cb_set_size"/>
+ <child>
+ <widget class="GtkVBox" id="mainVB">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="spacing">5</property>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <child>
+ <widget class="GtkTreeView" id="packageList">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="headers_visible">False</property>
+ <property name="reorderable">True</property>
+ <property name="rules_hint">True</property>
+ <signal name="cursor_changed" handler="cb_package_selected"/>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkHButtonBox" id="updateBB">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="homogeneous">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
+ <child>
+ <widget class="GtkButton" id="closeBtn">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">_Close</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="close"/>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkButton" id="selectAllBtn">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">Select _All</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="cb_select_all_clicked"/>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="installBtn">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">_Install Selected</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="cb_install_clicked"/>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
</glade-interface>