Пример #1
0
    def __init__(self, parent, name='ProfileManagerWidget'):
        QSplitter.__init__(self, parent, name)
        self.app = get_application_pointer()
        #self.listView = KListView(self)
        self.cfgView = DosboxConfigTabWidget(self)
        self.dbox = self.app.make_new_dosbox_object()

        #self.initlistView()
        cfg = self.dbox.get_default_config()
        self.cfgView.set_config(cfg)
Пример #2
0
class ProfileManagerWidget(QSplitter):
    def __init__(self, parent, name='ProfileManagerWidget'):
        QSplitter.__init__(self, parent, name)
        self.app = get_application_pointer()
        #self.listView = KListView(self)
        self.cfgView = DosboxConfigTabWidget(self)
        self.dbox = self.app.make_new_dosbox_object()

        #self.initlistView()
        cfg = self.dbox.get_default_config()
        self.cfgView.set_config(cfg)
        #self.connect(self.listView,
        #             SIGNAL('selectionChanged()'), self.selectionChanged)
        
    def initlistView(self):
        self.listView.addColumn('profile')
        self.refreshListView()
        
    def refreshListView(self):
        self.listView.clear()
        for profile in self.dbox.get_profile_list():
            item = KListViewItem(self.listView, profile)
            item.profile = profile

    def save_profile(self, profile):
        configobj = self.cfgView.get_config()
        self.dbox.save_profile(profile, configobj)

    def selectionChanged(self):
        item = self.listView.currentItem()
        profile = item.profile
        self.select_profile(profile)

    def select_profile(self, profile):
        cfg = self.dbox.load_profile(profile)
        self.cfgView.set_config(cfg)