diff options
author | Nat <Nat@localhost.localdomain> | 2007-02-12 19:10:44 (GMT) |
---|---|---|
committer | Nat <Nat@localhost.localdomain> | 2007-02-12 19:10:44 (GMT) |
commit | 3a200cfa5b2f0226bc78ea18a9d82b49dcb67808 (patch) | |
tree | 5cc41ee37953df252c7dbc3aabdfddb61aeacbae /Util/InstrumentPanel.py | |
parent | 28d0654ddcc308afc54f3380b5c29fa41552c0d1 (diff) |
Cleanup
Diffstat (limited to 'Util/InstrumentPanel.py')
-rw-r--r-- | Util/InstrumentPanel.py | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/Util/InstrumentPanel.py b/Util/InstrumentPanel.py index f1f7ab9..b47563b 100644 --- a/Util/InstrumentPanel.py +++ b/Util/InstrumentPanel.py @@ -17,7 +17,7 @@ class InstrumentPanel(gtk.EventBox): self.setInstrument = setInstrument self.playInstrument = playInstrument self.enterMode = enterMode - self.instTable = None + self.scrollWin = None self.instDic = {} self.generateInstDic() @@ -43,31 +43,41 @@ class InstrumentPanel(gtk.EventBox): def draw_instruments_panel(self,category = 'all'): - if self.instTable != None: + if self.scrollWin != None: for child in self.instTable.get_children(): self.instTable.remove(child) - self.instTable.destroy() + for child in self.scrollWin.get_children(): + self.scrollWin.remove(child) + self.scrollWin.destroy() instrumentNum = len(self.getInstrumentList(category)) instruments = self.getInstrumentList(category) - cols = 9 + cols = 8 if instrumentNum < cols: cols = instrumentNum rows = (instrumentNum // cols) if instrumentNum % cols is not 0: #S'il y a un reste rows = rows + 1 + self.scrollWin = gtk.ScrolledWindow() + self.scrollWin.set_policy(gtk.POLICY_NEVER,gtk.POLICY_AUTOMATIC) + color = gtk.gdk.color_parse('#FFFFFF') + self.scrollWin.modify_bg(gtk.STATE_NORMAL, color) + self.instTable = gtk.Table(rows,cols,True) + self.instTable.set_row_spacings(0) + self.instTable.set_col_spacings(0) for row in range(rows): for col in range(cols): if row*cols+col >= instrumentNum: break instBox = self.instDic[instruments[row*cols+col]] - self.instTable.attach(instBox, col, col+1, row, row+1, gtk.SHRINK, 0, gtk.SHRINK, 0) + self.instTable.attach(instBox, col, col+1, row, row+1, gtk.SHRINK, gtk.SHRINK, 0, 0) - self.mainVBox.pack_start(self.instTable) + self.scrollWin.add_with_viewport(self.instTable) + self.mainVBox.pack_start(self.scrollWin) self.show_all() def handleInstrumentButtonClick(self,widget,instrument): @@ -95,9 +105,9 @@ class InstrumentPanel(gtk.EventBox): micRecBtn.connect('clicked', self.handleMicButtonClick, n) micRecBtn.connect('pressed', self.handleRecButtonPress, micBtn) - vbox1.add(micRecBtn) - vbox1.add(micBtn) - hbox.add(vbox1) + vbox1.pack_start(micRecBtn,False,False) + vbox1.pack_start(micBtn,False,False) + hbox.pack_start(vbox1,False,False) for n in ['lab1','lab2','lab3','lab4']: vbox2 = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS) @@ -111,9 +121,9 @@ class InstrumentPanel(gtk.EventBox): synthRecBtn.connect('clicked', self.handleSynthButtonClick, n) synthRecBtn.connect('pressed', self.handleRecButtonPress, synthBtn) - vbox2.add(synthRecBtn) - vbox2.add(synthBtn) - hbox.add(vbox2) + vbox2.pack_start(synthRecBtn,False,False) + vbox2.pack_start(synthBtn,False,False) + hbox.pack_start(vbox2,False,False) self.mainVBox.pack_end(hbox,False,False) |