def __init__(self, arg): QtGui.QMainWindow.__init__(self) self.resize(800, 600) self.setWindowTitle('Origami') s = QtCore.QSettings('PlatBox', 'Hal0') t = s.value("origami2/geometry") if t: self.restoreGeometry(t) t = s.value("origami2/dockstate") if t: self.restoreState(t, 0) #self.data_edit = QtGui.QComboBox() #self.data_edit.addItems(['Task %d' % (i+1) for i in range(101)]) #self.data_edit.currentIndexChanged.connect(self.loadFile) self.actr = cmn.Action(self, 'Refrest', None, self.doRefresh, 'F5') self.addAction(self.actr) self.mview = TileWidget(self) self.loadFile('facets.json') layout = cmn.VBox([ #self.data_edit, self.mview ]) self.setCentralWidget(cmn.ensureWidget(layout)) self.statusBar().showMessage('Ready') self.show()
def setData(self, units): self.units = units def make(x): t = TileWidget(self) t.setData(x) return t layout = cmn.VBox([make(x) for x in units]) wrap = QtGui.QScrollArea() wrap.setWidget(cmn.ensureWidget(layout)) self.setWidget(wrap)
def __init__(self, solname): QtGui.QMainWindow.__init__(self) self.solname = solname self.loadpowers() #self.img = QtGui.QImage(self.w * 50, self.h * 50, # QtGui.QImage.Format_ARGB32) #self.setCentralWidget(self.img) self.frames = [] self.cur_frame = -1000 self.resize(800, 600) self.units_list = UnitsPanel(self) self.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.units_list) self.info_box = InfoPanel(self) self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.info_box) s = QtCore.QSettings('PlatBox', 'Davar') t = s.value("mainwnd/geometry") if t: self.restoreGeometry(t) t = s.value("mainwnd/dockstate") if t: self.restoreState(t, 0) self.cbx = QtGui.QComboBox() self.sizesl = QtGui.QSlider() self.sizesl.setOrientation(QtCore.Qt.Horizontal) self.sizesl.setMaximumWidth(100) self.sizesl.setMinimum(10) self.sizesl.setMaximum(50) self.sizesl.setValue(25) self.sizesl.valueChanged.connect(self.changeSz) self.wi = TileWidget2(self) self.frame_lbl = QtGui.QLabel('None') self.act_next0 = cmn.Action(self, 'Last frame (F12)', 'first.png', self.nextFrame0, 'F12') self.act_prev0 = cmn.Action(self, 'First frame (F11)', 'last.png', self.prevFrame0, 'F11') self.act_next = cmn.Action(self, 'Next frame (F3)', 'next.png', self.nextFrame, 'F3', enabled=False) self.act_prev = cmn.Action(self, 'Prev frame (F2)', 'prev.png', self.prevFrame, 'F2', enabled=False) self.act_playb = cmn.Action(self, 'Play back (F4)', 'control-180.png', self.startPlayback, 'F4', checkable=True) self.act_play = cmn.Action(self, 'Play (F5)', 'play.png', self.startPlay, 'F5', checkable=True) self.act_gotomove = cmn.Action(self, 'Go to move... (F1)', 'hand-point.png', self.gotoMove, 'F1') self.act_togglefast = cmn.Action(self, 'Toggle fast', '', self.toggleFast, 'F8') self.act_lastm = cmn.Action(self, 'Back to last spawn (Delete)', 'undo.png', self.prevMove, 'Delete') self.addAction(self.act_togglefast) self.fastcb = QtGui.QCheckBox('Fast(F8)') self.fastcb.toggled.connect(self.onToggleFast) layout = cmn.HBox([self.cbx, self.sizesl, self.frame_lbl, cmn.ToolBtn(self.act_lastm), cmn.ToolBtn(self.act_gotomove), cmn.ToolBtn(self.act_prev0), cmn.ToolBtn(self.act_next0), cmn.ToolBtn(self.act_prev), cmn.ToolBtn(self.act_next), cmn.ToolBtn(self.act_playb), cmn.ToolBtn(self.act_play), self.fastcb]) #wrap = QtGui.QScrollArea() #wrap.setWidget(self.wi) wrap = self.wi layout = cmn.VBox([layout, wrap]) self.setCentralWidget(cmn.ensureWidget(layout)) menubar = self.menuBar() fileMenu = menubar.addMenu('Menu') self.act_showsol = cmn.Action(self, 'Show solution', '', self.showSol, 'F9') self.act_savesol = cmn.Action(self, 'Save solution', '', self.doSave, 'Ctrl+S') self.act_opensol = cmn.Action(self, 'Open solution file...', '', self.doOpen, 'Ctrl+O') fileMenu.addAction(self.act_opensol) fileMenu.addAction(self.act_showsol) fileMenu.addAction(self.act_savesol) self.backup_timer = QtCore.QTimer() self.backup_timer.timeout.connect(self.doPlay) self.backup_timer.start(50) self.backup_timer2 = QtCore.QTimer() self.backup_timer2.timeout.connect(self.doPlayb) self.backup_timer2.start(50) self.cbx.currentIndexChanged.connect(self.onChanged) self.cbx.addItems([str(i) for i in range(N_PROBLEMS)]) if self.solname: self.show() if self.solname != '$$$': self.showSol()
def __init__(self, solname): QtGui.QMainWindow.__init__(self) self.solname = solname self.loadpowers() #self.img = QtGui.QImage(self.w * 50, self.h * 50, # QtGui.QImage.Format_ARGB32) #self.setCentralWidget(self.img) self.frames = [] self.cur_frame = -1000 self.resize(800, 600) self.units_list = UnitsPanel(self) self.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.units_list) self.info_box = InfoPanel(self) self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.info_box) s = QtCore.QSettings('PlatBox', 'Davar') t = s.value("mainwnd/geometry") if t: self.restoreGeometry(t) t = s.value("mainwnd/dockstate") if t: self.restoreState(t, 0) self.cbx = QtGui.QComboBox() self.sizesl = QtGui.QSlider() self.sizesl.setOrientation(QtCore.Qt.Horizontal) self.sizesl.setMaximumWidth(100) self.sizesl.setMinimum(10) self.sizesl.setMaximum(50) self.sizesl.setValue(25) self.sizesl.valueChanged.connect(self.changeSz) self.wi = TileWidget2(self) self.frame_lbl = QtGui.QLabel('None') self.act_next0 = cmn.Action(self, 'Last frame (F12)', 'first.png', self.nextFrame0, 'F12') self.act_prev0 = cmn.Action(self, 'First frame (F11)', 'last.png', self.prevFrame0, 'F11') self.act_next = cmn.Action(self, 'Next frame (F3)', 'next.png', self.nextFrame, 'F3', enabled=False) self.act_prev = cmn.Action(self, 'Prev frame (F2)', 'prev.png', self.prevFrame, 'F2', enabled=False) self.act_playb = cmn.Action(self, 'Play back (F4)', 'control-180.png', self.startPlayback, 'F4', checkable=True) self.act_play = cmn.Action(self, 'Play (F5)', 'play.png', self.startPlay, 'F5', checkable=True) self.act_gotomove = cmn.Action(self, 'Go to move... (F1)', 'hand-point.png', self.gotoMove, 'F1') self.act_togglefast = cmn.Action(self, 'Toggle fast', '', self.toggleFast, 'F8') self.act_lastm = cmn.Action(self, 'Back to last spawn (Delete)', 'undo.png', self.prevMove, 'Delete') self.addAction(self.act_togglefast) self.fastcb = QtGui.QCheckBox('Fast(F8)') self.fastcb.toggled.connect(self.onToggleFast) layout = cmn.HBox([ self.cbx, self.sizesl, self.frame_lbl, cmn.ToolBtn(self.act_lastm), cmn.ToolBtn(self.act_gotomove), cmn.ToolBtn(self.act_prev0), cmn.ToolBtn(self.act_next0), cmn.ToolBtn(self.act_prev), cmn.ToolBtn(self.act_next), cmn.ToolBtn(self.act_playb), cmn.ToolBtn(self.act_play), self.fastcb ]) #wrap = QtGui.QScrollArea() #wrap.setWidget(self.wi) wrap = self.wi layout = cmn.VBox([layout, wrap]) self.setCentralWidget(cmn.ensureWidget(layout)) menubar = self.menuBar() fileMenu = menubar.addMenu('Menu') self.act_showsol = cmn.Action(self, 'Show solution', '', self.showSol, 'F9') self.act_savesol = cmn.Action(self, 'Save solution', '', self.doSave, 'Ctrl+S') self.act_opensol = cmn.Action(self, 'Open solution file...', '', self.doOpen, 'Ctrl+O') fileMenu.addAction(self.act_opensol) fileMenu.addAction(self.act_showsol) fileMenu.addAction(self.act_savesol) self.backup_timer = QtCore.QTimer() self.backup_timer.timeout.connect(self.doPlay) self.backup_timer.start(50) self.backup_timer2 = QtCore.QTimer() self.backup_timer2.timeout.connect(self.doPlayb) self.backup_timer2.start(50) self.cbx.currentIndexChanged.connect(self.onChanged) self.cbx.addItems([str(i) for i in range(N_PROBLEMS)]) if self.solname: self.show() if self.solname != '$$$': self.showSol()