[hamster-applet] sizing knits



commit dee2e0db88d0bd8284907e0414e876ae062db541
Author: Toms Bauģis <toms baugis gmail com>
Date:   Sun Dec 6 01:21:05 2009 +0000

    sizing knits

 data/stats.ui               |    3 +
 data/stats_overview.ui      |  121 +++----------------------------------------
 data/stats_reports.ui       |    2 +-
 data/stats_stats.ui         |    2 -
 hamster/stats_reports.py    |    1 -
 hamster/widgets/facttree.py |    1 -
 hamster/widgets/tags.py     |    9 ++--
 7 files changed, 17 insertions(+), 122 deletions(-)
---
diff --git a/data/stats.ui b/data/stats.ui
index deb15d7..5e6a31c 100644
--- a/data/stats.ui
+++ b/data/stats.ui
@@ -6,6 +6,9 @@
   <object class="GtkWindow" id="tabs_window">
     <property name="border_width">12</property>
     <property name="title" translatable="yes">Overview - Hamster</property>
+    <property name="window_position">center</property>
+    <property name="default_width">800</property>
+    <property name="default_height">600</property>
     <child>
       <object class="GtkNotebook" id="window_tabs">
         <property name="visible">True</property>
diff --git a/data/stats_overview.ui b/data/stats_overview.ui
index 2093c3f..2465070 100644
--- a/data/stats_overview.ui
+++ b/data/stats_overview.ui
@@ -108,125 +108,20 @@
           </packing>
         </child>
         <child>
-          <object class="GtkHBox" id="hbox1">
+          <object class="GtkAlignment" id="alignment1">
             <property name="visible">True</property>
-            <property name="border_width">12</property>
-            <property name="spacing">4</property>
+            <property name="border_width">10</property>
             <child>
-              <object class="GtkAlignment" id="alignment1">
-                <property name="width_request">600</property>
+              <object class="GtkScrolledWindow" id="overview_facts_box">
                 <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">never</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <property name="shadow_type">in</property>
                 <child>
-                  <object class="GtkScrolledWindow" id="overview_facts_box">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hscrollbar_policy">never</property>
-                    <property name="vscrollbar_policy">automatic</property>
-                    <property name="shadow_type">in</property>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </object>
+                  <placeholder/>
                 </child>
               </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkFrame" id="frame4">
-                <property name="width_request">200</property>
-                <property name="visible">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">none</property>
-                <child>
-                  <object class="GtkAlignment" id="alignment4">
-                    <property name="visible">True</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <object class="GtkVBox" id="vbox9">
-                        <property name="visible">True</property>
-                        <property name="orientation">vertical</property>
-                        <property name="spacing">8</property>
-                        <child>
-                          <object class="GtkVBox" id="vbox10">
-                            <property name="visible">True</property>
-                            <property name="orientation">vertical</property>
-                            <property name="spacing">4</property>
-                            <child>
-                              <object class="GtkLabel" id="label6">
-                                <property name="visible">True</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Categories</property>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkTreeView" id="treeview1">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                              </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkVBox" id="vbox11">
-                            <property name="visible">True</property>
-                            <property name="orientation">vertical</property>
-                            <property name="spacing">4</property>
-                            <child>
-                              <object class="GtkLabel" id="label9">
-                                <property name="visible">True</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Tags</property>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkTreeView" id="treeview2">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                              </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-                <child type="label">
-                  <object class="GtkLabel" id="label4">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">Filter</property>
-                    <property name="use_markup">True</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="position">1</property>
-              </packing>
             </child>
           </object>
           <packing>
diff --git a/data/stats_reports.ui b/data/stats_reports.ui
index 284cfae..c70339f 100644
--- a/data/stats_reports.ui
+++ b/data/stats_reports.ui
@@ -161,7 +161,7 @@
                 <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="position">500</property>
+                <property name="position">400</property>
                 <property name="position_set">True</property>
                 <child>
                   <object class="GtkScrolledWindow" id="totals_tree_box">
diff --git a/data/stats_stats.ui b/data/stats_stats.ui
index 839dd1f..640d52a 100644
--- a/data/stats_stats.ui
+++ b/data/stats_stats.ui
@@ -6,8 +6,6 @@
     <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">12</property>
     <property name="window_position">center</property>
-    <property name="default_width">800</property>
-    <property name="default_height">600</property>
     <property name="icon_name">hamster-applet</property>
     <signal name="key_press_event" handler="on_window_key_pressed"/>
     <signal name="delete_event" handler="on_close"/>
diff --git a/hamster/stats_reports.py b/hamster/stats_reports.py
index d624dfd..9ab6f9f 100644
--- a/hamster/stats_reports.py
+++ b/hamster/stats_reports.py
@@ -576,7 +576,6 @@ class TotalsTree(gtk.TreeView):
         
         # name
         nameColumn = gtk.TreeViewColumn()
-        nameColumn.set_expand(True)
         nameCell = gtk.CellRendererText()
         #nameCell.set_property("ellipsize", pango.ELLIPSIZE_END)
         nameColumn.pack_start(nameCell, True)
diff --git a/hamster/widgets/facttree.py b/hamster/widgets/facttree.py
index d5a80ce..c6518ad 100644
--- a/hamster/widgets/facttree.py
+++ b/hamster/widgets/facttree.py
@@ -84,7 +84,6 @@ class FactTree(gtk.TreeView):
 
         # name
         nameColumn = gtk.TreeViewColumn()
-        nameColumn.set_expand(True)
         nameCell = gtk.CellRendererText()
         #nameCell.set_property("ellipsize", pango.ELLIPSIZE_END)
         nameColumn.pack_start(nameCell, True)
diff --git a/hamster/widgets/tags.py b/hamster/widgets/tags.py
index 9d0a633..2de2752 100644
--- a/hamster/widgets/tags.py
+++ b/hamster/widgets/tags.py
@@ -410,6 +410,7 @@ class TagCellRenderer(gtk.GenericCellRenderer):
 
         if not self.width or not tags:
             height = 30
+            min_width = 80
         else:
             pixmap = gtk.gdk.Pixmap(None, self.width, 500, 24)
             context = pixmap.cairo_create()
@@ -419,11 +420,10 @@ class TagCellRenderer(gtk.GenericCellRenderer):
             self.layout.set_font_description(default_font)
 
             #make sure we fit in
-            max_width = 0
+            min_width = 0
             for tag in tags:
-                max_width = max(max_width, self.tag_size(tag)[0])
+                min_width = max(min_width, self.tag_size(tag)[0])
 
-            self.width = max(self.width, max_width)
 
             cur_x, cur_y = 4, 2
             for tag in tags:
@@ -433,13 +433,14 @@ class TagCellRenderer(gtk.GenericCellRenderer):
                     cur_y += h + 6
                 
                 cur_x += w + 8 #some padding too, please
+
             
             height = cur_y + h + 4
 
             self.height = height # this should actually trigger whole tree redraw if heights don't match
             
         
-        return (0, 0, self.width, self.height)
+        return (0, 0, min_width, self.height)
     
 
 class Tag(object):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]