~ubuntu-branches/ubuntu/saucy/solfege/saucy

« back to all changes in this revision

Viewing changes to solfege/fpeditor.py

  • Committer: Bazaar Package Importer
  • Author(s): Tom Cato Amundsen
  • Date: 2010-05-19 23:10:09 UTC
  • mfrom: (1.1.11 upstream) (2.1.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100519231009-r3zyxze7zom6xz25
Tags: 3.16.3-1
* New upstream release
* Recommend csound (closes: #579210)

Show diffs side-by-side

added added

removed removed

Lines of Context:
200
200
        im.set_from_stock(gtk.STOCK_GO_DOWN, gtk.ICON_SIZE_MENU)
201
201
        self.g_move_down_btn = gtk.Button()
202
202
        self.g_move_down_btn.add(im)
203
 
        self.g_move_down_btn.connect('clicked', self.on_move_down)
 
203
        self.g_move_down_btn.connect('clicked',
 
204
            self.m_parent.move_section_down, self)
204
205
        button_hbox.pack_start(self.g_move_down_btn, False)
205
206
        #
206
207
        im = gtk.Image()
207
208
        im.set_from_stock(gtk.STOCK_GO_UP, gtk.ICON_SIZE_MENU)
208
209
        self.g_move_up_btn = gtk.Button()
209
210
        self.g_move_up_btn.add(im)
210
 
        self.g_move_up_btn.connect('clicked', self.on_move_up)
 
211
        self.g_move_up_btn.connect('clicked',
 
212
            self.m_parent.move_section_up, self)
211
213
        button_hbox.pack_start(self.g_move_up_btn, False)
212
214
        #
213
215
        im = gtk.Image()
233
235
        # The button to click to add a new link
234
236
        hbox = gtk.HBox()
235
237
        self.pack_start(hbox)
236
 
    def on_move_down(self, btn):
237
 
        self.m_parent.move_section_down(self)
238
 
    def on_move_up(self, btn):
239
 
        self.m_parent.move_section_up(self)
240
238
    def on_edit_heading(self, btn):
241
239
        self.g_heading_entry.set_text(self.m_model.m_name)
242
240
        self.g_heading_entry.show()
354
352
            item.set_sensitive(bool(not isinstance(linked, basestring)))
355
353
            m.append(item)
356
354
            item = gtk.ImageMenuItem(gtk.STOCK_GO_UP)
357
 
            item.connect('activate', self.on_move_up, idx)
 
355
            item.connect('activate', self.on_move_link_up, idx)
358
356
            item.set_sensitive(bool(idx > 0))
359
357
            m.append(item)
360
358
            item = gtk.ImageMenuItem(gtk.STOCK_GO_DOWN)
361
 
            item.connect('activate', self.on_move_down, idx)
 
359
            item.connect('activate', self.on_move_link_down, idx)
362
360
            item.set_sensitive(bool(idx < len(self.m_model) - 1))
363
361
            m.append(item)
364
362
            item = gtk.ImageMenuItem(gtk.STOCK_EDIT)
433
431
            row = self.create_linkrow(mobj)
434
432
            self.g_link_box.pack_start(row)
435
433
            self.g_link_box.reorder_child(row, idx)
436
 
    def on_move_up(self, btn, idx):
 
434
    def on_move_link_up(self, btn, idx):
437
435
        """
438
436
        Move the link one row up.
439
437
        """
440
438
        assert idx > 0
441
439
        self.m_model[idx], self.m_model[idx - 1] = self.m_model[idx - 1], self.m_model[idx]
442
440
        self.g_link_box.reorder_child(self.g_link_box.get_children()[idx], idx - 1)
443
 
    def on_move_down(self, btn, idx):
 
441
    def on_move_link_down(self, btn, idx=None):
444
442
        """
445
443
        Move the link one row down.
446
444
        """
490
488
        gui_section = Section(section, self)
491
489
        self.g_section_box.pack_start(gui_section, False)
492
490
        gui_section.show_all()
493
 
    def move_section_down(self, section):
 
491
    def move_section_down(self, widget, section):
494
492
        idx = self.g_section_box.get_children().index(section)
495
493
        if idx < len(self.g_section_box.get_children()) - 1:
496
494
            self.g_section_box.reorder_child(section, idx + 1)
497
495
            self.m_model[idx], self.m_model[idx + 1] \
498
496
                    = self.m_model[idx + 1], self.m_model[idx]
499
497
            self.m_parent.update_buttons()
500
 
    def move_section_up(self, section):
 
498
    def move_section_up(self, widget, section):
501
499
        idx = self.g_section_box.get_children().index(section)
502
500
        if idx > 0:
503
501
            self.g_section_box.reorder_child(section, idx - 1)