All pastes #90925 Raw Edit

freeone3000

public text v1 · immutable
#90925 ·published 2006-07-18 03:49 UTC
rendered paste body
from qt import *


class chooser_window (QDialog, object):
	def __init__(self, names):
		super(chooser_window, self).__init__()
		self.names = names
		self.layout = QGridLayout(self)
		self.setup()
		#TODO Add more stuff.
	def setup(self):
		combo_box = QComboBox(self)
		for name in self.names:
			combo_box.addItem(name)
		combo_box.editable = False
		
		xpos = 0
		ypos = 0
		self.layout.addWidget(combo_box, xpos, ypos)
		ypos += 1

class main_window (QWidget, object):
	def __init__(self):
		super(main_window, self).__init__()
		self.setCaption("Eternal Lands Card Game")
		self.layout = QGridLayout(self)
		self.setup()
		self.show()
	def setup(self):
		startb = QPushButton("Start", self)
		QPushButton.connect(startb, SIGNAL('pressed()'), self, SLOT('_accepted()'))
		
		xpos = 0
		ypos = 0
		self.layout.addWidget(startb, xpos, ypos)
		ypos += 1
		
	def show_chooser(self, names):
		chooser = chooser_window(names)
		chooser.show()

false = 0
true = 1


class elcardsgui (object):
	main_win = None
	def __init__(self, args):
		app = QApplication(args)
		app.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()'))
		self.main_win = main_window()
		app.setMainWidget(self.main_win)
	def show_char_select(self, names):
		return self.main_win.show_chooser(names)
	def show_deck_select(self, deck_names):
		return self.main_win.show_chooser(deck_names)
#TODO Insert code here.

def gui_start():
	gui = elcardsgui()
	return gui