コード例 #1
0
 def __init__(self, parent, name='DosboxConfigWidget'):
     KTabWidget.__init__(self, parent, name)
     self.sdltab = SDLConfigWidget(self)
     self.insertTab(self.sdltab, 'sdl')
     self.machinetab = MachineConfigWidget(self)
     self.insertTab(self.machinetab, 'machine')
     self.soundtab = SoundConfigWidget(self)
     self.insertTab(self.soundtab, 'sound')
     # testing stuff
     self.testtab = TestConfigTab(self)
     self.insertTab(self.testtab, 'test me')
     self.connect(self.testtab.button, SIGNAL('clicked()'), self.get_config)        
コード例 #2
0
class DosboxConfigTabWidget(KTabWidget):
    def __init__(self, parent, name='DosboxConfigWidget'):
        KTabWidget.__init__(self, parent, name)
        self.sdltab = SDLConfigWidget(self)
        self.insertTab(self.sdltab, 'sdl')
        self.machinetab = MachineConfigWidget(self)
        self.insertTab(self.machinetab, 'machine')
        self.soundtab = SoundConfigWidget(self)
        self.insertTab(self.soundtab, 'sound')
        # testing stuff
        self.testtab = TestConfigTab(self)
        self.insertTab(self.testtab, 'test me')
        self.connect(self.testtab.button, SIGNAL('clicked()'), self.get_config)        

    def get_config(self):
        sdlcfg = self.sdltab.get_config()
        machinecfg = self.machinetab.get_config()
        soundcfg = self.soundtab.get_config()
        mainconfig = ConfigParser()
        self._import_new_config(mainconfig, sdlcfg)
        self._import_new_config(mainconfig, machinecfg)
        self._import_new_config(mainconfig, soundcfg)
        # testing stuff
        self.testtab.set_config(mainconfig)
        return mainconfig
    
        
    def _import_new_config(self, mainconfig, localconfig):
        cfile = StringIO()
        localconfig.write(cfile)
        cfile.seek(0)
        mainconfig.readfp(cfile)
        cfile.close()
        
    def set_config(self, configobj):
        self.sdltab.set_config(configobj)
        self.machinetab.set_config(configobj)
        self.soundtab.set_config(configobj)