moved gfceu to gfceux

This commit is contained in:
punkrockguy318 2008-06-06 00:32:42 +00:00
parent 89ad67e441
commit 9eb1841bd8
2 changed files with 245 additions and 145 deletions

69
gfceu
View File

@ -1,7 +1,8 @@
#!/usr/bin/python
# gfceu - Graphical launcher for FCE Ultra.
# Designed on Ubuntu, with platfrom independence in mind.
version = "0.6.0"
version = "0.6.1svn"
title = "gfceux"
# Copyright (C) 2006 Lukas Sabota <punkrockguy318@comcast.net>
##
"""
@ -40,7 +41,7 @@ def gfceu_message(message, use_gtk=False):
messages. However, it can be used for important messages as well. If a
GTK message_box is requried, the use_gtk flag can be enabled
"""
print 'gfceu message: '+message
print title + ' message: '+message
if use_gtk:
msgbox = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_INFO,
buttons=gtk.BUTTONS_CLOSE)
@ -56,13 +57,13 @@ def gfceu_error(message, code, use_gtk=True, fatal=True):
in the standard python language. One of these days...
"""
print '# # # #'
print 'gfceu ERROR code '+str(code)+':'
print title + ' ERROR code '+str(code)+':'
print message
print '# # # #'
if use_gtk:
msgbox = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_ERROR,
buttons=gtk.BUTTONS_CLOSE)
msgbox.set_markup('gfceu ERROR Code '+str(code)+':\n'+message)
msgbox.set_markup(title + ' ERROR Code '+str(code)+':\n'+message)
msgbox.run()
msgbox.destroy()
if fatal:
@ -225,26 +226,26 @@ def set_options():
def launch(passed, local=False):
global xml, options, fceu_server_binary, fceu_binary, aoss_binary
global xml, options, fceu_server_binary, fceux_binary
set_options()
if options.sound_check:
sound = '-sound 1 '
sound = '--sound 1 '
else:
sound = '-sound 0 '
sound = '--sound 0 '
if options.fullscreen_check:
fullscreen = '-fs 1 '
fullscreen = '--fullscreen 1 '
else:
fullscreen = '-fs 0 '
fullscreen = '--fullscreen 0 '
if options.join_radio:
if options.join_pass == '':
netpass = ''
else:
netpass = '-netpassword ' + '"' + options.join_pass + '" '
network = '-connect "' + options.join_add + '"'\
' -netport '+ str(options.join_port) + ' ' + netpass
netpass = '--pass ' + '"' + options.join_pass + '" '
network = '-net "' + options.join_add + '"'\
' --port '+ str(options.join_port) + ' ' + netpass
else:
network = ''
@ -252,8 +253,8 @@ def launch(passed, local=False):
if options.host_pass == '':
netpass = ' '
else:
netpass = ' -netpassword ' + '"' + options.host_pass + '" '
network = '-connect localhost -netport '+\
netpass = ' --pass ' + '"' + options.host_pass + '" '
network = '--net localhost --port '+\
str(options.host_port) + netpass + ' '
@ -261,11 +262,11 @@ def launch(passed, local=False):
network = ''
if options.opengl_check:
opengl = '-opengl 1 '
opengl = '--opengl 1 '
else:
opengl = '-opengl 0 '
opengl = '--opengl 0 '
command = aoss_binary + ' ' + fceu_binary +' '+ sound + fullscreen +\
command = fceux_binary +' '+ sound + fullscreen +\
network + opengl + options.extra_entry + ' '+ passed
gfceu_message('Command: ' + command)
@ -297,7 +298,8 @@ def launch(passed, local=False):
os.kill(pid, 9)
widgets['main_window'].show()
def find_binary(this_binary):
def find_binary(file):
path = os.getenv('PATH')
directories= []
directory = ''
@ -310,12 +312,12 @@ def find_binary(this_binary):
directory = ''
for x in directories:
if os.path.isfile(os.path.join(x, this_binary)):
return os.path.join(x,this_binary)
if os.path.isfile(os.path.join(x, file)):
return os.path.join(x,file)
if os.path.isfile(os.path.join(os.curdir,file)):
return os.path.join(os.curdir, file)
if os.path.isfile(os.path.join(os.curdir,this_binary)):
return os.path.join(os.curdir, this_binary)
return None
# # # # # # # #
@ -483,11 +485,10 @@ class GladeHandlers:
##############################################################################
# Globals
options = None
appconfigdir = os.getenv('HOME') + '/.gfceu'
old_optionsfile = os.getenv('HOME')+'/.gfceu_options'
appconfigdir = os.getenv('HOME') + '/.'+ title
old_optionsfile = os.getenv('HOME')+'/.' + title + '_options'
optionsfile = appconfigdir + 'gfceu_options.dat'
fceu_binary = None
aoss_binary = None
fceux_binary = None
fceu_server_binary = None
#version is defined earlier in the code
#have_vfs is defined earlier in the code
@ -521,21 +522,15 @@ if __name__ == '__main__':
parser = OptionParser(version='%prog '+ version)
parser.parse_args()
fceu_binary = find_binary('fceu')
if fceu_binary == None:
fceux_binary = find_binary('fceux')
if fceux_binary == None:
gfceu_error('Could not find the fceu binary.\n\
Ensure that FCE Ultra is installed and in the $PATH.\n\
On Debian based systems (like Ubuntu), try the following command:\n\
sudo apt-get install fceu', 4, True)
else:
gfceu_message('Using: '+fceu_binary)
aoss_binary = find_binary('aoss')
if aoss_binary == None:
gfceu_error('Could not find the the ALSA OSS wrapper.\n\
GFCEU will not be able to share the sound device with other applications.\n\
On Debian based systems (like Ubuntu), try the following command:\n\
sudo apt-get install alsa-oss', 76, True, False)
gfceu_message('Using: '+fceux_binary)
widgets = WidgetsWrapper()
widgets['main_window'].show_all()
setup_environment()

View File

@ -67,22 +67,6 @@
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="sound_check">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable _Sound</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
<child>
@ -140,17 +124,30 @@
<property name="column_spacing">5</property>
<property name="row_spacing">5</property>
<child>
<widget class="GtkButton" id="gp3_button">
<widget class="GtkButton" id="gp1_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Gamepad _3</property>
<property name="label" translatable="yes">Gamepad _1</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="gamepad_clicked" after="yes"/>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="gp2_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Gamepad _2</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="gamepad_clicked" after="yes"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
@ -172,30 +169,17 @@
</packing>
</child>
<child>
<widget class="GtkButton" id="gp2_button">
<widget class="GtkButton" id="gp3_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Gamepad _2</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="gamepad_clicked" after="yes"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="gp1_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Gamepad _1</property>
<property name="label" translatable="yes">Gamepad _3</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="gamepad_clicked" after="yes"/>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
@ -271,6 +255,102 @@
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="xscale_box">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">X scale:</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="xscale">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">1 1 10 0.5 2 2</property>
<property name="numeric">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="yscale_box">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">Y scale:</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="yscale">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">1 1 10 0.5 1 10</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="bpp_box">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">Bits per pixel:</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="bpp">
<property name="visible">True</property>
<property name="active">3</property>
<property name="items" translatable="yes">8
16
32</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="screentip">
<property name="visible">True</property>
@ -281,7 +361,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="position">5</property>
</packing>
</child>
</widget>
@ -386,9 +466,35 @@ Invalid options may cause GFCE Ultra to perform incorrectly.
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="sound_check">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable _Sound</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="position">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Sound</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="position">4</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="network_vbox">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="border_width">5</property>
<property name="spacing">5</property>
<child>
@ -409,7 +515,6 @@ Invalid options may cause GFCE Ultra to perform incorrectly.
<child>
<widget class="GtkFrame" id="host_frame">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
@ -424,28 +529,13 @@ Invalid options may cause GFCE Ultra to perform incorrectly.
<property name="column_spacing">5</property>
<property name="row_spacing">5</property>
<child>
<widget class="GtkEntry" id="host_pass">
<widget class="GtkLabel" id="label19">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Port:</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="host_port">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">4046 1 65536 1 10 10</property>
<property name="climb_rate">1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
@ -463,13 +553,28 @@ Invalid options may cause GFCE Ultra to perform incorrectly.
</packing>
</child>
<child>
<widget class="GtkLabel" id="label19">
<widget class="GtkSpinButton" id="host_port">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Port:</property>
<property name="can_focus">True</property>
<property name="adjustment">4046 1 65536 1 10 10</property>
<property name="climb_rate">1</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="host_pass">
<property name="visible">True</property>
<property name="can_focus">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
@ -504,7 +609,6 @@ Invalid options may cause GFCE Ultra to perform incorrectly.
<child>
<widget class="GtkFrame" id="join_frame">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
@ -521,54 +625,13 @@ Invalid options may cause GFCE Ultra to perform incorrectly.
<property name="column_spacing">3</property>
<property name="row_spacing">5</property>
<child>
<widget class="GtkSpinButton" id="join_port">
<widget class="GtkEntry" id="join_add">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">4046 1 65536 1 10 10</property>
<property name="climb_rate">1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Password:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label16">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Server Port:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Server Address:</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
@ -588,13 +651,54 @@ Invalid options may cause GFCE Ultra to perform incorrectly.
</packing>
</child>
<child>
<widget class="GtkEntry" id="join_add">
<widget class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Server Address:</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label16">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Server Port:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Password:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="join_port">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">4046 1 65536 1 10 10</property>
<property name="climb_rate">1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
@ -629,17 +733,18 @@ Invalid options may cause GFCE Ultra to perform incorrectly.
</child>
</widget>
<packing>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="label" translatable="yes">Network</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="position">4</property>
<property name="position">5</property>
<property name="tab_fill">False</property>
</packing>
</child>