This repository has been archived on 2025-08-18. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
GGS/games/GGS-Killtrolpanel/kpanel.py

44 lines
1.2 KiB
Python

#!/usr/bin/env python
import sys, socket, thread, gobject, getpass, time, os
try:
import pygtk
pygtk.require("2.16")
except:
pass
try:
import gtk
import gtk.glade
except:
sys.exit(1)
class GGSKPanel:
def __init__(self):
#Set the Glade file
self.gladefile = "ggskpanel.glade"
self.wTree = gtk.glade.XML(self.gladefile, "window1")
#Create our dictionay and connect it
dic = { "on_window1_destroy_event" : gtk.main_quit
,"on_coordinatorButton_clicked" : lambda x: self.terminateProcess("ggs_coordinator")
,"on_coordinatorBackupButton_clicked" :\
lambda x: self.terminateProcess("ggs_coordinator_backup")
,"on_dispatcherButton_clicked" : lambda x: self.terminateProcess("ggs_dispatcher")
}
self.wTree.signal_autoconnect(dic)
self.wTree.get_widget("window1").show()
def terminateProcess(self, process):
os.system("echo \"exit(whereis(%s), 'Bye bye').\" | erl_call -sname ggs -e" % process)
def setStatus(self, msg):
self.wTree.get_widget("statusbar").push(0, msg)
if __name__ == "__main__":
chat = GGSKPanel()
gobject.threads_init()
gtk.main()