2007-04-04 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/GrampsWidgets.py (Statusbar): min width given in #chars; right alignment of a bar is enabled. * src/DisplayState.py (DisplayState.__init__): statusbar creation with modified parameters. svn: r8350
This commit is contained in:
parent
f32d7b6d1a
commit
44cd99f74d
@ -1,3 +1,9 @@
|
|||||||
|
2007-04-04 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
|
||||||
|
* src/GrampsWidgets.py (Statusbar): min width given in #chars;
|
||||||
|
right alignment of a bar is enabled.
|
||||||
|
* src/DisplayState.py (DisplayState.__init__): statusbar creation
|
||||||
|
with modified parameters.
|
||||||
|
|
||||||
2007-04-02 Don Allingham <don@gramps-project.org>
|
2007-04-02 Don Allingham <don@gramps-project.org>
|
||||||
* src/DisplayState.py: shorten match message
|
* src/DisplayState.py: shorten match message
|
||||||
* src/GrampsDb/Makefile.am: Added _HelperFunctions.py
|
* src/GrampsDb/Makefile.am: Added _HelperFunctions.py
|
||||||
|
@ -275,7 +275,7 @@ class DisplayState(GrampsDb.GrampsDBCallback):
|
|||||||
self.gwm = ManagedWindow.GrampsWindowManager(uimanager)
|
self.gwm = ManagedWindow.GrampsWindowManager(uimanager)
|
||||||
self.widget = None
|
self.widget = None
|
||||||
self.warnbtn = warnbtn
|
self.warnbtn = warnbtn
|
||||||
self.last_bar = self.status.insert(min_width=150)
|
self.last_bar = self.status.insert(min_width=14, ralign=True)
|
||||||
|
|
||||||
formatter = logging.Formatter('%(levelname)s %(name)s: %(message)s')
|
formatter = logging.Formatter('%(levelname)s %(name)s: %(message)s')
|
||||||
self.rh = WarnHandler(capacity=400,button=warnbtn)
|
self.rh = WarnHandler(capacity=400,button=warnbtn)
|
||||||
|
@ -712,15 +712,20 @@ class Statusbar(gtk.HBox):
|
|||||||
gobject.PARAM_READWRITE),
|
gobject.PARAM_READWRITE),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, min_width=300):
|
def __init__(self, min_width=30):
|
||||||
gtk.HBox.__init__(self)
|
gtk.HBox.__init__(self)
|
||||||
|
|
||||||
|
# initialize pixel/character scale
|
||||||
|
pl = pango.Layout(self.get_pango_context())
|
||||||
|
pl.set_text("M")
|
||||||
|
(self._char_width, h) = pl.get_pixel_size()
|
||||||
|
|
||||||
# initialize property values
|
# initialize property values
|
||||||
self.__has_resize_grip = True
|
self.__has_resize_grip = True
|
||||||
|
|
||||||
# create the main statusbar with id #0
|
# create the main statusbar with id #0
|
||||||
main_bar = gtk.Statusbar()
|
main_bar = gtk.Statusbar()
|
||||||
main_bar.set_size_request(min_width, -1)
|
main_bar.set_size_request(min_width*self._char_width, -1)
|
||||||
main_bar.show()
|
main_bar.show()
|
||||||
self.pack_start(main_bar)
|
self.pack_start(main_bar)
|
||||||
self._bars = {0: main_bar}
|
self._bars = {0: main_bar}
|
||||||
@ -782,7 +787,7 @@ class Statusbar(gtk.HBox):
|
|||||||
|
|
||||||
# Public API
|
# Public API
|
||||||
|
|
||||||
def insert(self, index=-1, min_width=300):
|
def insert(self, index=-1, min_width=30, ralign=False):
|
||||||
"""Insert a new statusbar.
|
"""Insert a new statusbar.
|
||||||
|
|
||||||
Create a new statusbar and insert it at the given index. Index starts
|
Create a new statusbar and insert it at the given index. Index starts
|
||||||
@ -791,13 +796,17 @@ class Statusbar(gtk.HBox):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
new_bar = gtk.Statusbar()
|
new_bar = gtk.Statusbar()
|
||||||
new_bar.set_size_request(min_width, -1)
|
new_bar.set_size_request(min_width*self._char_width, -1)
|
||||||
new_bar.show()
|
new_bar.show()
|
||||||
self.pack_start(new_bar)
|
self.pack_start(new_bar)
|
||||||
self.reorder_child(new_bar, index)
|
self.reorder_child(new_bar, index)
|
||||||
self._set_resize_grip()
|
self._set_resize_grip()
|
||||||
self._set_packing()
|
self._set_packing()
|
||||||
|
|
||||||
|
if ralign:
|
||||||
|
label = new_bar.get_children()[0].get_children()[0]
|
||||||
|
label.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
|
|
||||||
new_bar_id = self._get_next_id()
|
new_bar_id = self._get_next_id()
|
||||||
self._bars[new_bar_id] = new_bar
|
self._bars[new_bar_id] = new_bar
|
||||||
|
|
||||||
@ -2546,15 +2555,15 @@ def main(args):
|
|||||||
statusbar = Statusbar()
|
statusbar = Statusbar()
|
||||||
vbox.pack_end(statusbar, False)
|
vbox.pack_end(statusbar, False)
|
||||||
|
|
||||||
statusbar.push(1, "Testing status bar")
|
statusbar.push(1, "This is my statusbar...")
|
||||||
|
|
||||||
my_statusbar = statusbar.insert(min_width=200)
|
my_statusbar = statusbar.insert(min_width=24)
|
||||||
statusbar.push(1, "This is my statusbar...", my_statusbar)
|
statusbar.push(1, "Testing status bar width", my_statusbar)
|
||||||
|
|
||||||
yet_another_statusbar = statusbar.insert(1, 100)
|
yet_another_statusbar = statusbar.insert(1, 11)
|
||||||
statusbar.push(1, "A short one", yet_another_statusbar)
|
statusbar.push(1, "A short one", yet_another_statusbar)
|
||||||
|
|
||||||
last_statusbar = statusbar.insert()
|
last_statusbar = statusbar.insert(min_width=41, ralign=True)
|
||||||
statusbar.push(1, "The last statusbar has always fixed width",
|
statusbar.push(1, "The last statusbar has always fixed width",
|
||||||
last_statusbar)
|
last_statusbar)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user