def __init__(self, parent, name='SDLConfigWidget'):
     BaseDosboxConfigWidget.__init__(self, parent, name=name)
     numrows = 2
     numcols = 2
     margin = 0
     space = 1
     self.grid = QGridLayout(self, numrows, numcols,
                             margin, space, 'SDLConfigWidgetLayout')
     self.myconfig = self.app.myconfig
     res = self.myconfig.get('dosbox_profiles', 'default_resolutions')
     resolutions = [r.strip() for r in res.split(',')]
     self._default_resolutions = ['original'] + resolutions
     self._default_outputs = ['surface', 'overlay', 'opengl', 'openglnb', 'ddraw']
     self._default_priorities = ['lowest', 'lower', 'normal', 'higher', 'highest']
     self.new_stuff()
     self.localconfig.add_section('sdl')
    def __init__(self, parent, name="SDLConfigWidget"):
        BaseDosboxConfigWidget.__init__(self, parent, name=name)
        numrows = 2
        numcols = 3
        margin = 10
        space = 7
        self._default_machines = ["vga", "cga", "tandy", "pcjr", "hercules"]
        self._default_scalers = [
            "none",
            "normal2x",
            "normal3x",
            "advmame2x",
            "advmame3x",
            "advinterp2x",
            "advinterp3x",
            "tv2x",
            "tv3x",
            "rgb2x",
            "rgb3x",
            "scan2x",
            "scan3x",
        ]
        self._default_cores = ["simple", "normal", "full", "dynamic"]
        for section in ["render", "cpu", "dosbox", "dos", "bios", "serial", "ipx"]:
            self.localconfig.add_section(section)
        self.grid = QGridLayout(self, numrows, numcols, margin, space, "MachineConfigWidgetLayout")

        # render group
        self.render_groupbox = VerticalGroupBox(self, "Render Options")
        self.render_groupbox.setColumns(2)
        self.grid.addWidget(self.render_groupbox, 0, 1)
        self.frameskip_box = ConfigSpinWidget(self.render_groupbox, "Frame skip", suffix=" frames")
        self.tooltips.add(self.frameskip_box, "How many frames to skip.")
        self.aspect_check = QCheckBox(self.render_groupbox)
        self.aspect_check.setText("Aspect correction")
        self.tooltips.add(self.aspect_check, "Try to keep aspect ratio.")
        self.scaler_box = ConfigComboBoxWidget(self.render_groupbox, "Scaler", self._default_scalers)
        self.tooltips.add(self.scaler_box, "Select size and effect of video")
        # cpu group
        # make a big number for cycles that should never be needed
        cyclemax = int(1e6)
        self.cpu_groupbox = VerticalGroupBox(self, "CPU Options")
        self.cpu_groupbox.setColumns(2)
        self.grid.addWidget(self.cpu_groupbox, 0, 0)
        self.core_box = ConfigComboBoxWidget(self.cpu_groupbox, "Core", self._default_cores)
        self.tooltips.add(self.core_box, "Select type of cpu core")
        self.cycles_box = ConfigSpinWidget(self.cpu_groupbox, "Cycles", max=cyclemax, suffix=" cycles")
        tt = "The number of cycles to attempt to perform in a second"
        self.tooltips.add(self.cycles_box, tt)
        self.cycleup_box = ConfigSpinWidget(self.cpu_groupbox, "Cycle up increment", max=cyclemax, suffix=" cycles")
        self.cycledown_box = ConfigSpinWidget(self.cpu_groupbox, "Cycle down increment", max=cyclemax, suffix=" cycles")

        # dosbox group
        self.dosbox_groupbox = VerticalGroupBox(self, "Dosbox Options")
        self.dosbox_groupbox.setColumns(3)
        # row 1, first two columns
        # self.grid.addMultiCellWidget(self.dosbox_groupbox, 1, 1, 0, 1)
        self.grid.addWidget(self.dosbox_groupbox, 1, 0)
        self.language_entry = ConfigKURLSelectWidget(self.dosbox_groupbox, "Language file")
        self.memsize_box = ConfigSpinWidget(self.dosbox_groupbox, "Memory size", suffix="MB")
        self.captures_entry = ConfigKURLSelectWidget(self.dosbox_groupbox, "Captures directory", filetype="dir")

        # dos group
        self.dos_groupbox = VerticalGroupBox(self, "Dos Options")
        self.dos_groupbox.setColumns(3)
        self.grid.addWidget(self.dos_groupbox, 1, 1)
        self.xms_check = QCheckBox(self.dos_groupbox)
        self.xms_check.setText("Enable XMS support")
        self.ems_check = QCheckBox(self.dos_groupbox)
        self.ems_check.setText("Enable EMS support")
        self.umb_check = QCheckBox(self.dos_groupbox)
        self.umb_check.setText("Enable UMB support")

        # peripheral options
        self.peripheral_groupbox = VerticalGroupBox(self, "Peripheral Options")
        self.peripheral_groupbox.setColumns(1)
        # self.grid.addWidget(self.peripheral_groupbox, 2, 0)
        self.grid.addMultiCellWidget(self.peripheral_groupbox, 2, 2, 0, 2)
        # peripherals in bios section
        self.bios_groupbox = VerticalGroupBox(self.peripheral_groupbox, "Bios Options")
        self.bios_groupbox.setColumns(1)
        joystick_types = ["none", "2axis", "4axis", "fcs", "ch"]
        self.joysticktype_box = ConfigComboBoxWidget(self.bios_groupbox, "Joystick type", joystick_types)
        # peripherals in serial section
        self.serial_groupbox = VerticalGroupBox(self.peripheral_groupbox, "Serial Options")
        self.serial_groupbox.setColumns(2)
        self.serial_warning_lbl = QLabel("These options are", self.serial_groupbox)
        self.serial_warning_lbl2 = QLabel("not fully suported yet.", self.serial_groupbox)
        self.serial1_box = SerialPortOption(self.serial_groupbox, "Serial 1")
        self.serial2_box = SerialPortOption(self.serial_groupbox, "Serial 2")
        self.serial3_box = SerialPortOption(self.serial_groupbox, "Serial 3")
        self.serial4_box = SerialPortOption(self.serial_groupbox, "Serial 4")

        # ipx options
        self.ipx_groupbox = VerticalGroupBox(self, "IPX Options")
        self.ipx_groupbox.setColumns(1)
        self.grid.addWidget(self.ipx_groupbox, 1, 2)
        self.ipx_check = QCheckBox(self.ipx_groupbox)
        self.ipx_check.setText("Enable ipx over UDP/IP emulation")
    def __init__(self, parent, name="SDLConfigWidget"):
        BaseDosboxConfigWidget.__init__(self, parent, name=name)
        numrows = 2
        numcols = 3
        margin = 10
        space = 7
        self._default_mpu401_types = ["none", "uart", "intelligent"]
        self._default_midi_devices = ["default", "none", "alsa", "oss", "coreaudio", "win32"]
        self._default_sbtypes = ["none", "sb1", "sb2", "sbpro1", "sbpro2", "sb16"]
        self._default_tandyopts = ["auto", "on", "off"]
        self.grid = QGridLayout(self, numrows, numcols, margin, space, "SDLConfigWidgetLayout")
        for section in ["mixer", "midi", "sblaster", "gus", "speaker"]:
            self.localconfig.add_section(section)

        # mixer group
        self.mixer_groupbox = VerticalGroupBox(self, "Mixer Options")
        self.mixer_groupbox.setColumns(4)
        self.grid.addWidget(self.mixer_groupbox, 0, 0)
        self.nosound_check = QCheckBox(self.mixer_groupbox)
        self.nosound_check.setText("Disable sound")
        self.sample_rate_box = SampleRateOption(self.mixer_groupbox, "Sample rate")
        # magic number for maximum block size
        self.blocksize_box = ConfigSpinWidget(
            self.mixer_groupbox, "Mixer block size", min=0, max=262144, suffix=" bytes"
        )
        # magic number for maximum prebuffer (10 secs)
        self.prebuffer_box = ConfigSpinWidget(self.mixer_groupbox, "Prebuffer", min=0, max=10000, suffix=" msec")

        # midi group
        self.midi_groupbox = VerticalGroupBox(self, "MIDI Options")
        self.midi_groupbox.setColumns(4)
        self.grid.addWidget(self.midi_groupbox, 1, 1)
        self.mpu401_box = ConfigComboBoxWidget(self.midi_groupbox, "mpu401 type", self._default_mpu401_types)
        self.midi_device_box = ConfigComboBoxWidget(self.midi_groupbox, "MIDI device", self._default_midi_devices)
        self.midi_config_box = ConfigLineEditWidget(self.midi_groupbox, "MIDI config")

        # speaker group
        self.speaker_groupbox = VerticalGroupBox(self, "PC Speaker Options")
        self.speaker_groupbox.setColumns(5)
        self.grid.addMultiCellWidget(self.speaker_groupbox, 1, 1, 0, 0)
        self.enable_speaker_check = QCheckBox(self.speaker_groupbox)
        self.enable_speaker_check.setText("Enable PC speaker emulation")
        self.pc_rate_box = SampleRateOption(self.speaker_groupbox, "Sample rate of PC speaker")
        self.enable_tandy_box = ConfigComboBoxWidget(
            self.speaker_groupbox, "Enable Tandy Sound System emulation", self._default_tandyopts
        )
        self.tandy_rate_box = SampleRateOption(self.speaker_groupbox, "Sample rate of Tandy Sound System")
        self.enable_disney_check = QCheckBox(self.speaker_groupbox)
        self.enable_disney_check.setText("Enable Disney Sound Source emulation")

        # sblaster group
        self.sblaster_groupbox = VerticalGroupBox(self, "SoundBlaster Options")
        self.sblaster_groupbox.setColumns(2)
        # self.grid.addWidget(self.sblaster_groupbox, 0, 0)
        self.grid.addMultiCellWidget(self.sblaster_groupbox, 0, 0, 0, 1)
        self.sbtype_box = ConfigComboBoxWidget(self.sblaster_groupbox, "SoundBlaster type", self._default_sbtypes)
        self.sblaster_hwopt_groupbox = VerticalGroupBox(self.sblaster_groupbox, "SoundBlaster Hardware Options")
        self.sblaster_hwopt_groupbox.setColumns(1)
        self.sblaster_hwopt_box = SoundBlasterHardwareOptions(self.sblaster_hwopt_groupbox)

        self.sb_mixer_check = QCheckBox(self.sblaster_groupbox)
        self.sb_mixer_check.setText("SoundBlaster modifies dosbox mixer")
        self.sblaster_oplopt_groupbox = VerticalGroupBox(self.sblaster_groupbox, "SoundBlaster OPL Options")
        self.sblaster_oplopt_groupbox.setColumns(1)
        self.sblaster_oplopt_box = SoundBlasterOPLOptions(self.sblaster_oplopt_groupbox)

        # gus group
        self.gus_groupbox = VerticalGroupBox(self, "Gravis Ultrasound Options")
        self.gus_groupbox.setColumns(5)
        # self.grid.addWidget(self.gus_groupbox, 2, 1)
        self.grid.addMultiCellWidget(self.gus_groupbox, 0, 1, 2, 2)
        self.enable_gus_check = QCheckBox(self.gus_groupbox)
        self.enable_gus_check.setText("Enable Gravis Ultrasound emulation")
        self.gus_hwopt_groupbox = VerticalGroupBox(self.gus_groupbox, "Gravis Ultrasound hardware options")
        self.gus_hwopt_groupbox.setColumns(1)
        self.gus_hwopt_box = GusHardwareOptions(self.gus_hwopt_groupbox)
        self.gus_rate_box = SampleRateOption(self.gus_groupbox)
        self.gus_ultradir_box = ConfigKURLSelectWidget(self.gus_groupbox, "GUS patches directory", filetype="dir")
    def __init__(self, parent, name='SDLConfigWidget'):
        BaseDosboxConfigWidget.__init__(self, parent, name=name)
        numrows = 2
        numcols = 3
        margin = 10
        space = 7
        self._default_machines = ['vga', 'cga', 'tandy', 'pcjr', 'hercules']
        self._default_scalers = ['none', 'normal2x', 'normal3x', 'advmame2x', 'advmame3x',
                                 'advinterp2x', 'advinterp3x', 'tv2x', 'tv3x',
                                 'rgb2x', 'rgb3x', 'scan2x', 'scan3x']
        self._default_cores = ['simple', 'normal', 'full', 'dynamic', 'auto']
        for section in ['render', 'cpu', 'dosbox', 'dos', 'bios', 'serial', 'ipx']:
            self.localconfig.add_section(section)
        self.grid = QGridLayout(self, numrows, numcols,
                                margin, space, 'MachineConfigWidgetLayout')

        # render group
        self.render_groupbox = VerticalGroupBox(self, 'Render Options')
        self.render_groupbox.setColumns(2)
        self.grid.addWidget(self.render_groupbox, 0, 1)
        self.frameskip_box = ConfigSpinWidget(self.render_groupbox,
                                              'Frame skip', suffix=' frames')
        self.tooltips.add(self.frameskip_box, 'How many frames to skip.')
        self.aspect_check = QCheckBox(self.render_groupbox)
        self.aspect_check.setText('Aspect correction')
        self.tooltips.add(self.aspect_check, 'Try to keep aspect ratio.')
        self.scaler_box = ConfigComboBoxWidget(self.render_groupbox,
                                               'Scaler', self._default_scalers)
        self.tooltips.add(self.scaler_box, 'Select size and effect of video')
        # cpu group
        # make a big number for cycles that should never be needed
        cyclemax = int(1e6)
        self.cpu_groupbox = VerticalGroupBox(self, 'CPU Options')
        self.cpu_groupbox.setColumns(2)
        self.grid.addWidget(self.cpu_groupbox, 0, 0)
        self.core_box = ConfigComboBoxWidget(self.cpu_groupbox,
                                             'Core', self._default_cores)
        self.tooltips.add(self.core_box, 'Select type of cpu core')
        self.cycles_box = ConfigSpinWidget(self.cpu_groupbox,
                                           'Cycles', max=cyclemax, suffix=' cycles')
        tt = 'The number of cycles to attempt to perform in a second'
        self.tooltips.add(self.cycles_box, tt)
        self.cycleup_box = ConfigSpinWidget(self.cpu_groupbox,
                                            'Cycle up increment', max=cyclemax,
                                            suffix=' cycles')
        self.cycledown_box = ConfigSpinWidget(self.cpu_groupbox,
                                              'Cycle down increment', max=cyclemax,
                                              suffix=' cycles')
        
        # dosbox group
        self.dosbox_groupbox = VerticalGroupBox(self, 'Dosbox Options')
        self.dosbox_groupbox.setColumns(3)
        # row 1, first two columns
        #self.grid.addMultiCellWidget(self.dosbox_groupbox, 1, 1, 0, 1)
        self.grid.addWidget(self.dosbox_groupbox, 1, 0)
        self.language_entry = ConfigKURLSelectWidget(self.dosbox_groupbox,
                                                     'Language file')
        self.memsize_box = ConfigSpinWidget(self.dosbox_groupbox,
                                            'Memory size', suffix='MB')
        self.captures_entry = ConfigKURLSelectWidget(self.dosbox_groupbox,
                                                     'Captures directory', filetype='dir')
            
        # dos group
        self.dos_groupbox = VerticalGroupBox(self, 'Dos Options')
        self.dos_groupbox.setColumns(3)
        self.grid.addWidget(self.dos_groupbox, 1, 1)
        self.xms_check = QCheckBox(self.dos_groupbox)
        self.xms_check.setText('Enable XMS support')
        self.ems_check = QCheckBox(self.dos_groupbox)
        self.ems_check.setText('Enable EMS support')
        self.umb_check = QCheckBox(self.dos_groupbox)
        self.umb_check.setText('Enable UMB support')

        # peripheral options
        self.peripheral_groupbox = VerticalGroupBox(self, 'Peripheral Options')
        self.peripheral_groupbox.setColumns(1)
        #self.grid.addWidget(self.peripheral_groupbox, 2, 0)
        self.grid.addMultiCellWidget(self.peripheral_groupbox, 2, 2, 0, 2)
        # peripherals in bios section
        self.bios_groupbox = VerticalGroupBox(self.peripheral_groupbox, 'Bios Options')
        self.bios_groupbox.setColumns(1)
        joystick_types = ['none', '2axis', '4axis', 'fcs', 'ch']
        self.joysticktype_box = ConfigComboBoxWidget(self.bios_groupbox,
                                                     'Joystick type', joystick_types)
        # peripherals in serial section
        self.serial_groupbox = VerticalGroupBox(self.peripheral_groupbox, 'Serial Options')
        self.serial_groupbox.setColumns(2)
        self.serial_warning_lbl = QLabel('These options are',
                                         self.serial_groupbox)
        self.serial_warning_lbl2 = QLabel('not fully suported yet.', self.serial_groupbox)
        self.serial1_box = SerialPortOption(self.serial_groupbox, 'Serial 1')
        self.serial2_box = SerialPortOption(self.serial_groupbox, 'Serial 2')
        self.serial3_box = SerialPortOption(self.serial_groupbox, 'Serial 3')
        self.serial4_box = SerialPortOption(self.serial_groupbox, 'Serial 4')

        # ipx options
        self.ipx_groupbox = VerticalGroupBox(self, 'IPX Options')
        self.ipx_groupbox.setColumns(1)
        self.grid.addWidget(self.ipx_groupbox, 1, 2)
        self.ipx_check = QCheckBox(self.ipx_groupbox)
        self.ipx_check.setText('Enable ipx over UDP/IP emulation')