Bugs 2742, 2743: Detaching a minimized gramplet doesn't run update; Changing columns in gramplet view expands minimized gramplets
svn: r12101
This commit is contained in:
parent
edf6ed54a0
commit
b8080c5fc6
@ -249,19 +249,22 @@ class GrampletWindow(ManagedWindow.ManagedWindow):
|
|||||||
|
|
||||||
def close(self, *args):
|
def close(self, *args):
|
||||||
"""
|
"""
|
||||||
Closes the detached GrampletWindow.
|
Dock the detached GrampletWindow back in the column from where it came.
|
||||||
"""
|
"""
|
||||||
self.gramplet.gvoptions.hide()
|
self.gramplet.gvoptions.hide()
|
||||||
self.gramplet.viewpage.detached_gramplets.remove(self.gramplet)
|
self.gramplet.viewpage.detached_gramplets.remove(self.gramplet)
|
||||||
self.gramplet.state = "maximized"
|
self.gramplet.state = "maximized"
|
||||||
parent = self.gramplet.viewpage.get_column_frame(self.gramplet.column)
|
parent = self.gramplet.viewpage.get_column_frame(self.gramplet.column)
|
||||||
self.gramplet.mainframe.reparent(parent)
|
self.gramplet.mainframe.reparent(parent)
|
||||||
|
# FIXME: Put the gramplet in the same column/row where it came from, if you can.
|
||||||
|
# This will put it at the bottom of column:
|
||||||
expand,fill,padding,pack = parent.query_child_packing(self.gramplet.mainframe)
|
expand,fill,padding,pack = parent.query_child_packing(self.gramplet.mainframe)
|
||||||
parent.set_child_packing(self.gramplet.mainframe,
|
parent.set_child_packing(self.gramplet.mainframe,
|
||||||
self.gramplet.expand,
|
self.gramplet.expand,
|
||||||
fill,
|
fill,
|
||||||
padding,
|
padding,
|
||||||
pack)
|
pack)
|
||||||
|
# end FIXME
|
||||||
self.gramplet.gvclose.show()
|
self.gramplet.gvclose.show()
|
||||||
self.gramplet.gvstate.show()
|
self.gramplet.gvstate.show()
|
||||||
self.gramplet.gvproperties.show()
|
self.gramplet.gvproperties.show()
|
||||||
@ -659,7 +662,7 @@ class GuiGramplet:
|
|||||||
"""
|
"""
|
||||||
Remove (delete) the gramplet from view.
|
Remove (delete) the gramplet from view.
|
||||||
"""
|
"""
|
||||||
if self.state == "windowed":
|
if self.state == "detached":
|
||||||
return
|
return
|
||||||
self.state = "closed"
|
self.state = "closed"
|
||||||
self.viewpage.closed_gramplets.append(self)
|
self.viewpage.closed_gramplets.append(self)
|
||||||
@ -670,7 +673,7 @@ class GuiGramplet:
|
|||||||
Detach the gramplet from the GrampletView, and open in own window.
|
Detach the gramplet from the GrampletView, and open in own window.
|
||||||
"""
|
"""
|
||||||
# hide buttons:
|
# hide buttons:
|
||||||
self.set_state("windowed")
|
self.set_state("detached")
|
||||||
self.viewpage.detached_gramplets.append(self)
|
self.viewpage.detached_gramplets.append(self)
|
||||||
# make a window, and attach it there
|
# make a window, and attach it there
|
||||||
self.detached_window = GrampletWindow(self)
|
self.detached_window = GrampletWindow(self)
|
||||||
@ -679,6 +682,7 @@ class GuiGramplet:
|
|||||||
"""
|
"""
|
||||||
Set the state of a gramplet.
|
Set the state of a gramplet.
|
||||||
"""
|
"""
|
||||||
|
oldstate = self.state
|
||||||
self.state = state
|
self.state = state
|
||||||
if state == "minimized":
|
if state == "minimized":
|
||||||
self.scrolledwindow.hide()
|
self.scrolledwindow.hide()
|
||||||
@ -699,15 +703,15 @@ class GuiGramplet:
|
|||||||
fill,
|
fill,
|
||||||
padding,
|
padding,
|
||||||
pack)
|
pack)
|
||||||
if state == "maximized" and self.pui:
|
if oldstate is "minimized" and self.pui:
|
||||||
self.pui.update()
|
self.pui.update()
|
||||||
|
|
||||||
def change_state(self, obj):
|
def change_state(self, obj):
|
||||||
"""
|
"""
|
||||||
Change the state of a gramplet.
|
Change the state of a gramplet.
|
||||||
"""
|
"""
|
||||||
if self.state == "windowed":
|
if self.state == "detached":
|
||||||
pass # don't change if windowed
|
pass # don't change if detached
|
||||||
else:
|
else:
|
||||||
if self.state == "maximized":
|
if self.state == "maximized":
|
||||||
self.set_state("minimized")
|
self.set_state("minimized")
|
||||||
@ -718,12 +722,11 @@ class GuiGramplet:
|
|||||||
"""
|
"""
|
||||||
Set the properties of a gramplet.
|
Set the properties of a gramplet.
|
||||||
"""
|
"""
|
||||||
if self.state == "windowed":
|
if self.state == "detached":
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.detach()
|
self.detach()
|
||||||
return
|
return
|
||||||
# FIXME: add control for expand AND detach
|
|
||||||
self.expand = not self.expand
|
self.expand = not self.expand
|
||||||
if self.state == "maximized":
|
if self.state == "maximized":
|
||||||
column = self.mainframe.get_parent() # column
|
column = self.mainframe.get_parent() # column
|
||||||
@ -1156,7 +1159,7 @@ class GrampletView(PageView.PersonNavView):
|
|||||||
"""
|
"""
|
||||||
gramplets = [g for g in self.gramplet_map.values() if g is not None]
|
gramplets = [g for g in self.gramplet_map.values() if g is not None]
|
||||||
for gramplet in gramplets:
|
for gramplet in gramplets:
|
||||||
if (gramplet.state == "windowed" or gramplet.state == "closed"):
|
if (gramplet.state == "detached" or gramplet.state == "closed"):
|
||||||
continue
|
continue
|
||||||
column = gramplet.mainframe.get_parent()
|
column = gramplet.mainframe.get_parent()
|
||||||
if column:
|
if column:
|
||||||
@ -1180,8 +1183,11 @@ class GrampletView(PageView.PersonNavView):
|
|||||||
# else, spread them out:
|
# else, spread them out:
|
||||||
pos = cnt % self.column_count
|
pos = cnt % self.column_count
|
||||||
gramplet.column = pos
|
gramplet.column = pos
|
||||||
if recolumn and (gramplet.state == "windowed" or gramplet.state == "closed"):
|
if recolumn and (gramplet.state == "detached" or gramplet.state == "closed"):
|
||||||
continue
|
continue
|
||||||
|
if gramplet.state == "minimized":
|
||||||
|
self.columns[pos].pack_start(gramplet.mainframe, expand=False)
|
||||||
|
else:
|
||||||
self.columns[pos].pack_start(gramplet.mainframe, expand=gramplet.expand)
|
self.columns[pos].pack_start(gramplet.mainframe, expand=gramplet.expand)
|
||||||
# set height on gramplet.scrolledwindow here:
|
# set height on gramplet.scrolledwindow here:
|
||||||
gramplet.scrolledwindow.set_size_request(-1, gramplet.height)
|
gramplet.scrolledwindow.set_size_request(-1, gramplet.height)
|
||||||
@ -1189,7 +1195,7 @@ class GrampletView(PageView.PersonNavView):
|
|||||||
#if gramplet.state == "minimized": # starts max, change to min it
|
#if gramplet.state == "minimized": # starts max, change to min it
|
||||||
# gramplet.set_state("minimized") # minimize it
|
# gramplet.set_state("minimized") # minimize it
|
||||||
# set minimized is called in page subclass hack (above)
|
# set minimized is called in page subclass hack (above)
|
||||||
if gramplet.state == "windowed":
|
if gramplet.state == "detached":
|
||||||
gramplet.detach()
|
gramplet.detach()
|
||||||
elif gramplet.state == "closed":
|
elif gramplet.state == "closed":
|
||||||
gramplet.close()
|
gramplet.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user