configwindow.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:Solfege 作者: RannyeriDev 项目源码 文件源码
def __init__(self):
        Gtk.Dialog.__init__(self, _("GNU Solfege Preferences"),
             solfege.win, 0,
             (Gtk.STOCK_HELP, Gtk.ResponseType.HELP, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE))
        cfg.ConfigUtils.__init__(self, 'configwindow')
        self.connect('response', self.apply_and_close)
        # We do this so that the window is only hidden when the
        # user click on the close button provided by the window manager.
        self.connect('delete-event', self.on_destroy)#lambda w, e: True)

        hbox = Gtk.HBox()
        hbox.set_spacing(gu.hig.SPACE_LARGE)
        hbox.set_border_width(gu.hig.SPACE_SMALL)
        self.vbox.pack_start(hbox, True, True, 0)

        frame = Gtk.Frame()
        self.g_pages = Gtk.TreeStore(str)
        self.g_pview = Gtk.TreeView(self.g_pages)
        self.g_pview.set_headers_visible(False)
        hbox.pack_start(frame, False, False, 0)
        frame.add(self.g_pview)

        self.g_page_box = Gtk.HBox()
        hbox.pack_start(self.g_page_box, True, True, 0)
        self.m_page_mapping = {}

        def cursor_changed(treeview):
            path, col = treeview.get_cursor()
            if not path:
                return
            path = tuple(path)
            for key, page in self.m_page_mapping.items():

                if key == path:
                    page.show()

                else:
                    page.hide()
            self.m_page_mapping[path].show_all()
        tvcol = Gtk.TreeViewColumn("Col 0")
        self.g_pview.append_column(tvcol)
        cell = Gtk.CellRendererText()
        tvcol.pack_start(cell, True)
        tvcol.add_attribute(cell, 'text', 0)
        hbox.show_all()

        self.create_midi_config()
        self.create_user_config()
        self.create_external_programs_config()
        self.create_gui_config()
        self.create_practise_config()
        self.create_sound_config()
        self.create_statistics_config()
        self.g_pview.connect('cursor-changed', cursor_changed)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号