Пример #1
0
 def __init__(self, glade_filename, window_name, emu_name, emu_list_idx):
     """build the window"""
     WahCade.__init__(self)
     GladeSupport.__init__(self, glade_filename, window_name, APP_NAME)
     self.config_dir = CONFIG_DIR
     self.emu_name = emu_name
     self.emu_list_idx = emu_list_idx
     #games list
     self.tvwList, self.lsList, self.tvwsList = self.setup_treeview(
         columns = [
             'Game Name',
             'ROM Name',
             'Year',
             'Manufacturer',
             'Clone Of',
             'Rom Of',
             'Display Type',
             'Screen Type',
             'Controller Type',
             'Driver Status',
             'Colour Status',
             'Sound Status',
             'Category'],
         column_types = [gobject.TYPE_STRING] * self.NUM_COLS,
         container = self.scwList,
         edit_cell_cb = self.on_tvwList_edited,
         resizeable_cols = True,
         highlight_rows = False)
     #self.tvwList.connect('row-activated', self.on_tvwList_activated)
     self.tvwList.connect('key-release-event', self.on_tvwList_key_event)
     #activate multiple selection mode on tvwsList
     self.tvwsList.set_mode(gtk.SELECTION_MULTIPLE)
     #load lists
     i = 0
     emu_game_lists = []
     while True:
         ini_file = os.path.join(self.config_dir, 'ini', '%s-%s.ini' % (self.emu_name, i))
         if os.path.isfile(ini_file):
             list_ini = MameWahIni(ini_file)
             emu_game_lists.append(list_ini.get('list_title'))
             i += 1
         else:
             break
     l = ['%s: %s' % (i, r) for i, r in enumerate(emu_game_lists)]
     self.setup_combo_box(self.cboList, l)
     #setup filters & emu ini
     emu_ini_filename = os.path.join(self.config_dir, 'ini', '%s.ini' % (self.emu_name))
     if os.path.isfile(emu_ini_filename):
         self.emu_ini = MameWahIni(emu_ini_filename)
         #filters._mameinfo_file = os.path.join(self.emu_ini.get('dat_file'))
         filters._catver_ini = os.path.join(self.emu_ini.get('catver_ini_file'))
     else:
         print _("Error: Emulator Ini file: [%s] doesn't exist" % (emu_ini_filename))
     #load filter
     self.new_iter = None
     self.new_path = None
     self.new_col = 0
     self.list_altered = False
     self.cboList.set_active(self.emu_list_idx)
Пример #2
0
 def __init__(self, glade_filename, window_name, emu_name, emu_list_idx):
     """build the window"""
     WahCade.__init__(self)
     GladeSupport.__init__(self, glade_filename, window_name,
                           constants.app_name)
     self.config_dir = CONFIG_DIR
     self.emu_name = emu_name
     self.emu_list_idx = emu_list_idx
     #games list
     self.tvwList, self.lsList, self.tvwsList = self.setup_treeview(
         columns=[
             'Game Name', 'ROM Name', 'Year', 'Manufacturer', 'Clone Of',
             'Rom Of', 'Display Type', 'Screen Type', 'Controller Type',
             'Driver Status', 'Colour Status', 'Sound Status', 'Category'
         ],
         column_types=[gobject.TYPE_STRING] * self.NUM_COLS,
         container=self.scwList,
         edit_cell_cb=self.on_tvwList_edited,
         resizeable_cols=True,
         highlight_rows=False)
     #self.tvwList.connect('row-activated', self.on_tvwList_activated)
     self.tvwList.connect('key-release-event', self.on_tvwList_key_event)
     #activate multiple selection mode on tvwsList
     self.tvwsList.set_mode(gtk.SELECTION_MULTIPLE)
     #load lists
     i = 0
     emu_game_lists = []
     while True:
         ini_file = os.path.join(self.config_dir, 'ini',
                                 '%s-%s.ini' % (self.emu_name, i))
         if os.path.isfile(ini_file):
             list_ini = MameWahIni(ini_file)
             emu_game_lists.append(list_ini.get('list_title'))
             i += 1
         else:
             break
     l = ['%s: %s' % (i, r) for i, r in enumerate(emu_game_lists)]
     self.setup_combo_box(self.cboList, l)
     #setup filters & emu ini
     emu_ini_filename = os.path.join(self.config_dir, 'ini',
                                     '%s.ini' % (self.emu_name))
     if os.path.isfile(emu_ini_filename):
         self.emu_ini = MameWahIni(emu_ini_filename)
         #filters._mameinfo_file = os.path.join(self.emu_ini.get('dat_file'))
         filters._catver_ini = os.path.join(
             self.emu_ini.get('catver_ini_file'))
     else:
         print _("Error: Emulator Ini file: [%s] doesn't exist" %
                 (emu_ini_filename))
     #load filter
     self.new_iter = None
     self.new_path = None
     self.new_col = 0
     self.list_altered = False
     self.cboList.set_active(self.emu_list_idx)
Пример #3
0
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
from constants import *
from wc_common import WahCade

wc = WahCade()

import gtk

_ = gettext.gettext
pygame_imported = False
try:
    import pygame
    pygame_imported = True
except ImportError:
    print _('Warning: pygame module not found.  Joysticks not supported')


class joystick:
    """pygame joystick class"""
    def __init__(self, debug=False):
Пример #4
0
    def __init__(self, glade_filename, window_name, emu_name):
        """build the window"""
        WahCade.__init__(self)
        GladeSupport.__init__(self, glade_filename, window_name, APP_NAME)
        self.config_dir = CONFIG_DIR
        #print "emu_name=",emu_name
        self.emu_name = emu_name
        self.emu_list_idx = 0
        #setup tree & lists
        self.tsFilter = gtk.TreeStore(str, gobject.TYPE_BOOLEAN, str)
        self.tvwFilter = gtk.TreeView(model = self.tsFilter)
        #text col
        cellrt = gtk.CellRendererText()
        tvcol = gtk.TreeViewColumn(_('Filter'))
        tvcol.pack_start(cellrt, True)
        tvcol.add_attribute(cellrt, 'text', 0)
        tvcol.set_resizable(True)
        #checkbox col
        crt = gtk.CellRendererToggle()
        crt.set_property('activatable', True)
        crt.connect('toggled', self.on_tvwFilter_toggled, self.tsFilter)
        tvcol2 = gtk.TreeViewColumn(_('Selected?'), crt)
        tvcol2.add_attribute(crt, 'active', 1)
        #add columns to treeview
        self.tvwFilter.append_column(tvcol)
        self.tvwFilter.append_column(tvcol2)
        #self.tvwFilter.set_rules_hint(True)
        self.tvwFilter.show()
        self.scwFilter.add(self.tvwFilter)
        #games list
        self.tvwGames, self.lsGames, self.tvwsGames = self.setup_treeview(
            columns = ['Games'],
            column_types = [gobject.TYPE_STRING],
            container = self.scwGameList,
            resizeable_cols = True,
            highlight_rows = False)

        #load lists
        i = 0
        emu_game_lists = []
        while True:
            ini_file = os.path.join(self.config_dir, 'ini', '%s-%s.ini' % (self.emu_name, i))
            if os.path.isfile(ini_file):
                list_ini = MameWahIni(ini_file)
                emu_game_lists.append(list_ini.get('list_title'))
                i += 1
            else:
                break
        l = ['%s: %s' % (i, r) for i, r in enumerate(emu_game_lists)]
        
        #setup filters & emu ini
        emu_ini_filename = os.path.join(self.config_dir, 'ini', '%s.ini' % (self.emu_name))
        if os.path.isfile(emu_ini_filename):
            self.emu_ini = MameWahIni(emu_ini_filename)
            #filters._mameinfo_file = os.path.join(self.emu_ini.get('dat_file'))
            filters._catver_ini = os.path.join(self.emu_ini.get('catver_ini_file'))
        else:
            print _("Error: Emulator Ini file: [%s] doesn't exist" % (emu_ini_filename))
       
        #filter values
        if os.path.isfile(self.emu_ini.get('dat_file')):
            self._display_clones = [
                [_('No'), 'no'],
                [_('Yes'), 'yes'],
                [_('Only if better than Parent'), 'better']]
            self._filter_sections = [
                ['filter_type', _('Display Clones')],
                ['year', _('Year Filters')],
                ['manufacturer', _('Manufacturer Filters')],
                ['driver', _('BIOS Filters')],
                ['display_type', _('Screen Type Filters')],
                ['screen_type', _('Screen Orientation Filters')],
                ['controller_type', _('Input Type Filters')],
                ['driver_status', _('General Status Filters')],
                ['colour_status', _('Colour Status Filters')],
                ['sound_status', _('Sound Status Filters')],
                ['category', _('Category Filters')]]
        elif os.path.isfile(self.emu_ini.get('catver_ini_file')):
            self._filter_sections = [['category', _('Category Filters')]]
        else:
            self._filter_sections = []         
        self.setup_combo_box(self.cboLists, l)
        #load filter
        self.cboLists.set_active(self.emu_list_idx)
        self.filter_altered = False
Пример #5
0
 def __init__(self, glade_filename, window_name, config_opts, config_args):
     """build the window"""
     WahCade.__init__(self)
     GladeSupport.__init__(self, glade_filename, window_name, APP_NAME)
     #command-line options
     self.config_opts = config_opts
     #set default config location (create / update as necessary)
     self.config_dir = CONFIG_DIR
     if not os.path.exists(self.config_dir):
         self.copy_user_config('all')
     else:
         #update current config
         self.copy_user_config()
     #keys list
     self.tvwKeys, self.lsKeys, self.tvwsKeys = self.setup_treeview(
         columns = ['Function', 'Key'],
         column_types = [gobject.TYPE_STRING, gobject.TYPE_STRING],
         container = self.scwKeys,
         resizeable_cols = False)
     self.lsKeys.set_sort_column_id(0, gtk.SORT_ASCENDING)
     self.tvwKeys.connect('row-activated', self.on_tvwKeys_row_activated)
     self.tvwKeys.set_tooltip_text(_('Double-Click a row to change a Key...'))
     #set max width for keys column (stops window getting too wide)
     col = self.tvwKeys.get_column(1)
     col.set_max_width(200)
     #get ini files
     self.wahcade_ini = MameWahIni(os.path.join(self.config_dir, 'wahcade.ini'))
     self.histview_ini = MameWahIni(os.path.join(self.config_dir, 'histview.ini'))
     self.cpviewer_ini = MameWahIni(os.path.join(self.config_dir, 'cpviewer.ini'))
     self.ctrlr_ini = MameWahIni(os.path.join(self.config_dir, 'ctrlr', 'default.ini'), 'ctrlr')
     #emu stuff
     self.emu_list_gen_types = [
         [['rom_folder'], 'Rom Directory'],
         [['rom_folder_vs_listxml', 'list_xml'], 'XML File'],
         [['rom_folder_vs_dat_file', 'dat_file'], 'DAT File']]
     self.emu_scrsave_types = [
         ['blank_screen', 'Blank Screen'],
         ['slideshow', 'Slide Show'],
         ['movie', 'Movies'],
         ['launch_scr', 'Launch External Screen Saver']]
     self.emu_list_types = [
         ['normal', 'Normal'],
         ['most_played', 'Most Played'],
         ['longest_played', 'Longest Played']]
     self.music_movie_mix = [
         ['mute_movies', 'Mute Movies'],
         ['merge', 'Mix with Music']]
     self.emu_artwork_txe = [
         self.txeEmuArt1, self.txeEmuArt2, self.txeEmuArt3, self.txeEmuArt4,
         self.txeEmuArt5, self.txeEmuArt6, self.txeEmuArt7, self.txeEmuArt8,
         self.txeEmuArt9, self.txeEmuArt10]
     self.emu_artwork_btn = [
         self.btnEmuArt1, self.btnEmuArt2, self.btnEmuArt3, self.btnEmuArt4,
         self.btnEmuArt5, self.btnEmuArt6, self.btnEmuArt7, self.btnEmuArt8,
         self.btnEmuArt9, self.btnEmuArt10]
     #setup combo boxes
     self.setup_combo_box(self.cboEmuScrSaver, [r[1] for r in self.emu_scrsave_types])
     self.setup_combo_box(self.cboEmuListGen, [r[1] for r in self.emu_list_gen_types])
     self.setup_combo_box(self.cboEmuListType, [r[1] for r in self.emu_list_types])
     self.setup_combo_box(self.cboWCMovieMix, [r[1] for r in self.music_movie_mix])
     #global joy
     self.joystick = joystick.joystick()
     self.joystick.use_all_controls()
     #get default window size & pos
     self.do_events()
     w, h = self.wahcade_ini.get('setup_window_size', 'default', '400x400').split('x')
     self.winSetup.resize(width=int(w), height=int(h))
     #load settings
     self.load_settings()
     self.setup_altered = False
     #set icon sizes
     settings = gtk.settings_get_default()
     settings.set_string_property('gtk-icon-sizes', 'gtk-button=16,16', '')
Пример #6
0
    def __init__(self, glade_filename, window_name, emu_name):
        """build the window"""
        WahCade.__init__(self)
        GladeSupport.__init__(self, glade_filename, window_name,
                              constants.app_name)
        self.config_dir = CONFIG_DIR
        #print "emu_name=",emu_name
        self.emu_name = emu_name
        self.emu_list_idx = 0
        #setup tree & lists
        self.tsFilter = gtk.TreeStore(str, gobject.TYPE_BOOLEAN, str)
        self.tvwFilter = gtk.TreeView(model=self.tsFilter)
        #text col
        cellrt = gtk.CellRendererText()
        tvcol = gtk.TreeViewColumn(_('Filter'))
        tvcol.pack_start(cellrt, True)
        tvcol.add_attribute(cellrt, 'text', 0)
        tvcol.set_resizable(True)
        #checkbox col
        crt = gtk.CellRendererToggle()
        crt.set_property('activatable', True)
        crt.connect('toggled', self.on_tvwFilter_toggled, self.tsFilter)
        tvcol2 = gtk.TreeViewColumn(_('Selected?'), crt)
        tvcol2.add_attribute(crt, 'active', 1)
        #add columns to treeview
        self.tvwFilter.append_column(tvcol)
        self.tvwFilter.append_column(tvcol2)
        #self.tvwFilter.set_rules_hint(True)
        self.tvwFilter.show()
        self.scwFilter.add(self.tvwFilter)
        #games list
        self.tvwGames, self.lsGames, self.tvwsGames = self.setup_treeview(
            columns=['Games'],
            column_types=[gobject.TYPE_STRING],
            container=self.scwGameList,
            resizeable_cols=True,
            highlight_rows=False)

        #load lists
        i = 0
        emu_game_lists = []
        while True:
            ini_file = os.path.join(CONFIG_DIR, 'ini',
                                    '%s-%s.ini' % (self.emu_name, i))
            if os.path.isfile(ini_file):
                list_ini = MameWahIni(ini_file)
                emu_game_lists.append(list_ini.get('list_title'))
                i += 1
            else:
                break
        l = ['%s: %s' % (i, r) for i, r in enumerate(emu_game_lists)]

        #setup filters & emu ini
        emu_ini_filename = os.path.join(CONFIG_DIR, 'ini',
                                        '%s.ini' % (self.emu_name))
        if os.path.isfile(emu_ini_filename):
            self.emu_ini = MameWahIni(emu_ini_filename)
            #filters._mameinfo_file = os.path.join(self.emu_ini.get('dat_file'))
            filters._catver_ini = os.path.join(
                self.emu_ini.get('catver_ini_file'))
        else:
            print _("Error: Emulator Ini file: [%s] doesn't exist" %
                    (emu_ini_filename))

        #filter values
        if os.path.isfile(self.emu_ini.get('dat_file')):
            self._display_clones = [[_('No'), 'no'], [_('Yes'), 'yes'],
                                    [
                                        _('Only if better than Parent'),
                                        'better'
                                    ]]
            self._filter_sections = [
                ['filter_type', _('Display Clones')],
                ['year', _('Year Filters')],
                ['manufacturer', _('Manufacturer Filters')],
                ['driver', _('BIOS Filters')],
                ['display_type', _('Screen Type Filters')],
                ['screen_type', _('Screen Orientation Filters')],
                ['controller_type', _('Input Type Filters')],
                ['driver_status', _('General Status Filters')],
                ['colour_status', _('Colour Status Filters')],
                ['sound_status', _('Sound Status Filters')],
                ['category', _('Category Filters')]
            ]
        elif os.path.isfile(self.emu_ini.get('catver_ini_file')):
            self._filter_sections = [['category', _('Category Filters')]]
        else:
            self._filter_sections = []
        self.setup_combo_box(self.cboLists, l)
        #load filter
        self.cboLists.set_active(self.emu_list_idx)
        self.filter_altered = False
Пример #7
0
 def __init__(self, glade_filename, window_name, config_opts, config_args):
     """build the window"""
     WahCade.__init__(self)
     GladeSupport.__init__(self, glade_filename, window_name, APP_NAME)
     #command-line options
     self.config_opts = config_opts
     #set default config location (create / update as necessary)
     self.config_dir = CONFIG_DIR
     if not os.path.exists(self.config_dir):
         self.copy_user_config('all')
     else:
         #update current config
         self.copy_user_config()
     #keys list
     self.tvwKeys, self.lsKeys, self.tvwsKeys = self.setup_treeview(
         columns = ['Function', 'Key'],
         column_types = [gobject.TYPE_STRING, gobject.TYPE_STRING],
         container = self.scwKeys,
         resizeable_cols = False)
     self.lsKeys.set_sort_column_id(0, gtk.SORT_ASCENDING)
     self.tvwKeys.connect('row-activated', self.on_tvwKeys_row_activated)
     self.tvwKeys.set_tooltip_text(_('Double-Click a row to change a Key...'))
     #set max width for keys column (stops window getting too wide)
     col = self.tvwKeys.get_column(1)
     col.set_max_width(200)
     #get ini files
     self.wahcade_ini = MameWahIni(os.path.join(self.config_dir, 'wahcade.ini'))
     self.histview_ini = MameWahIni(os.path.join(self.config_dir, 'histview.ini'))
     self.cpviewer_ini = MameWahIni(os.path.join(self.config_dir, 'cpviewer.ini'))
     self.ctrlr_ini = MameWahIni(os.path.join(self.config_dir, 'ctrlr', 'default.ini'), 'ctrlr')
     #emu stuff
     self.emu_list_gen_types = [
         [['rom_folder'], 'Rom Directory'],
         [['rom_folder_vs_listxml', 'list_xml'], 'XML File'],
         [['rom_folder_vs_dat_file', 'dat_file'], 'DAT File']]
     self.emu_scrsave_types = [
         ['blank_screen', 'Blank Screen'],
         ['slideshow', 'Slide Show'],
         ['movie', 'Movies'],
         ['launch_scr', 'Launch External Screen Saver']]
     self.emu_list_types = [
         ['normal', 'Normal'],
         ['most_played', 'Most Played'],
         ['longest_played', 'Longest Played'],
         ['hi2text_supported', 'High Score Supported'],
         ['xml_remote', 'XML Remote']]
     self.music_movie_mix = [
         ['mute_movies', 'Mute Movies'],
         ['merge', 'Mix with Music']]
     self.emu_artwork_txe = [
         self.txeEmuArt1, self.txeEmuArt2, self.txeEmuArt3, self.txeEmuArt4,
         self.txeEmuArt5, self.txeEmuArt6, self.txeEmuArt7, self.txeEmuArt8,
         self.txeEmuArt9, self.txeEmuArt10]
     self.emu_artwork_btn = [
         self.btnEmuArt1, self.btnEmuArt2, self.btnEmuArt3, self.btnEmuArt4,
         self.btnEmuArt5, self.btnEmuArt6, self.btnEmuArt7, self.btnEmuArt8,
         self.btnEmuArt9, self.btnEmuArt10]
     #setup combo boxes
     self.setup_combo_box(self.cboEmuScrSaver, [r[1] for r in self.emu_scrsave_types])
     self.setup_combo_box(self.cboEmuListGen, [r[1] for r in self.emu_list_gen_types])
     self.setup_combo_box(self.cboEmuListType, [r[1] for r in self.emu_list_types])
     self.setup_combo_box(self.cboWCMovieMix, [r[1] for r in self.music_movie_mix])
     #global joy
     self.joystick = joystick.joystick()
     self.joystick.use_all_controls()
     #get default window size & pos
     self.do_events()
     w, h = self.wahcade_ini.get('setup_window_size', 'default', '400x400').split('x')
     self.winSetup.resize(width=int(w), height=int(h))
     #load settings
     self.load_settings()
     self.setup_altered = False
     #set icon sizes
     settings = gtk.settings_get_default()
     settings.set_string_property('gtk-icon-sizes', 'gtk-button=16,16', '')