Fixed fonts and added a dialog to TTT
This commit is contained in:
parent
e85b2baffc
commit
ba471084da
3 changed files with 42 additions and 180 deletions
|
@ -1,135 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<glade-interface>
|
||||
<!-- interface-requires gtk+ 2.16 -->
|
||||
<!-- interface-naming-policy project-wide -->
|
||||
<widget class="GtkWindow" id="window1">
|
||||
<property name="width_request">561</property>
|
||||
<property name="height_request">521</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><span size="x-large">GGS Killtrolpanel</span></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">kill_process_icon.jpg</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="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">3</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="playersButton">
|
||||
<property name="label" translatable="yes">All players</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="on_playersButton_clicked"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="coordinatorButton">
|
||||
<property name="label" translatable="yes">Coordinator</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="on_coordinatorButton_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="dispatcherButton">
|
||||
<property name="label" translatable="yes">Dispatcher</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="on_dispatcherButton_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="coordinatorBackupButton">
|
||||
<property name="label" translatable="yes">Coordinator backup</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="on_coordinatorBackupButton_clicked"/>
|
||||
</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>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="tablesButton">
|
||||
<property name="label" translatable="yes">All tables</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="on_tablesButton_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="gamevmButton">
|
||||
<property name="label" translatable="yes">All GameVMs</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="on_gamevmButton_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
|
@ -1,44 +0,0 @@
|
|||
#!/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 = "ttt.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()
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys, socket, thread, gobject, getpass, time, os
|
||||
import sys, socket, thread, gobject, getpass, time, os, pango
|
||||
try:
|
||||
import pygtk
|
||||
pygtk.require("2.16")
|
||||
|
@ -38,6 +38,7 @@ class GGSTTT:
|
|||
self.wTree.signal_autoconnect(dic)
|
||||
|
||||
self.wTree.get_widget("window1").show()
|
||||
|
||||
|
||||
def doConnect(self):
|
||||
self.setStatus("Not connected")
|
||||
|
@ -117,6 +118,15 @@ class GGSTTT:
|
|||
self.wTree.get_widget("x2y0").set_label(msg["DATA"][6])
|
||||
self.wTree.get_widget("x2y1").set_label(msg["DATA"][7])
|
||||
self.wTree.get_widget("x2y2").set_label(msg["DATA"][8])
|
||||
self.wTree.get_widget("x0y0").get_child().modify_font(pango.FontDescription("sans 48"))
|
||||
self.wTree.get_widget("x0y1").get_child().modify_font(pango.FontDescription("sans 48"))
|
||||
self.wTree.get_widget("x0y2").get_child().modify_font(pango.FontDescription("sans 48"))
|
||||
self.wTree.get_widget("x1y0").get_child().modify_font(pango.FontDescription("sans 48"))
|
||||
self.wTree.get_widget("x1y1").get_child().modify_font(pango.FontDescription("sans 48"))
|
||||
self.wTree.get_widget("x1y2").get_child().modify_font(pango.FontDescription("sans 48"))
|
||||
self.wTree.get_widget("x2y0").get_child().modify_font(pango.FontDescription("sans 48"))
|
||||
self.wTree.get_widget("x2y1").get_child().modify_font(pango.FontDescription("sans 48"))
|
||||
self.wTree.get_widget("x2y2").get_child().modify_font(pango.FontDescription("sans 48"))
|
||||
elif msg["Client-Command"] == "defined":
|
||||
self.s.send("Game-Command: hi\n" +
|
||||
"Content-Type: text\n" +
|
||||
|
@ -125,6 +135,37 @@ class GGSTTT:
|
|||
elif msg["Client-Command"] == "lusers":
|
||||
print msg
|
||||
gobject.idle_add(self.updateUsers, msg["DATA"])
|
||||
elif msg["Client-Command"] == "winner":
|
||||
message = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_NONE, msg["DATA"])
|
||||
message.add_button("New game", gtk.RESPONSE_OK)
|
||||
message.add_button("Exit", gtk.RESPONSE_CLOSE)
|
||||
resp = message.run()
|
||||
if resp == gtk.RESPONSE_CLOSE:
|
||||
sys.exit(1)
|
||||
message.destroy()
|
||||
elif resp == gtk.RESPONSE_OK:
|
||||
print "new game"
|
||||
self.s.send("Game-Command: new\n" +
|
||||
"Content-Type: text\n" +
|
||||
"Content-Length: 0\n"+
|
||||
"\n")
|
||||
message.destroy()
|
||||
elif msg["Client-Command"] == "loser":
|
||||
message = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_NONE, msg["DATA"])
|
||||
message.add_button("New game", gtk.RESPONSE_OK)
|
||||
message.add_button("Exit", gtk.RESPONSE_CLOSE)
|
||||
resp = message.run()
|
||||
if resp == gtk.RESPONSE_CLOSE:
|
||||
sys.exit(1)
|
||||
message.destroy()
|
||||
elif resp == gtk.RESPONSE_OK:
|
||||
print "new game"
|
||||
self.s.send("Game-Command: new\n" +
|
||||
"Content-Type: text\n" +
|
||||
"Content-Length: 0\n"+
|
||||
"\n")
|
||||
message.destroy()
|
||||
|
||||
|
||||
def connect(self, host,port):
|
||||
print "Connecting"
|
||||
|
|
Reference in a new issue