Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

The active plot is now more visible.

This commit is contained in:
Einar Ryeng 2006-10-13 22:25:18 +00:00
parent f826931105
commit e08cc8b816
1 changed files with 35 additions and 18 deletions

View File

@ -67,7 +67,21 @@ class ViewFrame (gtk.Frame):
self.view_frames = view_frames
self.empty_view = EmptyView()
self._button_event = None
## Set up a VBox with a label wrapped in an event box.
label = gtk.Label()
ebox = gtk.EventBox()
ebox.add(label)
vbox = gtk.VBox()
vbox.pack_start(ebox, expand=False)
vbox.pack_start(gtk.HSeparator(), expand=False)
## Keep the references for later use.
self._vbox = vbox
self._ebox = ebox
self._view_title = label
self.add(vbox)
view_frames.append(self)
if len(view_frames) == 1:
self.focus()
@ -84,9 +98,10 @@ class ViewFrame (gtk.Frame):
# Set view
self._view = self.empty_view
self._view.connect("button-press-event", self.on_button_press_event)
self.add(self._view)
self._vbox.add(self._view)
self._view_title.set_text(self._view.title)
self.show_all()
self._view.show()
self.show()
def focus(self):
"""Gets focus and ensures that no other window is in focus."""
@ -98,6 +113,7 @@ class ViewFrame (gtk.Frame):
frame.unfocus()
self.set_shadow_type(gtk.SHADOW_IN)
self._ebox.set_state(gtk.STATE_ACTIVE)
self.focused = True
self.emit('focus-changed', self, True)
return self
@ -108,6 +124,7 @@ class ViewFrame (gtk.Frame):
return
self.set_shadow_type(gtk.SHADOW_OUT)
self._ebox.set_state(gtk.STATE_NORMAL)
self.focused = False
self.emit('focus-changed', self, False)
@ -123,9 +140,8 @@ class ViewFrame (gtk.Frame):
return
# detach view from current parent
view_parent = view.get_parent()
if view_parent:
view_parent.set_view(None)
if view._view_frame:
view._view_frame.set_view(None)
# switch which widget we are listening to
if self._button_event:
@ -135,11 +151,16 @@ class ViewFrame (gtk.Frame):
self.on_button_press_event)
# remove old view, set new view
self._view.hide()
self.remove(self._view)
self.add(view)
if self._view:
self._view.hide()
self._vbox.remove(self._view)
self._view._view_frame = None
self._view_title.set_text(view.title)
self._vbox.add(view)
view.show()
view._view_frame = self
self._view = view
def get_view(self):
@ -262,7 +283,7 @@ class View (gtk.Frame):
gtk.Frame.__init__(self)
self.title = title
self.set_shadow_type(gtk.SHADOW_NONE)
self.set_label(title)
self._view_frame = None
def get_toolbar(self):
return None
@ -294,11 +315,12 @@ class Plot (View):
self._toolbar = PlotToolbar(self)
self.canvas.add_events(gtk.gdk.ENTER_NOTIFY_MASK)
self.current_dim = None
self._current_selection = None
def set_frozen(self, frozen):
"""A frozen plot will not be updated when the current selection is changed."""
self._frozen = frozen
if not frozen:
if not frozen and self._current_selection != None:
self.set_current_selection(self._current_selection)
def get_title(self):
@ -316,13 +338,12 @@ class Plot (View):
3.) the selections dim_name is the plot's dimension.
"""
self._current_selection = selection
if self._frozen \
or not self.get_property('visible') \
or self.current_dim != dim_name:
return
else:
self._current_selection = selection
self.set_current_selection(selection)
def set_selection_listener(self, listener):
@ -726,10 +747,6 @@ class DefaultPlotMode (PlotMode):
def __init__(self, plot):
PlotMode.__init__(self, plot, 'default', 'Default mode', 'cursor.png')
def activate(self):
for k, v in self.canvas.callbacks.items():
print k, v
class PanPlotMode (PlotMode):
def __init__(self, plot):