コード例 #1
0
    def __init__(self, app):
        self.app = app
        self.filename = ""

        widgets = gtk.glade.XML(utils.locate_data_dir() + "chessmonk.glade")
        widgets.signal_autoconnect(self)

        self.window = widgets.get_widget("mainwindow")
        self.boardbox = widgets.get_widget("alignment_board_display")
        self.hpane = widgets.get_widget("hpane")
        self.vpane = widgets.get_widget("vpane")

        self.hpane.set_position(380)
        self.vpane.set_position(150)

        self.window.set_size_request(800, 600)

        try:
            icon = gtk.icon_theme_get_default().load_icon("chessmonk", 48, 0)
            self.window.set_icon(icon)
        except:
            print "Warning:", sys.exc_info()[1]

        # Move control buttons
        self.button_move_first = widgets.get_widget("button_move_first")
        self.button_move_back = widgets.get_widget("button_move_back")
        self.button_move_takeback = widgets.get_widget("button_move_takeback")
        self.button_move_forward = widgets.get_widget("button_move_forward")
        self.button_move_last = widgets.get_widget("button_move_last")

        from gtkboardview.BoardView import *
        self.boardview = BoardView()
        #self.board = self.boardview.board
        self.boardbox.add(self.boardview)

        self.boardview.board.connect('position-changed-event',
                                     self.position_changed_event)

        self.notationview = NotationView()
        self.notationview.board = self.boardview.board
        self.boardview.board.connect('position-changed-event',
                                     self.notationview.position_changed_event)
        widgets.get_widget('sw_notation').add(self.notationview)

        self.gamelist = GameList(self)

        #self.notebook = gtk.Notebook()
        #widgets.get_widget("notebook_box").add(self.notebook)
        #self.notebook.append_page(self.gamelist)
        widgets.get_widget("sw_gamelist").add(self.gamelist)

        self.window.show_all()
        self.button_move_takeback.hide()  # TODO: reconsider
コード例 #2
0
        def __init__(self):
                super(GameHallPanel, self).__init__()
                layout = QVBoxLayout(self)
                layout.setAlignment(Qt.AlignTop)

                self.playerName = QLineEdit()
                self.playerName.setAlignment(Qt.AlignCenter)
                self.playerName.setFrame(False)
                self.playerName.setPlaceholderText('Player Name')
                self.playerName.setFocusPolicy(Qt.ClickFocus)
                self.playerName.setText(settings.value('player/name'))
                self.playerName.textChanged.connect(self._onPlayerNameChanged)
                layout.addWidget(self.playerName)

                self.gameList = GameList()
                self.mapList = MapList()
コード例 #3
0
    def main(self):
        self.opts.directory = os.path.normpath(self.opts.directory)
        os.chdir(self.opts.directory)
        self.config = ConfigParser.SafeConfigParser()
        self.config.read('mamematic.ini')

        gamelist = GameList()
        if self.opts.xml:
            gamelist.readxml(self.opts.xml)
        else:
            gamelist.readxml(self.config.get('mame','exec'))

        for g in gamelist:
            log.info(g)

        return(0)
コード例 #4
0
ファイル: Fred.py プロジェクト: fredho2013/FIRST
    def __init__(self):
        self.__root = root = Tk()
        root.title("飞机大战(达内科技)")
        from skycanvas import SkyCanvas #F画布
        self.__canvas = canvas = SkyCanvas(root, width=480, height=654)
        canvas.pack()

        # 处理按键事件和鼠标事件
        from gamelist import EventList

        # 创建能够接收控制事件的列表 (pause_button, hero_plane, 
        self.__event_list = event_list = EventList()  # 创建能够接收控制事件的列表
        root.bind('<Key>', lambda event: event_list.on_key_down(event))
        root.bind('<KeyRelease>', lambda event: event_list.on_key_up(event))
        root.bind('<Button>', lambda event: event_list.on_mouse_down(event))
        root.bind('<Motion>', lambda event: event_list.on_mouse_move(event))
        root.bind('<ButtonRelease>',
                  lambda event: event_list.on_mouse_up(event))

        # 创建游戏中能接收定时器事5件的列表
        from gamelist import TimerList
        self.__timer_list = time_list = TimerList()
        self.__timer_interval = 40  # 设定刷新时间为40ms
        self.__tick_count = 0

        # 创建敌方武器对象列表
        from gamelist import GameList
        self.__enemy_list = GameList()
        # 创建游戏方的武器对象列表
        # self.player_list = GameList()

        self.create_backgound()

        self.__life_count = 3  # 生命数

        # 创建飞机个数的图标
        from planes_label import PlaneLabel
        self.__plane_label = PlaneLabel(canvas, count=self.__life_count)

        self.create_new_hero()

        # 创建得分标签:
        from score_label import ScoreLabel
        self.__score_label = ScoreLabel(canvas)
        self.__score = 0

        # 创建暂停按钮
        from pause_button import PauseButton
        self.__pause_btn = PauseButton(canvas, callback=self.pause_game)
        self.__event_list.append(self.__pause_btn)

        from enemy_plane import EnemyPlane1, EnemyPlane2, EnemyPlane3, EnemyPlane1_2
        self.__random_list = [EnemyPlane1] * 10 + \
            [EnemyPlane2] * 3 + [EnemyPlane3] + [EnemyPlane1_2] * 2
        self.__min_list_len = len(self.__random_list)
        self.__random_list.extend([None] * 500)
        # self.__random_list = [EnemyPlane1] * 10 + [EnemyPlane2] * 3 + [EnemyPlane3] + [None] * 10

        from startwindow import StartWindow
        self.__start_window = start_window = StartWindow(
            canvas, start_callback=self.start_game, destroy=self.destroy_object)
        event_list.append(start_window)      
コード例 #5
0
 def __init__(self, client):
     self.client = client
     GameList.instance = GameList()