[patch] system shutdown from wah!cade

A nice (keyboard based) front end for Arcade / Console game emulators.

Moderator: battlecat

[patch] system shutdown from wah!cade

Postby nellistc » Wed Dec 05, 2007 1:16 pm

Hi,

I'm currently using wah!cade in a cocktail cab and needed a way to shutdown without a keyboard and without a power button (acpi). I also didn't want it to ask for a password and didn't want to run wah!cade as root. This patch is against 0.21.

Adding the following bits to win_options.py does the trick on (x)ubuntu (not tested on any other distro):

Code: Select all
--- win_options.py.orig 2007-12-05 23:10:47.000000000 +1100
+++ win_options.py      2007-12-05 23:09:24.000000000 +1100
@@ -25,6 +25,7 @@
import os
import sys
import string
+import dbus

#gtk
import pygtk
@@ -100,8 +101,9 @@
                 [_('Games List Options'), 'list_options'],
                 #['Launch External Application', 'external'],
                 [_('About...'), 'about'],
-                [_('Exit Wah!Cade'), 'exit']],
-            'list_options':
+               [_('Exit Wah!Cade'), 'exit'],
+               [_('Close Arcade'), 'shutdown']],
+          'list_options':
                 [[_('Add Game to List'), 'add_to_list'],
                 [_('Remove Game from List'), 'remove_from_list'],
                 [_('Generate Filtered List...'), 'generate_ftr'],
@@ -292,6 +294,12 @@
             elif menu_item == 'exit':
                 #exit
                 self.WinMain.on_winMain_destroy()
+           elif menu_item == 'shutdown':
+               bus = dbus.SystemBus()
+               hal_obj = bus.get_object ('org.freedesktop.Hal', '/org/freedesktop/Hal/devices/computer')
+               hal = dbus.Interface (hal_obj, 'org.freedesktop.Hal.Device.SystemPowerManagement')
+               rv = hal.Shutdown()
+               self.WinMain.on_winMain_destroy()
             else:
                 #show appropriate menu
                 self.set_menu(menu_item, menu_desc)





thanks
nellistc
 
Posts: 6
Joined: Wed Apr 25, 2007 8:50 am

Postby balki » Wed Dec 05, 2007 10:03 pm

Hi,

Nice one! :D
I'll see that it gets into the next release.

Cheers again,
Andy
User avatar
balki
Site Admin
 
Posts: 421
Joined: Thu Jan 01, 1970 1:00 am
Location: Huddersfield, UK


Return to Wah!Cade

Who is online

Users browsing this forum: No registered users and 0 guests

cron