Merge lp:~alasdair-macleod/jokosher/store-window-size into lp:jokosher

Proposed by alasdair.macleod
Status: Merged
Merged at revision: not available
Proposed branch: lp:~alasdair-macleod/jokosher/store-window-size
Merge into: lp:jokosher
Diff against target: None lines
To merge this branch: bzr merge lp:~alasdair-macleod/jokosher/store-window-size
Reviewer Review Type Date Requested Status
Jokosher Code Pending
Review via email: mp+5196@code.launchpad.net
To post a comment you must log in.
Revision history for this message
alasdair.macleod (alasdair-macleod) wrote :

Added the storing of the window size for add instrument

Revision history for this message
Laszlo Pandy (laszlok) wrote :

What is the purpose of the OnDestroy function and the following comment:
"the current project can't be properly closed. This stops signal propagation."

Can you explain this more?

1081. By alasdair.macleod

Made changes requested from code review. Added the saving of window size after resize
to the Instrument Effects dialog.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Jokosher/AddInstrumentDialog.py'
2--- Jokosher/AddInstrumentDialog.py 2008-12-18 19:07:15 +0000
3+++ Jokosher/AddInstrumentDialog.py 2009-04-03 13:31:25 +0000
4@@ -44,6 +44,7 @@
5 "on_OK_clicked" : self.OnOK,
6 "on_Cancel_clicked" : self.OnCancel,
7 "on_instrument_search_changed" : self.OnSearchChange,
8+ "on_AddInstrument_configure_event" : self.OnResize,
9 }
10
11 self.res.signal_autoconnect(self.signals)
12@@ -87,8 +88,11 @@
13
14 self.tree.set_item_width(90)
15 self.tree.set_size_request(72, -1)
16- self.dlg.resize(350, 300)
17-
18+
19+ self.width = int(Globals.settings.general["addinstrumentwindowwidth"])
20+ self.height = int(Globals.settings.general["addinstrumentwindowheight"])
21+ self.dlg.resize(self.width, self.height)
22+
23 self.dlg.set_icon(self.parent.icon)
24 self.dlg.set_transient_for(self.parent.window)
25 self.dlg.show()
26@@ -130,6 +134,10 @@
27 instrItem = [x for x in Globals.getCachedInstruments() if x[1] == item[1]][0]
28 self.instr.ChangeType(instrItem[1], instrItem[0])
29
30+ Globals.settings.general["addinstrumentwindowwidth"] = self.width
31+ Globals.settings.general["addinstrumentwindowheight"] = self.height
32+ Globals.settings.write()
33+
34 self.dlg.destroy()
35
36 #_____________________________________________________________________
37@@ -141,6 +149,7 @@
38 Parameters:
39 button -- reserved for GTK callbacks, dont't use it explicity.
40 """
41+
42 self.dlg.destroy()
43
44 #_____________________________________________________________________
45@@ -181,4 +190,45 @@
46
47 #_____________________________________________________________________
48
49+
50+ def OnResize(self, widget, event):
51+ """
52+ This method is called when the add instrument window is resized
53+
54+ Parameters:
55+ widget -- GTK callback parameter.
56+ event -- GTK callback parameter.
57+
58+ Returns:
59+ False -- continue GTK signal propagation.
60+ """
61+
62+ (self.width, self.height) = widget.get_size()
63+
64+ Globals.settings.general["addinstrumentwindowwidth"] = self.width
65+ Globals.settings.general["addinstrumentwindowheight"] = self.height
66+ Globals.settings.write()
67+
68+ return False
69+
70+
71+ def OnDestroy(self, widget=None, event=None):
72+ """
73+ Called when the add instrument window is called
74+
75+ Parameters:
76+ widget -- reserved for GTK callbacks, don't use it explicitly.
77+ event -- reserved for GTK callbacks, don't use it explicitly.
78+
79+ Returns:
80+ True -- the current project can't be properly closed.
81+ This stops signal propagation.
82+ """
83+
84+
85+
86+ return True
87+
88+
89+
90 #=========================================================================
91
92=== modified file 'Jokosher/Globals.py'
93--- Jokosher/Globals.py 2009-03-19 23:39:14 +0000
94+++ Jokosher/Globals.py 2009-04-03 13:31:25 +0000
95@@ -37,6 +37,8 @@
96 "projectfolder" : "",
97 "windowheight" : 550,
98 "windowwidth" : 900,
99+ "addinstrumentwindowheight" : 350,
100+ "addinstrumentwindowwidth" : 300,
101 }
102
103 recording = {
104
105=== modified file 'Jokosher/Jokosher.glade'
106--- Jokosher/Jokosher.glade 2009-03-17 02:09:31 +0000
107+++ Jokosher/Jokosher.glade 2009-04-03 13:31:25 +0000
108@@ -1329,6 +1329,8 @@
109 <property name="gravity">GDK_GRAVITY_CENTER</property>
110 <property name="focus_on_map">True</property>
111 <property name="urgency_hint">False</property>
112+ <signal name="configure_event" handler="on_AddInstrument_configure_event" />
113+
114
115 <child>
116 <widget class="GtkVBox" id="vbox2">

Subscribers

People subscribed via source and target branches