def populateMenu(self): from panel import Panel from PyQt4.QtCore import QObject, SIGNAL from PyQt4.QtGui import QAction if not self.panel: self.panel = Panel(self._iface) self.panel.setVisible(False) self.panelAction = self.panel.toggleViewAction() self.menu.addAction(self.panelAction) self.settingsAction = QAction( self.menu.tr("&Settings", "Processing"), self._iface.mainWindow()) self.menu.addAction(self.settingsAction) QObject.connect(self.settingsAction, SIGNAL("triggered()"), self.showSettings) self.workflowBuilderAction = QAction( self.menu.tr("&Workflow builder", "Processing"), self._iface.mainWindow()) self.menu.addAction(self.workflowBuilderAction) QObject.connect(self.workflowBuilderAction, SIGNAL("triggered()"), self.showWorkflowBuilder) self.aboutAction = QAction(self.menu.tr("&About", "Processing"), self._iface.mainWindow()) self.menu.addAction(self.aboutAction) QObject.connect(self.aboutAction, SIGNAL("triggered()"), self.showAboutDialog)
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) self.ui.test_value.setValue(self._ins.get_test_value()) self.ui.float_test_value.setValue(self._ins.get_float_test_value()) self.ui.string_test_value.setText(self._ins.get_string_test_value()) self.ui.slider_value.setValue(self._ins.get_slider_value()) self.ui.check_value.setChecked(self._ins.get_check_value()) self.ui.radio1.setChecked(self._ins.get_radio1()) self.ui.radio2.setChecked(self._ins.get_radio2()) self.ui.radio3.setChecked(self._ins.get_radio3()) self.ui.test_value.valueChanged.connect(self._set_test_value) self.ui.float_test_value.valueChanged.connect(self._set_float_test_value) self.ui.string_test_value.textEdited.connect(self._set_string_test_value) self.ui.slider_value.sliderMoved.connect(self._set_slider_value) self.ui.check_value.toggled.connect(self._set_check_value) self.ui.radio1.toggled.connect(self._set_radio1) self.ui.radio2.toggled.connect(self._set_radio2) self.ui.radio3.toggled.connect(self._set_radio3) self.ui.do_something.pressed.connect(self._do_something) self.ui.do_something_else.pressed.connect(self._do_something_else)
def __init__(self, row, col, players, timeout=.50, sleep_time = .500,parent = None): super(GameWindow, self).__init__(parent) self.setWindowTitle("[*] MAIC 2019 - Yote Game") self.saved = True self.statusBar() self.gameOneGoing = False self.setWindowIcon(QtGui.QIcon("pieces/icon.png")) layout = QHBoxLayout() layout.addStretch() self.row=row self.col=col self.players=players self.board = Board(row, col) self.board_size = (row, col) layout.addWidget(self.board) layout.addSpacing(15) self.panel = Panel(self.board, [players[0].name,players[1].name]) layout.addWidget(self.panel) layout.addStretch() content = QWidget() content.setLayout(layout) self.rulesgame = RulesGame(self.board,self.players,self.panel,self.gameOneGoing) self.setCentralWidget(content) self.createMenu() self.timeout = timeout self.sleep_time = sleep_time self.trace = Trace(self.board.get_board_array()) self.random_player = AI(self.board.currentPlayer, self.board_size)
def __init__(self, pos, civ, offered_upgrades, resource, on_select, on_reroll): Panel.__init__(self, pos, None) self.civ = civ self.resource = resource self.tab = { "text": "Up", "color": economy.RESOURCE_COLORS[self.resource], "icon": "assets/i-upgrade.png" } y = 0 # need fn for closure def add_button(uname): u = upgrades.UPGRADE_CLASSES[uname] b = UpgradeIcon(V2(0, 0), uname, lambda u: on_select(u), True) self.add(b, V2(0, y)) return b for category, uname in offered_upgrades.items(): b = add_button(uname) y += 5 + b.height self.joystick_controls = [] self.joystick_controls.extend( [[c] for c in self.get_controls_of_type(UpgradeIcon)]) #if game.Game.inst.run_info.rerolls > 0: # self.add(Button(V2(0,0), "%d left" % game.Game.inst.run_info.rerolls, "small", on_reroll, icon="assets/die.png", label="REROLL"), V2(0, y)) # self.joystick_controls.append([self.get_control_of_type(Button)]) self.redraw()
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui: self.ui = Ui_Panel() self.ui.setupUi(self) for p in [self.ui.plot1, self.ui.plot2]: p.left_axis.title = 'counts [Hz]' p.plot.padding = 5 p.plot.padding_bottom = 30 p.plot.padding_left = 100 plot = p.plot.plots['trace'][0] plot.padding = 0 plot.color = 'green' plot.marker = 'circle' plot.marker_size = 3 for c in [self.ui.counts1, self.ui.counts2]: c.setText('0.0') # set other defaults self.ui.plot1.display_time = 20 self.ui.plot2.display_time = 20 self.ui.t_range.setValue(20)
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) self.ui.scan_length.setValue(self._ins.get_scan_length()) self.ui.pixel_time.setValue(self._ins.get_pixel_time()) self.ui.nr_of_points.setValue(self._ins.get_nr_of_points()) self.ui.gaussian_fit.setChecked(self._ins.get_gaussian_fit()) self.ui.counter.setValue(self._ins.get_counter()) self.ui.scan_length.valueChanged.connect(self._set_scan_length) self.ui.pixel_time.valueChanged.connect(self._set_pixel_time) self.ui.nr_of_points.valueChanged.connect(self._set_nr_of_points) self.ui.gaussian_fit.toggled.connect(self._set_gaussian_fit) self.ui.counter.valueChanged.connect(self._set_counter) self.ui.start.pressed.connect(self._start) # set up plot for p in self.ui.xplot, self.ui.yplot: p.bottom_axis.title = 'x [um]' p.left_axis.title = 'counts [Hz]' p.plot.padding = 5 p.plot.padding_bottom = 30 p.plot.padding_left = 70 self.ui.yplot.bottom_axis.title = 'y [um]'
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) self.ui = Ui_Init() self.ui.setupUi(self) # self.ui.setTemp.setRange(-20.0, 120.0) # self.ui.setTemp.setDecimals(2) # self.ui.setTemp.setSingleStep(0.01) # self.ui.setTemp.valueChanged.connect(self.set_target_temperature) self.ui.dsb_Tmin.setRange(-20.0, 120.0) self.ui.dsb_Tmin.setDecimals(2) self.ui.dsb_Tmin.setSingleStep(0.01) self.ui.dsb_Tmin.valueChanged.connect(self.set_Tmin) self.ui.dsb_Tmax.setRange(-20.0, 120.0) self.ui.dsb_Tmax.setDecimals(2) self.ui.dsb_Tmax.setSingleStep(0.01) self.ui.dsb_Tmax.valueChanged.connect(self.set_Tmax) self.ui.sb_steps.setRange(0, 1000) # self.ui.setTemp.setDecimals(2) self.ui.sb_steps.setSingleStep(1) self.ui.sb_steps.valueChanged.connect(self.set_nsteps) self.ui.sb_dwell_time.setRange(0, 1000) # self.ui.dsb_dwell_time.setDecimals(2) self.ui.sb_dwell_time.setSingleStep(1) self.ui.sb_dwell_time.valueChanged.connect(self.set_dwell_time) self.ui.scanButton.clicked.connect(self.start_running)
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) self.ui.doubleSpinBox_start_F.setValue(self._ins.get_doubleSpinBox_start_F()) self.ui.doubleSpinBox_stop_f.setValue(self._ins.get_doubleSpinBox_stop_f()) self.ui.doubleSpinBox_step_f.setValue(self._ins.get_doubleSpinBox_step_f()) self.ui.doubleSpinBox_coarse_wav.setValue(self._ins.get_doubleSpinBox_coarse_wav()) self.ui.doubleSpinBox_int_time.setValue(self._ins.get_doubleSpinBox_int_time()) self.ui.doubleSpinBox_start_F.valueChanged.connect(self._set_doubleSpinBox_start_F) self.ui.doubleSpinBox_stop_f.valueChanged.connect(self._set_doubleSpinBox_stop_f) self.ui.doubleSpinBox_step_f.valueChanged.connect(self._set_doubleSpinBox_step_f) self.ui.doubleSpinBox_coarse_wav.valueChanged.connect(self._set_doubleSpinBox_coarse_wav) self.ui.doubleSpinBox_int_time.valueChanged.connect(self._set_doubleSpinBox_int_time) self.ui.start_scan_button.pressed.connect(self._start_scan_button) self.ui.stop_scan_button.pressed.connect(self._stop_scan_button) self.ui.save_scan_button.pressed.connect(self._save_scan_button) self.ui.plot.bottom_axis.title = 'frequency [GHz]' self.ui.plot.left_axis.title = 'intensity' self.ui.plot.plot.padding = 5 #self.ui.plot.plot.padding_bottom = 30 self.ui.plot.plot.padding_left = 70
def _instrument_changed(self,changes): Panel._instrument_changed(self, changes) # print changes if changes.has_key('curr_temperature'): self.ui.displayActualTemp.setText(str(changes['curr_temperature'])) if changes.has_key('DFG_power'): self.ui.displayDFG.setText(str(changes['DFG_power'])) if changes.has_key('set_temperature'): self.ui.displayTargetTemp.setText(str(changes['set_temperature'])) if changes.has_key('temperature_channel2_plot_DFG_values2'): # print "plotting" self.ui.plot2.add_point(changes['dfg_channel2_plot_DFG_values2']) # self.ui.plot2.add_point(changes['temperature_channel2_plot_DFG_values2'], changes['dfg_channel2_plot_DFG_values2']) # print "Something is happening" if changes.has_key('temperature_channel2_plot_DFG_values2'): # print "plotting" # self.ui.plot2.add_point(changes['dfg_channel2_plot_DFG_values2']) self.ui.plot3.add_point(changes['temperature_channel2_plot_DFG_values2']) # print "Something is happening" if changes.has_key('temperature_channel2_plot_DFG_values2'): # print "plotting" # self.ui.plot2.add_point(changes['dfg_channel2_plot_DFG_values2']) self.ui.plot3.add_point(changes['red_channel2_plot_DFG_values2'])
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) self.ui.keyword.setText(self._ins.get_keyword()) self.ui.x.setValue(self._ins.get_x()) self.ui.y.setValue(self._ins.get_y()) self.ui.z.setValue(self._ins.get_z()) self.ui.z_slider.setValue(self._ins.get_z_slider()) self.ui.step.setValue(self._ins.get_step()) self.ui.keyword.textEdited.connect(self._set_keyword) self.ui.x.valueChanged.connect(self._set_x) self.ui.y.valueChanged.connect(self._set_y) self.ui.z.valueChanged.connect(self._set_z) self.ui.z_slider.sliderMoved.connect(self._set_z_slider) self.ui.step.valueChanged.connect(self._set_step) self.ui.step_up.pressed.connect(self._step_up) self.ui.step_left.pressed.connect(self._step_left) self.ui.step_right.pressed.connect(self._step_right) self.ui.step_down.pressed.connect(self._step_down)
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) self._dimension = kw.pop('dimension') self._ins_dimension = self._ins.get_dimension() # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) self.ui.scan_length.setValue(self._ins.get_scan_length()) self.ui.pixel_time.setValue(self._ins.get_pixel_time()) self.ui.nr_of_points.setValue(self._ins.get_nr_of_points()) self.ui.gaussian_fit.setChecked(self._ins.get_gaussian_fit()) self.ui.counter.setValue(self._ins.get_counter()) self.ui.scan_length.valueChanged.connect(self._set_scan_length) self.ui.pixel_time.valueChanged.connect(self._set_pixel_time) self.ui.nr_of_points.valueChanged.connect(self._set_nr_of_points) self.ui.gaussian_fit.toggled.connect(self._set_gaussian_fit) self.ui.counter.valueChanged.connect(self._set_counter) self.ui.start.pressed.connect(self._start) # set up plot self.ui.plot.bottom_axis.title = 'x [um]' self.ui.plot.left_axis.title = 'counts [Hz]' self.ui.plot.plot.padding = 5 self.ui.plot.plot.padding_bottom = 30 self.ui.plot.plot.padding_left = 70
def __init__(self): ThemedTk.__init__(self, background=True, theme="breeze") load_dotenv() self.title(os.getenv("APP_TITLE")) self.iconbitmap('images/icon.ico') # self.state('zoomed') self.minsize(960, 550) self.geometry("1024x550") container = ttk.Frame(self) container.pack(side="top", fill="both", expand=True) container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) self.frames = {} lst_table = fn.getMenuItems() lst_table.append('empty') for tbl in lst_table: frame = Panel(container, self, tbl) self.frames[tbl] = frame frame.grid(row=0, column=0, sticky="nsew") self.show_frame("dashboard")
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # UI self.ui = Ui_Panel() self.ui.setupUi(self, evalfunc=self._ins.evaluate, execfunc=self._ins.execute)
def __init__(self, parent, **kwargs): Panel.__init__(self, parent, top=parent.height-30, left=0, width=parent.width, height=30) self.border_style = BORDER_LOWERED self._grip = TkSizeGrip(self._ctrl) self._grip.pack(side=RIGHT, fill=Y) # TODO: fix bug when toggling packed objects visibility (need to know original setup to reposition) self.align = ALIGN_BOTTOM
class GraphAlgorithm(object): def __init__(self, node_shape, duration, root_id): self.screen = Panel() if (node_shape == "cross"): self.graph = graph_cross.Graph(self.screen) else: self.graph = graph_point.Graph(self.screen) self.graph.set_duration(duration) self.root_id = root_id # display the initial graph on the panel def display_init(self): self.graph.draw_large_graph() self.graph.set_root(self.root_id) self.graph.display_graph(2) def bfs(self): self.display_init() self.graph.bfs_start() self.graph.display_graph(2) self.screen.clean_gpio() def dfs(self): self.display_init() self.graph.dfs_start() self.graph.display_graph(2) self.screen.clean_gpio()
def __init__(self, node_shape, duration): self.screen = Panel() if (node_shape == "cross"): self.tree = tree_cross.Tree(self.screen) else: self.tree = tree_point.Tree(self.screen) self.tree.set_duration(duration)
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) # set values from instruments # Front self.ui.z.setValue(self._ins.get_mos_z()) self.ui.z_slider.setValue(int(self._ins.get_mos_z()*10)) # Back #self.ui.back_z.setValue(self._ins.get_mos_back_z()) #self.ui.back_z_slider.setValue(int(self._ins.get_mos_back_z()*10)) # Stage self.ui.x.setValue(self._ins.get_mos_x()) self.ui.y.setValue(self._ins.get_mos_y()) # Back #self.ui.back_x.setValue(self._ins.get_mos_rearsm_x()) #self.ui.back_y.setValue(self._ins.get_mos_rearsm_y()) # Detsm #self.ui.detsm_x.setValue(self._ins.get_mos_detsm_x()) #self.ui.detsm_y.setValue(self._ins.get_mos_detsm_y()) # Other self.ui.keyword.setText(self._ins.get_keyword())
def __init__(self, refPath, dataPath, dbFilename): GPIO.cleanup() GPIO.setmode(GPIO.BCM) GPIO.setup(self.AUTO_START_GPIO_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP) self.__i2c = I2C(2) self.__analog = Analog(sel.__i2c.getLock(), 0x49) self.default = Default() self.database = Database(dataPath, dbFilename) self.waterlevel = Waterlevel(debug, self.database) self.light = Light(self.database) self.curtain = Curtain(self.database) self.pressure = Pressure(self.database, self.default, self.__analog) self.temperature = Temperature("28-0417716a37ff", self.database) self.redox = Redox(debug, self.database, self.default, self.__analog) self.ph = PH(debug, self.database, self.default, self.__analog, self.temperature) self.robot = Robot(debug, self.database) self.pump = Pump(debug, self.database, self.default, self.robot, self.redox, self.ph, self.temperature) self.panel = Panel(debug, self.database, self.default, self.pump, self.redox, self.ph, self.__i2c) self.statistic = Statistic(debug, self.pump, self.robot, self.redox, self.ph, self.temperature, self.pressure, self.waterlevel) self.refPath = refPath self.__autoSaveTick = 0 self.__today = date.today().day - 1 debug.TRACE(debug.DEBUG, "Initialisation done (Verbosity level: %s)\n", debug)
def __init__(self, location, size, parent): self.panel = Panel(location, size, parent) self.history_size = MAX_MESSAGES self.messages = RecentList(self.history_size) self.font = pygame.font.Font(FONT, FONTSIZE) self.permanent = [] self.name = "NULL" self.text_entry = PROMPT[:] # want a copy
def __init__(self, node_shape, duration, root_id): self.screen = Panel() if (node_shape == "cross"): self.graph = graph_cross.Graph(self.screen) else: self.graph = graph_point.Graph(self.screen) self.graph.set_duration(duration) self.root_id = root_id
class Story(): def __init__(self): self.window = GWindow(CANVAS_WIDTH, CANVAS_HEIGHT) self.panel = Panel(self.window) def start_story(self): print('Testing your panel!') self.panel.view_panel()
def __init__(self): self.console = None self.outText = None self.inText = None self.outTextScroller = None self.nestedInputPanel = None self.directoryText = None Panel.__init__(self, "insets 0 0 0 0")
def _instrument_changed(self, changes): Panel._instrument_changed(self, changes) if 'data_reset' in changes or 'data_update' in changes: self._replot() for k in ['x_position', 'y_position']: if k in changes: self.position[k] = changes[k]
def __init__(self, ui): pix_w = CharacterPanel.w pix_h = CharacterPanel.h coord = CharacterPanel.coord Panel.__init__(self, ui, pix_w, pix_h, coord=coord) self.player = None
def do_activate(self): self.panel = Panel() self.panel.show() side = self.window.get_side_panel() side.add_item_with_stock_icon(self.panel, "cdncontext", "CDN Context", Gtk.STOCK_INDEX) SharedData().panel = self.panel
def __init__(self, gameSlide, gameHotspot, takenfile, menuSlide, closeupSlide=None, id=None, taken=False, onTake=lambda item: None, onUse=lambda item: None): if id: Item.rows[id] = self self.menuSlide = menuSlide if menuSlide: self.menuHotspot = Hotspot(self.menuSlide, None, onClick=self.use, cursor='grab.png', rectRel=RelativeRect((0, 0, 1, 1))) self.menuSlide.add(self.menuHotspot) self.closeupSlide = closeupSlide if self.closeupSlide: self.closeupPanel = Panel() self.closeupPanel._layer = 11 self.closeupPanel.rect = pyzzle.screen.get_rect() self.closeupHotspot = Hotspot(self.closeupSlide, None, onClick=self.exit, cursor='fwd.png', layer=-1) self.closeupHotspot.rect = pyzzle.screen.get_rect() self.closeupSlide.parent = self.closeupPanel self.closeupSlide._getRect() self.gameSlide = gameSlide if type(gameHotspot) == Hotspot: self.gameHotspot = gameHotspot else: self.gameHotspot = Hotspot(self.gameSlide, None, rectRel=gameHotspot) self.gameHotspot.cursor = 'grab.png' self.gameHotspot.onClick = self.take self.gameHotspot.parent = self.gameSlide self.takenfile = takenfile self.taken = taken if taken and self.menuSlide: self.inventory.add(self.menuSlide) elif gameSlide: gameSlide.add(self.gameHotspot) self.onUse = onUse self.onTake = onTake
def __init__(self, ui): pix_w = CrystalPanel.w pix_h = CrystalPanel.h coord = CrystalPanel.coord self.crystal_inventory = None Panel.__init__(self, ui, pix_w, pix_h, coord=coord) self.crystal_icons = {} self.inventory = None
def create_panel(self): self.panel = Panel() self.panel.set_host(TrobadorPlugin.default_host) tree = self.panel.get_tree() tree.connect("row-activated", self.set_buffer) self.get_translation_unit self.handler_id = self.tab.connect("showed-message", self.get_translation_unit) self.panel.show()
def __init__(self, x, y, expedition): Panel.__init__(self, x, y, 200, 80) self.expedition = expedition self.specialists_label = Label(0, 0, "Workers/Warriors: %d/%d" % (expedition.workers, expedition.warriors)) self.people_label = Label(0, 20, "Population: %d" % expedition.people) self.destination_label = Label(0, 40, "Destination: (%d, %d)" % (expedition.path[0].x, expedition.path[0].y)) self.regularity_label = Label(0, 60, "Regular: %s" % ("Yes" if expedition.regular else "No")) self.add(self.specialists_label) self.add(self.people_label) self.add(self.destination_label) self.add(self.regularity_label)
def AddButtonPanel(self, cancel_button=1): panel = Panel(self, direction='horizontal') self.okbutton = Button(panel, "OK", event=self.OnClickOKButton) self.okbutton.SetDefault() panel.AddComponent(self.okbutton, expand=1, border=5) if cancel_button: cancelbutton = Button(panel, "Cancel", event=self.OnClickCancelButton) panel.AddComponent(cancelbutton, expand=1, border=5) return panel
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) self.ui.t_range.setValue(self._ins.get_t_range()) self.ui.integration_time.setValue(self._ins.get_integration_time()) self.ui.t_range.valueChanged.connect(self._set_t_range) self.ui.integration_time.valueChanged.connect(self._set_integration_time)
def __init__(self, ui): pix_w = AbilityPanel.w pix_h = AbilityPanel.h coord = AbilityPanel.coord Panel.__init__(self, ui, pix_w, pix_h, coord=coord) self.inventory = None self.ability_slots = {} self.ability_positions = self.set_ability_positions()
def _instrument_changed(self, changes): if 'dimension' in changes: self._ins_dimension = changes['dimension'] if self._ins_dimension == self._dimension: Panel._instrument_changed(self, changes) if changes.has_key('scan_length'): self.ui.scan_length.setValue(float(changes['scan_length'])) if changes.has_key('pixel_time'): self.ui.pixel_time.setValue(int(changes['pixel_time'])) if changes.has_key('nr_of_points'): self.ui.nr_of_points.setValue(int(changes['nr_of_points'])) if changes.has_key('gaussian_fit'): self.ui.gaussian_fit.setChecked(bool(changes['gaussian_fit'])) if changes.has_key('counter'): self.ui.counter.setValue(int(changes['counter'])) if 'data_update' in changes: d = changes['data_update'] if 'points' in d: self.ui.plot.set_x(self._data['points']) try: self.ui.plot.plot.delplot('countrates') self.ui.plot.plot.delplot('fit') except: pass if 'countrates' in d: self.ui.plot.add_y(self._data['countrates'], 'countrates', type='scatter', marker='circle', color='green') if 'fit' in d: self.ui.plot.add_y(self._data['fit'], 'fit', type='line', line_width=2, color='red') if changes.has_key('fit_result'): self._got_fit_result(changes['fit_result'])
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) self.ui.x.setValue(self._ins.get_mos_x()) self.ui.y.setValue(self._ins.get_mos_y()) self.ui.z.setValue(self._ins.get_mos_z()) self.ui.z_slider.setValue(int(self._ins.get_mos_z() * 10)) self.ui.keyword.setText(self._ins.get_keyword())
def appendPanelElement(self, panelElement): ''' Append an element to the first panel that has room if there is no free spot create a panel and put the element inside ''' for panel in self.panels: if panel.appendPanelElement(panelElement): break else: panel = Panel(1) self.panels.append(panel) return panel.appendPanelElement(panelElement) return True
def draw(self, screen): """Renders the movie to the screen, then draws any sprites within the Movie.""" movie=self._getMovie() if not movie.get_busy(): if self.loop: movie.rewind() elif not self.played: self.played=True self.exit(delay=0) self.onStop() screen.blit(self.surface, self._rect) Panel.draw(self, screen)
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) self.ui.x.setValue(self._ins.get_mos_x()) self.ui.y.setValue(self._ins.get_mos_y()) self.ui.z.setValue(self._ins.get_mos_z()) self.ui.z_slider.setValue(int(self._ins.get_mos_z()*10)) self.ui.keyword.setText(self._ins.get_keyword())
def main(): lMonitors = parseMonitors() config = Configuration("test.conf") panel_threads = [] # only handling 'all' case for now. if config.location['monitor'] == 'all': for m in lMonitors: p = Panel(config) p.launch(m) t = threading.Thread(target=p.run, kwargs={'monitor': m}) t.start() pass
def entities(self): self.label = pyglet.text.Label('Hello, world', font_name = 'Times New Roman', font_size = 36, x = self.width/2, y = self.height/2, anchor_x = 'center', anchor_y = 'center') self.panel = Panel((self.width,self.height)) self.background = Background((self.width,self.height),self.panel.size) self.background.pos = [self.mapsize[0] / 2, self.mapsize[1] / 2] self.background.populate() self.bgcheck = 1 self.player = player.Player((self.width,self.height),self.panel.size) self.player.name = self.name self.player.idnum = self.idnum self.player.location[0] = self.startsystem self.spritelist = [self.player.sprite] self.visible_size = (self.background.x,self.background.y) self.systemdict = MakeSystemDict("data/systems/systems.list",self.player.pos,self.center,self.visible_size) self.systemdict.get(self.startsystem.name).update(self.startsystem) self.systemdict.get(self.startsystem.name).active = 1 self.system = self.systemdict.get(self.startsystem.name) self.selectedsystem = None self.activesystem = self.system.name self.linkdict = MakeLinks(self.systemdict) print "LINKDICT: " + str(self.linkdict) self.menudialogue = MenuDialogue((self.width,self.height)) self.optionsdialogue = OptionsDialogue((self.width,self.height)) self.controlsdialogue = ControlsDialogue((self.width,self.height)) self.dockdialogue = DockDialogue((self.width,self.height)) self.mapdialogue = MapDialogue((self.width, self.height)) self.mapdialogue.active = self.activesystem
def populateMenu(self): from panel import Panel from PyQt4.QtCore import QObject, SIGNAL from PyQt4.QtGui import QAction if not self.panel: self.panel = Panel(self._iface) self.panel.setVisible(False) self.panelAction = self.panel.toggleViewAction() self.menu.addAction(self.panelAction) self.settingsAction = QAction( self.menu.tr("&Settings", "Processing"), self._iface.mainWindow()) self.menu.addAction(self.settingsAction) QObject.connect(self.settingsAction, SIGNAL("triggered()"), self.showSettings) self.workflowBuilderAction= QAction( self.menu.tr("&Workflow builder", "Processing"), self._iface.mainWindow()) self.menu.addAction(self.workflowBuilderAction) QObject.connect(self.workflowBuilderAction, SIGNAL("triggered()"), self.showWorkflowBuilder) self.aboutAction = QAction( self.menu.tr("&About", "Processing"), self._iface.mainWindow()) self.menu.addAction(self.aboutAction) QObject.connect(self.aboutAction, SIGNAL("triggered()"), self.showAboutDialog)
def __init__(self, root): self.config = Config("tkc.ini") root.title("Tkinter Commander") root.protocol("WM_DELETE_WINDOW", self.on_delete) self.root = root root.geometry(self.config.get("fm_geometry")) root.grid_columnconfigure(0, weight=1) root.grid_rowconfigure(1, weight=1) pw = Panedwindow(root, orient="horizontal", takefocus=False) frame = Frame(pw) self.left = Panel(frame, Local_fs(), self.config) pw.add(frame) pw.pane(frame, weight=1) frame = Frame(pw) self.right = Panel(frame, Local_fs(), self.config) self.right.oposite = ref(self.left) self.left.oposite = ref(self.right) self.left.activate() pw.add(frame) pw.pane(frame, weight=1) pw.grid(column=0, row=1, columnspan=2, sticky="senw") self.add_menu() self.add_btns() root.tk.call( "wm", "iconphoto", root._w, PhotoImage(file=join(dirname(__file__), "data", "favicon.gif")))
def __init__ (self, *args, **kwargs): Panel.__init__ (self, *args, **kwargs) self.parent = args[0] self.sizer = wx.BoxSizer (wx.VERTICAL) self.textctrl = outputctrl.OutputCtrl(self, style=wx.TE_MULTILINE|wx.TE_AUTO_SCROLL) self.sizer.Add (self.textctrl, -1, wx.EXPAND, 0) # clear button self.btnClear = wx.Button (self, 0, label="Ausgabe leeren") self.sizer.Add (self.btnClear) self.Bind (wx.EVT_BUTTON, self.onClear, self.btnClear) self.SetSizer (self.sizer) self.Layout ()
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) self.ui.AOM_on_ADwin.setChecked(self._ins.get_AOMonADwin()) self.ui.LT_settings.setChecked(self._ins.get_LT_settings()) self.ui.TemperatureA.setValue(self._ins.get_TemperatureA()) self.ui.TemperatureB.setValue(self._ins.get_TemperatureB()) self.ui.z_Position.setValue(self._ins.get_z_Position()) if self._ins.get_LT_settings() == 0: self.ui.z_Position_Slider.setValue(self.ui.z_Position.value() * 1000 / 24) else: self.ui.z_Position_Slider.setValue(self.ui.z_Position.value() * 1000 / 15) self.ui.BlockMillennia.clicked.connect(self.BlockMillennia) self.ui.UnblockMillennia.clicked.connect(self.UnblockMillennia) self.ui.BlockChA.clicked.connect(self.BlockChA) self.ui.UnblockChA.clicked.connect(self.UnblockChA) self.ui.BlockChB.clicked.connect(self.BlockChB) self.ui.UnblockChB.clicked.connect(self.UnblockChB) self.ui.BlockNewFocus.clicked.connect(self.BlockNewFocus) self.ui.UnblockNewFocus.clicked.connect(self.UnblockNewFocus) self.ui.PowermeterIn.clicked.connect(self.PowermeterIn) self.ui.PowermeterOut.clicked.connect(self.PowermeterOut) self.ui.FlipBeamPath.clicked.connect(self.FlipBeamPath) self.ui.DefaultSettings.clicked.connect(self.DefaultSettings) self.ui.SetPowerGreen.clicked.connect(self.SetPowerGreen) self.ui.GetPowerGreen.clicked.connect(self.GetPowerGreen) self.ui.CalibrateGreenAOM.clicked.connect(self.CalibrateGreenAOM) self.ui.SetPowerRed.clicked.connect(self.SetPowerRed) self.ui.GetPowerRed.clicked.connect(self.GetPowerRed) self.ui.CalibrateRedAOM.clicked.connect(self.CalibrateRedAOM) self.ui.AttocubeUp.clicked.connect(self.AttocubeUp) self.ui.AttocubeDown.clicked.connect(self.AttocubeDown) self.ui.PiezoMirrorPlus.clicked.connect(self.PiezoMirrorPlus) self.ui.PiezoMirrorMinus.clicked.connect(self.PiezoMirrorMinus) self.ui.PiezoMirrorMax.clicked.connect(self.PiezoMirrorMax) self.ui.AOM_on_ADwin.stateChanged.connect(self.AOM_on_ADwin_Changed) self.ui.LT_settings.stateChanged.connect(self.LT_settings_Changed) self.ui.OptimizeXY.clicked.connect(self.OptimizeXY) self.ui.OptimizeZ.clicked.connect(self.OptimizeZ) self.ui.z_Position_Slider.valueChanged.connect(self.z_Position_Changed) self.ui.GetTemperatureA.clicked.connect(self.GetTemperatureA) self.ui.GetTemperatureB.clicked.connect(self.GetTemperatureB)
def createPanelFromXML(panelNode, sourceApp=None): panel = Panel(None) if len(panelNode) is 0: logger.warn('Dashboard panel is empty (line %d)', panelNode.sourceline) for panelElementNode in panelNode: if panelElementNode.tag == 'input': inputInstance = forminput.createInput( panelElementNode.get('type'), dict(searchWhenChanged=True)) inputInstance.fromXml(panelElementNode, sourceApp) panel.fieldset.append(inputInstance) else: panelElement = createPanelElementFromXml(panelElementNode) if panelElement: panel.appendPanelElement(panelElement) return panel
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) self.ui.doubleSpinBox_start_F.setValue(self._ins.get_doubleSpinBox_start_F()) self.ui.doubleSpinBox_stop_f.setValue(self._ins.get_doubleSpinBox_stop_f()) self.ui.doubleSpinBox_step_f.setValue(self._ins.get_doubleSpinBox_step_f()) self.ui.doubleSpinBox_start_F.valueChanged.connect(self._set_doubleSpinBox_start_F) self.ui.doubleSpinBox_stop_f.valueChanged.connect(self._set_doubleSpinBox_stop_f) self.ui.doubleSpinBox_step_f.valueChanged.connect(self._set_doubleSpinBox_step_f) self.ui.start_scan_button.pressed.connect(self._start_scan_button) self.ui.stop_scan_button.pressed.connect(self._stop_scan_button) self.ui.save_scan_button.pressed.connect(self._save_scan_button)
def __init__(self, parent, *arg, **kw): Panel.__init__(self, parent, *arg, **kw) # designer ui self.ui = Ui_Panel() self.ui.setupUi(self) # setting up the basic plot properties self.ui.plot.left_axis.title = 'y [um]' self.ui.plot.bottom_axis.title = 'x [um]' self.ui.plot.colorbar_axis.title='counts [Hz]' self.ui.plot.enable_colorbar_zooming() self.ui.plot.enable_colorbar_panning() # enable the cross hair positioning self.ui.plot.enable_crosshair('color_plot') print self._ins self.ui.plot.crosshair_moved.connect(self._ins.set_xy) # read the instrument parameters and set the input # fields accordingly self.ui.xstart.setValue(self._ins.get_xstart()) self.ui.xstop.setValue(self._ins.get_xstop()) self.ui.xsteps.setValue(self._ins.get_xsteps()) self.ui.ystart.setValue(self._ins.get_ystart()) self.ui.ystop.setValue(self._ins.get_ystop()) self.ui.ysteps.setValue(self._ins.get_ysteps()) self.ui.pxtime.setValue(self._ins.get_pixel_time()) if self._ins.get_counter() == 1: self.ui.counter.setCurrentIndex(0) if self._ins.get_counter() == 2: self.ui.counter.setCurrentIndex(1) # FIXME do that nicer, load data thats already in the instrument self._data['countrates'] = zeros((self._ins.get_ysteps(), self._ins.get_xsteps())) # this flag indicates whether the plot needs to be updated self._do_update = False self._busy = False # some more local variables for position storage self.position = {'x_position' : self._ins.get_x_position(), 'y_position' : self._ins.get_y_position(), }
def __init__(self, parent, tickfreq=0.5, min=-5.0, max=5.0, format='%.1f',event=None, size=None, **kwargs): if 'labels' in kwargs: labels=kwargs['labels'] kwargs['labels']=False Panel.__init__(self,parent,direction='v') intmin=0 intmax=int(float(max-min)/tickfreq) inttickfreq=1 self.min=min self.max=max self.tickfreq=tickfreq self.format=format self.slider=Slider(self, inttickfreq,intmin,intmax,event,size,**kwargs) self.slider.SetValue(self.slider.GetMax()/2) self.slider.OnScroll=self.OnScroll self.AddComponent(self.slider,stretch=True,border=10) if labels: p=Panel(self,direction='h') self.text1=Label(p,self.format % self.min,align='left') self.text2=Label(p,self.format % self.max,align='right') self.text3=Label(p,self.format % self.GetValue(),align='center') p.AddComponent(self.text1,expand=True,border=3) p.AddComponent(self.text3,expand=False,border=3) p.AddComponent(self.text2,expand=True,border=3) p.Pack() self.AddComponent(p,stretch=True) self.Pack()
def __init__(self): self.window_manager = WindowManager() self.events = Queue() self.panel = Panel() self.clock = Clock() self.notification_monitor = NotificationMonitor() try: with open(os.path.expanduser('~/.config/mpd/credentials.conf'), 'r') as f: mpd_settings = json.load(f) except FileNotFoundError: self.music = Music() else: self.music = Music(**mpd_settings) self.music_controller = self.music.clone() self.system_info = SystemInfo()
def create_panels(self): """Creates a graphical-like UI: ┌────────┐┌────────────────────────────────┐ │Branches││Log history │ │> master││ │ │> devel ││ │ │ ││ │ │Remotes ││ │ │> origin│└────────────────────────────────┘ │ │┌───────────────┐┌───────────────┐ │Tags ││ Staged files ││ │ │ │└───────────────┘│ Diff of │ │Stashes │┌───────────────┐│ selected file │ │ ││ Changed files ││ │ └────────┘└───────────────┘└───────────────┘ """ height, width = self.stdscr.getmaxyx() if height < 8 or width < 40: raise Exception("Height and width must be at least 8x40.\ Currently: %sx%s" % (height, width)) # Following sizes are percentages (e.g. w_30 is 30% of screen width) w_20 = min(max(width // 5, 20), 25) w_30 = width // 3 w_50 = width - w_30 - w_20 h_49 = height // 2 h_51 = height - h_49 h_25 = h_51 // 2 h_26 = h_51 - h_25 h_l = height // 5 h_br = height - 4 * h_l self['branches'] = StateLinePanel(self.stdscr, h_br, w_20, 0, 0, title='Branches') self['remotes'] = Panel(self.stdscr, h_l, w_20, h_br, 0, title='Remotes') self['stashes'] = Panel(self.stdscr, h_l, w_20, h_br+h_l, 0, title='Stashes') self['submodules'] = Panel(self.stdscr, h_l, w_20, h_br+2*h_l, 0, title='Submodules') self['tags'] = StateLinePanel(self.stdscr, h_l, w_20, h_br+3*h_l, 0, title='Tags') self['log'] = StateLinePanel(self.stdscr, h_49, w_30 + w_50, 0, w_20, title='History') self['stage'] = StagerUnstager(self, self.stdscr, h_25, w_30, h_49, w_20, title='Staging Area') self['changes'] = StagerUnstager(self, self.stdscr, h_26, w_30, h_49 + h_25, w_20, title='Local Changes') self['diff'] = Diff(self.stdscr, h_51, w_50, h_49, w_20 + w_30, title='Diff View') self['changes'].rungit = rungit.git_changed self['stage'].rungit = rungit.git_staged self['log'].rungit = rungit.git_history self['branches'].rungit = rungit.git_branches self['remotes'].rungit = rungit.git_remotes self['stashes'].rungit = rungit.git_stashes self['submodules'].rungit = rungit.git_submodules self['tags'].rungit = rungit.git_tags self['diff'].rungit = rungit.git_diff self['changes'].action = self.stage_file self['stage'].action = self.unstage_file
class Face: def __init__(self, root): self.config = Config("tkc.ini") root.title("Tkinter Commander") root.protocol("WM_DELETE_WINDOW", self.on_delete) self.root = root root.geometry(self.config.get("fm_geometry")) root.grid_columnconfigure(0, weight=1) root.grid_rowconfigure(1, weight=1) pw = Panedwindow(root, orient="horizontal", takefocus=False) frame = Frame(pw) self.left = Panel(frame, Local_fs(), self.config) pw.add(frame) pw.pane(frame, weight=1) frame = Frame(pw) self.right = Panel(frame, Local_fs(), self.config) self.right.oposite = ref(self.left) self.left.oposite = ref(self.right) self.left.activate() pw.add(frame) pw.pane(frame, weight=1) pw.grid(column=0, row=1, columnspan=2, sticky="senw") self.add_menu() self.add_btns() root.tk.call( "wm", "iconphoto", root._w, PhotoImage(file=join(dirname(__file__), "data", "favicon.gif"))) def add_menu(self): top = self.root top["menu"] = menubar = Menu(top) menu_file = Menu(menubar) menu_settings = Menu(menubar) menu_help = Menu(menubar) menubar.add_cascade(menu=menu_file, label=_("File")) menubar.add_cascade(menu=menu_settings, label=_("Settings")) menubar.add_cascade(menu=menu_help, label=_("Help")) menu_settings.add_command(label=_("Pannel Settings"), command=self.dlg_panset) def add_btns(self): root = self.root frame = Frame(root) for key, text, command in ( (3, _("F3 View"), self.on_F3), (4, _("F4 Edit"), self.on_F4), (5, _("F5 Copy"), self.on_F5), (6, _("F6 Move"), self.on_F6), (7, _("F7 Make Directory"), self.on_F7), (8, _("F8 Remove"), self.on_F8), (10, _("F10 Exit"), self.on_F10)): btn = Button(frame, text=text, command=command, takefocus=False) btn.pack(side="left", fill="x", expand=True) root.bind_all("<F%d>" % key, func=command) sz = Sizegrip(frame) sz.pack(side="right", anchor="se") frame.grid(column=0, row=2, columnspan=2, sticky="we") def get_panels(self): "returns (active, passive) panels" if self.left.is_active: return self.left, self.right return self.right, self.left def on_delete(self): self.config["fm_geometry"] = self.root.geometry() self.config.save() self.root.destroy() def on_F3(self, evt=None): print("F3") def on_F4(self, evt=None): print("F4") def on_F5(self, evt=None): buttons.copy_button(self) def on_F6(self, evt=None): print("F6") def on_F7(self, evt=None): print("F7") def on_F8(self, evt=None): print("F8") def on_F10(self, evt=None): self.on_delete() def dlg_panset(self): from dialogs import Dlg_panset Dlg_panset(self.root, self.config)
class TrobadorPlugin(GObject.Object, Gtranslator.TabActivatable, PeasGtk.Configurable): __gtype_name__ = "TrobadorPlugin" tab = GObject.property(type=Gtranslator.Tab) handler_id = None project = '' version = '' host = '' default_host = 'trobador.trasno.net' check = Gtk.CheckButton() project_entry = Gtk.Entry() version_entry = Gtk.Entry() host_entry = Gtk.Entry() save_button = Gtk.Button(label="Save") save_host_button = Gtk.Button(label="Save") def __init__(self): GObject.Object.__init__(self) def do_activate(self): self.window = self.tab.get_toplevel() self.create_panel() TrobadorPlugin.host = self.default_host self.tab.add_widget(self.panel, "GtrTrobador", _("Trobador"), "results panel", Gtranslator.TabPlacement.RIGHT) def do_deactivate(self): print "Removing..." self.tab.remove_widget(self.panel) self.tab.disconnect(self.handler_id) def do_update_state(self): pass def check_checkButton_state(self, check): if self.check.get_active(): print "activate" self.project_entry.set_editable(True) self.version_entry.set_editable(True) self.save_button.set_sensitive(True) else: print "deactivate" self.project_entry.set_text("") self.version_entry.set_text("") self.project_entry.set_editable(False) self.version_entry.set_editable(False) self.save_button.set_sensitive(False) TrobadorPlugin.project = '' TrobadorPlugin.version = '' def do_create_configure_widget(self): table = Gtk.Table(8, 2, True) if not self.check.get_active(): self.project_entry.set_editable(False) self.version_entry.set_editable(False) self.save_button.set_sensitive(False) #self.check = Gtk.CheckButton("Seleccionar proyecto y version") self.check.set_label("Select project & version") self.check.set_border_width(6) self.check.connect("clicked", self.check_checkButton_state) project_label = Gtk.Label("Project") #self.proyectoEntry = Gtk.Entry() self.project_entry.set_text(TrobadorPlugin.project) version_label = Gtk.Label("Version") #self.version_entry = Gtk.Entry() self.version_entry.set_text(TrobadorPlugin.version) #save_button = Gtk.Button(label="Guardar") self.save_button.set_label("Save") self.save_host_button.set_label("Save") hostLabel = Gtk.Label("Host") if self.host == '': self.host_entry.set_text(TrobadorPlugin.default_host) else: self.host_entry.set_text(TrobadorPlugin.host) info_label1 = Gtk.Label("Project settings") info_label2 = Gtk.Label("Host settings") table.attach(info_label1, 0, 2, 0, 1) table.attach(self.check, 0, 2, 1, 2) table.attach(project_label, 0, 1, 2, 3) table.attach(self.project_entry, 1, 2, 2, 3) table.attach(version_label, 0, 1, 3, 4) table.attach(self.version_entry, 1, 2, 3, 4) table.attach(self.save_button, 0, 1, 4, 5) table.attach(info_label2, 0, 2, 5, 6) table.attach(hostLabel, 0, 1, 6, 7) table.attach(self.host_entry, 1, 2, 6, 7) table.attach(self.save_host_button, 0, 1, 7, 8) self.save_button.connect("clicked", self.save_config, self.project_entry.get_text(), self.version_entry.get_text()) self.save_host_button.connect("clicked", self.save_host_config, self.host_entry.get_text()) return table def save_config(self, save_button, project, version): TrobadorPlugin.project = self.project_entry.get_text() TrobadorPlugin.version = self.version_entry.get_text() def save_host_config(self, save_host_button, host): if self.host_entry.get_text() != '': TrobadorPlugin.host = self.host_entry.get_text() else: TrobadorPlugin.host = self.default_host self.host_entry.set_text(TrobadorPlugin.host) def create_panel(self): self.panel = Panel() self.panel.set_host(TrobadorPlugin.default_host) tree = self.panel.get_tree() tree.connect("row-activated", self.set_buffer) self.get_translation_unit self.handler_id = self.tab.connect("showed-message", self.get_translation_unit) self.panel.show() def set_buffer(self, tree, row, col): iterator = self.panel.get_iterator() # l = tree.get_model() #rootiter = l.get_iter_first() selection, iterator = tree.get_selection().get_selected() if iterator != None: view = self.window.get_active_view() if not view or not view.get_editable(): return "no editable" document = view.get_buffer() document.begin_user_action() iters = document.get_selection_bounds() if iters: document.delete_interactive(iters[0], iters[1], view.get_editable()) document.insert_interactive_at_cursor(selection.get_value(iterator, 0), -1, view.get_editable()) document.end_user_action() def get_translation_unit(self, tab, msg): po_file = GObject.property(type=Gtranslator.Po) po_file = self.tab.get_po() print msg.get_msgid() msg = po_file.get_current_message() c = msg[0].get_msgid() self.panel.set_translation_unit(c) self.panel.set_project(self.project) self.panel.set_version(self.version) self.panel.set_host(self.host) print "hola: " + self.panel.get_host() # Updating the results self.panel.update_data()