当前位置: 首页>>代码示例>>Python>>正文


Python Gui.set_sizing方法代码示例

本文整理汇总了Python中Gui.set_sizing方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.set_sizing方法的具体用法?Python Gui.set_sizing怎么用?Python Gui.set_sizing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gui的用法示例。


在下文中一共展示了Gui.set_sizing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import set_sizing [as 别名]
  def __init__(self, parent = None):
    QtGui.QWidget.__init__(self, parent)
    Gui.set_sizing(self, 0, 1)
    self.main_window = parent
    self.games = []
    self.default_game_path = '~/play/ants/dist'
    self.loader = LoadThread()
    self.loader.ready.connect(self.on_game_loaded)
    self.loader.progress.connect(self.on_game_progress)
    self.stack = QtGui.QStackedLayout()
    # Game Path selection
    self.gp = QtGui.QWidget()
    self.gp.hbox = Gui.new_hbox(self.gp, 1, 6, -1)
    self.gp.hbox.setContentsMargins(4, 1, 1, 1)
    self.gp.folder = Gui.new_LineEdit(self.gp.hbox, '', 300)
    self.gp.folder.setFocusPolicy(QtCore.Qt.NoFocus)
    self.gp.browse = Gui.new_PushButton(self.gp.hbox, " Browse ", self.on_browse_folder, 1)
    self.gp.status = Gui.new_Label(self.gp.hbox, 'Select folder where game replays reside', -1)
    self.gp.status.setPalette(Gui.GRAY_TEXT)
    self.gp.next = Gui.new_PushButton(self.gp.hbox, "Next", self.switch_to_gs, 1)
    self.gp.next.setEnabled(False)
    # Game Selection
    self.gs = QtGui.QWidget()
    self.gs.hbox = Gui.new_hbox(self.gs, 1, 6, -1)
    self.gs.back = Gui.new_PushButton(self.gs.hbox, "Back", self.switch_to_gp, 1)
    self.gs.combo = Gui.new_Combo(self.gs.hbox, None, self.on_game_selected, 1)
    self.gs.progress_bar = QtGui.QProgressBar()
    Gui.embox_and_size(self.gs.hbox, self.gs.progress_bar, None, 200)
    self.gs.progress_bar.setRange(0, 100)
    self.gs.progress_bar.setVisible(False)
    self.gs.status = Gui.new_Label(self.gs.hbox, 'Please select a game replay', -1)
    self.gs.status.setPalette(Gui.GRAY_TEXT)
    self.gs.next = Gui.new_PushButton(self.gs.hbox, "Next", self.switch_to_gr, 1)
    self.gs.next.setEnabled(False)
    # Game running
    self.gr = QtGui.QWidget()
    self.gr.hbox = Gui.new_hbox(self.gr, 1, 4, -1)
    self.gr.back = Gui.new_PushButton(self.gr.hbox, "Back", self.switch_to_gs, 1)
    self.gr.sep1 = Gui.new_Label(self.gr.hbox, '', 12)
    self.gr.play = Gui.new_PushButton(self.gr.hbox, "Play", self.on_play_pause, 1)
    self.gr.speed_label = Gui.new_Label(self.gr.hbox, 'Speed:', 1)
    self.gr.speed = Gui.new_Combo(self.gr.hbox, ['512x', '256x', '128x', '64x', '32x', '16x', '8x', '4x', '2x', '1x'], self.on_speed_changed, 1)
    self.gr.step = Gui.new_PushButton(self.gr.hbox, "Step", self.on_step, 1)
    self.gr.progress_bar = QtGui.QProgressBar()
    Gui.embox_and_size(self.gr.hbox, self.gr.progress_bar, None, 100)
    self.gr.progress_bar.setTextVisible(True)
    self.gr.eta = Gui.new_Label(self.gr.hbox, '', 1)
    self.gr.eta.setPalette(Gui.GRAY_TEXT)
#    self.gr.eta.setTooltip("ETA 'til end of game at current speed")
    self.gr.sep2 = Gui.new_Label(self.gr.hbox, '', 4)
    self.gr.p1 = Gui.new_Label(self.gr.hbox, '', -1)
    self.gr.p1.setPalette(Gui.RED_TEXT)
    self.gr.p2 = Gui.new_Label(self.gr.hbox, '', -1)
    self.gr.p2.setPalette(Gui.BLUE_TEXT)
    self.gr.status = Gui.new_Label(self.gr.hbox, '', -1)
    self.gr.status.setPalette(Gui.GRAY_TEXT)
    self.gr.fog = Gui.new_CheckBox(self.gr.hbox, 'Fog', self.on_fog, 1)
    self.gr.fog.setChecked(True)
    # timer
    self.timer = QtCore.QTimer(self)
    self.timer.timeout.connect(self.run_turn)
    self.on_speed_changed(0)
    # Stack
    self.stack.addWidget(self.gp)
    self.stack.addWidget(self.gs)
    self.stack.addWidget(self.gr)
    self.stack.setCurrentIndex(0)
    self.setLayout(self.stack)
    if os.path.isdir(Gui.resolved_path(self.default_game_path)):
      self.set_game_path(self.default_game_path)
      if len(self.games):
        self.switch_to_gs()
    else:
      self.default_game_path = '~'
开发者ID:zsimic,项目名称:TopCoderAnts,代码行数:76,代码来源:AntsViewer.py


注:本文中的Gui.set_sizing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。