def __init__(self, interpreter, args, enable_log_replay=False, scene_class=TrackedUsersScene): Window.__init__(self, args) self.args = args self._enable_log_replay = enable_log_replay self.interpreter = interpreter self.frame = None self.floor_y = args.floor_y self._layout = QtGui.QVBoxLayout() self._layout.setSpacing(0) self._layout.setMargin(0) self._layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self._layout) self._scene = scene_class(self) size_policy = QtGui.QSizePolicy( QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) size_policy.setVerticalStretch(2) size_policy.setHorizontalStretch(2) self._scene.setSizePolicy(size_policy) self._layout.addWidget(self._scene) self._log_widget = LogWidget(self) self._layout.addWidget(self._log_widget) self._create_menu() if self.args.fullscreen: self.give_keyboard_focus_to_fullscreen_window() self._fullscreen_action.toggle()
def __init__(self, bvh_reader, args): Window.__init__(self, args) self._layout = QtGui.QVBoxLayout() self._layout.setSpacing(0) self._layout.setMargin(0) self._layout.setContentsMargins(0, 0, 0, 0) self._scene = Scene(bvh_reader, args) self._layout.addWidget(self._scene) self._create_menu() self.setLayout(self._layout) if args.fullscreen: self.give_keyboard_focus_to_fullscreen_window() self._fullscreen_action.toggle()
def __init__(self, bvh_reader, args): global transport_controls Window.__init__(self, args) self._main_layout = QtGui.QVBoxLayout() self._main_layout.setSpacing(0) self._main_layout.setMargin(0) self._main_layout.setContentsMargins(0, 0, 0, 0) self._scene = Scene(bvh_reader, args) self._main_layout.addWidget(self._scene) transport_controls = TransportControls() transport.on_updated = transport_controls.on_transport_updated self._main_layout.addWidget(transport_controls.widget) self._create_menu() self.setLayout(self._main_layout)
def __init__(self, entity, info, **kwargs): global _ACTION_LUT title = str(entity.id) if entity.owner: title += ' (%s)' % entity.owner actions = info['actions'] act = [] tabs = [] if 'MOVE' in actions: act.append(Button(Icon(filename='textures/tiger.svg'), functools.partial(EntityWindow.on_move, self) )) if len(act) > 0: grid = Grid(3, 3, *act) tabs.append(Tab('Act', grid)) if 'BUILD' in actions: build = [] for type in info['Buildlist']: callback = functools.partial(EntityWindow.on_build, self, what=type) build.append(Button(Icon(filename=type_icon.get(type, 'textures/tiger.svg')), callback=callback)) grid = Grid(3, 3, *build) tabs.append(Tab('Build', grid)) if 'SET_CARGO_TYPE' in actions: cargo_types = [] for type in info['Cargo_type_list']: callback = functools.partial(EntityWindow.on_set_cargo_type, self, what=type) cargo_types.append(Button(Icon(filename='textures/tiger.svg'), callback=callback)) grid = Grid(3, 3, *cargo_types) tabs.append(Tab('Set cargo type', grid)) tabs.append(Tab('Stats', EntityStats(info))) tab = TabView(tabs=tabs) Window.__init__(self, widget=tab, position=None, size=Vector2i(300,200), id=entity.id, title=title, **kwargs) self._entity = entity self._info = info