def build(self): self.changes_flag = False self.styles = self._get_styles() self.styles_combo = wal.Combolist(self, items=self.styles, onchange=self.on_style_change) self.add(self.styles_combo, 0, wal.LEFT | wal.CENTER, 2) self.add((3, 3)) self.families, self.faces_dict = libpango.get_fonts() self.families_combo = FontChoice(self, onchange=self.on_font_change) self.add(self.families_combo, 0, wal.LEFT | wal.CENTER, 2) self.add((3, 3)) self.faces = self.faces_dict['Sans'] self.faces_combo = wal.Combolist(self, items=self.faces, onchange=self.apply_changes) self.faces_combo.set_active(0) self.add(self.faces_combo, 0, wal.LEFT | wal.CENTER, 2) self.add((3, 3)) self.size_combo = wal.FloatCombobox(self, 12, width=5, digits=2, items=FONT_SIZES, onchange=self.apply_changes) self.add(self.size_combo, 0, wal.LEFT | wal.CENTER, 2) self.pack(wal.VLine(self), fill=True, padding_all=3) self.align = wal.HToggleKeeper(self, ALIGN_MODES, ALIGN_MODE_ICONS, ALIGN_MODE_NAMES, on_change=self.apply_changes, allow_none=False) self.align.set_mode(sk2_const.TEXT_ALIGN_LEFT) self.add(self.align, 0, wal.LEFT | wal.CENTER, 2) self.pack(wal.VLine(self), fill=True, padding_all=3) self.ligature = wal.ImageToggleButton(self, False, icons.PD_LIGATURE, tooltip=_('Use ligatures'), onchange=self.apply_changes) self.add(self.ligature, 0, wal.LEFT | wal.CENTER, 2)
def build(self): for item in self.ids: if item is None: self.pack(wal.VLine(self), fill=True, padding=3) else: btn = ActionButton(self, self.actions[item]) self.pack(btn, padding=1)
def __init__(self, parent, dlg): self.dlg = dlg wal.HPanel.__init__(self, parent) Btn = wal.ImageButton buttons = [ (icons.PD_OPEN, self.dlg.open_log, _('Open log file...')), (icons.PD_FILE_SAVE_AS, self.dlg.save_as_log, _('Save logs as...')), None, (icons.PD_ZOOM_IN, self.dlg.zoom_in, _('Zoom in')), (icons.PD_ZOOM_OUT, self.dlg.zoom_out, _('Zoom out')), # None, # (icons.PD_PREFERENCES, self.stub, _('Viewer preferences')), ] for item in buttons: if item: self.pack( Btn(self, item[0], wal.SIZE_22, tooltip=item[2], onclick=item[1])) elif item is None: self.pack(wal.VLine(self), padding_all=5, fill=True) else: self.pack((5, 5), expand=True)
def build(self): for item in self.ids: if item is None: self.add(wal.VLine(self), 0, wal.ALL | wal.EXPAND, 2) else: btn = ActionButton(self, self.actions[item]) self.add(btn, 0, wal.LEFT | wal.CENTER, 2)
def __init__(self): wal.MainWindow.__init__(self) self.set_size(300, 200) self.pack(wal.HLine(self), padding=30) hbox = wal.HBox(self) hbox.pack(wal.VLine(self), True, True) self.pack(hbox, True, True)
def build(self): prnpanel = wal.VPanel(self) # --- Control panels prnpanel.pack(PrinterPanel(prnpanel, self, self.printsys), fill=True) prnpanel.pack(PrintModePanel(prnpanel, self.printer), fill=True) prnpanel.pack(PageRangePanel(prnpanel, self.printout), fill=True) prnpanel.pack(CopiesPanel(prnpanel, self.printer, self.printout), fill=True) # --- Control panels end self.pack(prnpanel, fill=True) self.pack(wal.VLine(self), fill=True) cont = wal.VPanel(self) r_grid = wal.GridPanel(cont) cv_grid = wal.GridPanel(r_grid) self.canvas = PreviewCanvas(cv_grid, self, self.printer, self.printout) units = self.printout.get_units() corner = PreviewCorner(r_grid) hruler = PreviewRuler(r_grid, self.canvas, units) hruler.set_bg(wal.WHITE) vruler = PreviewRuler(r_grid, self.canvas, units, False) vruler.set_bg(wal.WHITE) tb = PreviewToolbar(cont, self, self.canvas, self.printer) vscroll = wal.ScrollBar(cv_grid, onscroll=self.canvas._scrolling) hscroll = wal.ScrollBar(cv_grid, False, onscroll=self.canvas._scrolling) self.canvas.set_ctrls(hscroll, vscroll, hruler, vruler, tb.pager) cont.pack(tb, fill=True) cont.pack(wal.HLine(self), fill=True) cv_grid.add_growable_col(0) cv_grid.add_growable_row(0) cv_grid.pack(self.canvas, fill=True) cv_grid.pack(vscroll, fill=True) cv_grid.pack(hscroll, fill=True) cv_grid.pack((1, 1)) r_grid.add_growable_col(1) r_grid.add_growable_row(1) r_grid.pack(corner) r_grid.pack(hruler, fill=True) r_grid.pack(vruler, fill=True) r_grid.pack(cv_grid, fill=True) cont.pack(r_grid, fill=True, expand=True) self.pack(cont, fill=True, expand=True) prn_events.connect(prn_events.PRINTER_CHANGED, self.printer_changed) prn_events.connect(prn_events.PRINTOUT_MODIFIED, self.printout_modified) prn_events.connect(prn_events.PRINTER_MODIFIED, self.printer_modified)
def __init__(self, app, parent): self.app = app wal.HPanel.__init__(self, parent) self.pack(wal.VLine(self), fill=True) self.container = wal.VPanel(self) self.pack(self.container, expand=True, fill=True) self.tabs = PlgTabsPanel(app, self) self.pack(self.tabs, fill=True) self.layout()
def __init__(self, app, parent): self.app = app self.parent = parent self.insp = self.app.insp self.actions = self.app.actions wal.HPanel.__init__(self, parent) self.build() self.add(wal.VLine(self), 0, wal.ALL | wal.EXPAND, 2) self.hide()
def __init__(self, app, parent): self.app = app self.parent = parent self.insp = self.app.insp self.actions = self.app.actions wal.HPanel.__init__(self, parent) self.build() self.pack(wal.VLine(self), fill=True, padding=3) self.hide()
def __init__(self, app, parent): self.app = app self.parent = parent wal.HPanel.__init__(self, parent) native = False if wal.IS_GTK: native = True callback = self.app.proxy.goto_start self.start_but = wal.ImageButton( self.panel, icons.PD_PM_ARROW_START, tooltip=_('Go to fist page'), decoration_padding=4, native=native, onclick=callback) self.pack(self.start_but) callback = self.app.proxy.previous_page self.prev_but = wal.ImageButton( self.panel, icons.PD_PM_ARROW_LEFT, tooltip=_('Go to previous page'), decoration_padding=4, native=native, onclick=callback) self.pack(self.prev_but) self.page_txt = wal.Label(self.panel, text=' ', fontsize=FONTSIZE[0]) self.pack(self.page_txt) callback = self.app.proxy.next_page self.next_but = wal.ImageButton( self.panel, icons.PD_PM_ARROW_RIGHT, tooltip=_('Go to next page'), decoration_padding=4, native=native, onclick=callback) self.pack(self.next_but) callback = self.app.proxy.goto_end self.end_but = wal.ImageButton( self.panel, icons.PD_PM_ARROW_END, tooltip=_('Go to last page'), decoration_padding=4, native=native, onclick=callback) self.pack(self.end_but) self.pack(wal.VLine(self.panel), fill=True, padding=4) events.connect(events.NO_DOCS, self.hide_monitor) events.connect(events.DOC_CHANGED, self.update) events.connect(events.DOC_MODIFIED, self.update) events.connect(events.PAGE_CHANGED, self.update)
def __init__(self, parent, val=(0.0, 0.0), onchange=None): self.val = val self.callback = onchange self.toggles = {-1.0:{}, 0.0:{}, 1.0:{}} wal.GridPanel.__init__(self, parent, 5, 5, 2, 2) for y in REV_VALS: for x in VALS: state = False if (x, y) == (0.0, 0.0): state = True toggle = OIToggle(self, (x, y), state, self.on_change) self.pack(toggle) self.toggles[x][y] = toggle if x < 1.0: self.pack(wal.HLine(self), fill=True) if y > -1.0: self.pack(wal.VLine(self), fill=True) self.pack(CELL_SIZE) self.pack(wal.VLine(self), fill=True) self.pack(CELL_SIZE) self.pack(wal.VLine(self), fill=True)
def __init__(self, master, app): self.app = app wal.HidableHBox.__init__(self, master) self.pack(wal.VLine(self), padding=1) box = wal.VBox(self) box.pack( wal.ImgButton(self, rc.IMG_PALETTE_DOUBLE_ARROW_TOP, cmd=self.action_dback, repeat=True, flat=True)) box.pack( wal.ImgButton(self, rc.IMG_PALETTE_ARROW_TOP, cmd=self.action_back, repeat=True, flat=True)) box.pack( wal.ClickableImage(self, rc.IMG_PALETTE_NO_COLOR, tooltip=_('Empthy pattern'), cmd=self.action_nocolor)) self.pw = VPaletteWidget(box, self.app) box.pack(self.pw, True, True, 1) box.pack( wal.ImgButton(self, rc.IMG_PALETTE_ARROW_BOTTOM, cmd=self.action_forward, repeat=True, flat=True)) box.pack( wal.ImgButton(self, rc.IMG_PALETTE_DOUBLE_ARROW_BOTTOM, cmd=self.action_dforward, repeat=True, flat=True)) self.pack(box, True, True) if config.palette_orientation == const.VERTICAL and config.palette_visible: self.set_visible(True) else: self.set_visible(False)
def __init__(self, app, parent): self.app = app wal.HPanel.__init__(self, parent) self.pack(get_bmp(self.panel, icons.PD_MOUSE_MONITOR)) width = 100 if wal.is_mac(): width = 130 self.pointer_txt = wal.Label(self.panel, text=' ', fontsize=FONTSIZE[0]) self.pointer_txt.SetMinSize((width, -1)) self.pack(self.pointer_txt) self.pack(wal.VLine(self.panel), fill=True, padding=2) events.connect(events.MOUSE_STATUS, self.set_value) events.connect(events.NO_DOCS, self.hide_monitor) events.connect(events.DOC_CHANGED, self.doc_changed)
def __init__(self, parent, dlg, canvas, printer): self.dlg = dlg self.canvas = canvas self.printer = printer wal.HPanel.__init__(self, parent) self.pack(wal.Label(self, _('Page:')), padding=5) rng = (1, len(self.canvas.pages)) self.pager = wal.IntSpin(self, 1, rng, onchange=self.on_pager_change, onenter=self.on_pager_change) self.pack(self.pager, padding=5) if len(self.canvas.pages) == 1: self.pager.set_enable(False) Btn = wal.ImageButton buttons = [ None, (icons.PD_PRINT, self.dlg.on_print, _('Print')), (icons.PD_PRINT_PREVIEW, self.on_printer_props, _('Printer properties')), None, (icons.PD_ZOOM_IN, self.canvas.zoom_in, _('Zoom in')), (icons.PD_ZOOM_OUT, self.canvas.zoom_out, _('Zoom out')), (icons.PD_ZOOM_PAGE, self.canvas.zoom_fit_to_page, _('Fit to page')), (icons.PD_ZOOM_100, self.canvas.zoom_100, _('Zoom 100%')), None, ] for item in buttons: if item: self.pack( Btn(self, item[0], wal.SIZE_22, tooltip=item[2], onclick=item[1])) elif item is None: self.pack(wal.VLine(self), padding_all=5, fill=True) else: self.pack((5, 5), expand=True) prn_events.connect(prn_events.PRINTER_CHANGED, self.printer_changed)
def __init__(self, app, parent): self.app = app actions = app.actions wal.HPanel.__init__(self, parent) action_id = pdids.ID_SNAP_TO_GRID tooltip_txt = get_tooltip_text(action_id) icons_dict = { True: [icons.PD_SNAP_TO_GRID_ON, tooltip_txt], False: [icons.PD_SNAP_TO_GRID_OFF, tooltip_txt] } sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) action_id = pdids.ID_SNAP_TO_GUIDE tooltip_txt = get_tooltip_text(action_id) icons_dict = { True: [icons.PD_SNAP_TO_GUIDE_ON, tooltip_txt], False: [icons.PD_SNAP_TO_GUIDE_OFF, tooltip_txt] } sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) action_id = pdids.ID_SNAP_TO_OBJ tooltip_txt = get_tooltip_text(action_id) icons_dict = { True: [icons.PD_SNAP_TO_OBJ_ON, tooltip_txt], False: [icons.PD_SNAP_TO_OBJ_OFF, tooltip_txt] } sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) action_id = pdids.ID_SNAP_TO_PAGE tooltip_txt = get_tooltip_text(action_id) icons_dict = { True: [icons.PD_SNAP_TO_PAGE_ON, tooltip_txt], False: [icons.PD_SNAP_TO_PAGE_OFF, tooltip_txt] } sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) self.pack(wal.VLine(self.panel), fill=True, padding=2)
def __init__(self, parent, val=(0.0, 0.0), onchange=None): self.val = val self.callback = onchange self.toggles = {-1.0: {}, 0.0: {}, 1.0: {}} wal.GridPanel.__init__(self, parent, 5, 5, 2, 2) for y in REV_VALS: for x in VALS: state = (x, y) == (0.0, 0.0) toggle = OIToggle(self, (x, y), state, self.on_change) self.pack(toggle) self.toggles[x][y] = toggle if x < 1.0: panel = wal.HPanel(self) panel.pack(wal.HLine(self), expand=True) self.pack(panel, fill=True) if y > -1.0: for i in range(3): panel = wal.VPanel(self) panel.pack(wal.VLine(panel), expand=True) self.pack(panel, fill=True) self.pack(CELL_SIZE) if i < 2 else None
def __init__(self, app, master): wal.HBox.__init__(self, master) self.app = app self.insp = app.inspector self.start = wal.ImgButton(self, rc.IMG_PAGER_START, cmd=self.first_page, flat=True) self.pack(self.start) self.left = wal.ImgButton(self, rc.IMG_PAGER_PREV, cmd=self.prev_page, flat=True) self.pack(self.left) self.label = wal.DecorLabel(self) self.pack(self.label, False, False, 5) self.right = wal.ImgButton(self, rc.IMG_PAGER_NEXT, cmd=self.next_page, flat=True) self.pack(self.right) self.end = wal.ImgButton(self, rc.IMG_PAGER_END, cmd=self.last_page, flat=True) self.pack(self.end) self.pack(wal.VLine(self)) self.update_pager() events.connect(events.DOC_CHANGED, self.update_pager) events.connect(events.DOC_MODIFIED, self.update_pager)
def __init__(self): wal.MainWindow.__init__(self) self.set_size(SIZE) self.pack(wal.VLine(self), expand=True, fill=True)
def __init__(self, app, parent): self.app = app self.mw = parent self.docareas = [] wal.VPanel.__init__(self, parent) if not wal.is_mac(): self.pack(wal.HLine(self), fill=True) #----- Context panel self.ctxpanel = AppCtxPanel(self.app, self) self.pack(self.ctxpanel, fill=True, padding=1) #----- Doc tabs self.dtp = DocTabsPanel(self) self.doc_tabs = self.dtp.doc_tabs self.pack(self.dtp, fill=True) hpanel = wal.HPanel(self) self.pack(hpanel, expand=True, fill=True) #----- Tools self.tools = AppTools(self.app, hpanel) hpanel.pack(self.tools, fill=True) hpanel.pack(wal.VLine(hpanel), fill=True) self.splitter = wal.Splitter(hpanel) self.doc_keeper = wal.VPanel(self.splitter) self.doc_keeper.SetBackgroundColour(wal.WHITE) self.plg_area = PlgArea(self.app, self.splitter) self.app.mdiarea = self self.app.plg_area = self.plg_area self.splitter.split_vertically(self.doc_keeper, self.plg_area) self.splitter.set_min_size(200) self.splitter.set_sash_gravity(1.0) self.splitter.unsplit() hpanel.pack(self.splitter, expand=True, fill=True) #----- Vertical Palette panel self.vp_panel = wal.HPanel(hpanel) self.vp_panel.pack(wal.VLine(self.vp_panel), fill=True, start_padding=2) vpalette_panel = AppVPalette(self.vp_panel, self.app) self.vp_panel.pack(vpalette_panel, fill=True, padding=2) hpanel.pack(self.vp_panel, fill=True) if config.palette_orientation == uc2const.HORIZONTAL: self.vp_panel.hide() #----- Horizontal Palette panel self.hp_panel = wal.VPanel(self) self.hp_panel.pack(wal.HLine(self.hp_panel), fill=True, padding=2) hpalette_panel = AppHPalette(self.hp_panel, self.app) self.hp_panel.pack(hpalette_panel, fill=True) self.pack(self.hp_panel, fill=True) self.change_palette() #----- Status bar self.pack(wal.HLine(self), fill=True, start_padding=2) self.statusbar = AppStatusbar(self) self.pack(self.statusbar, fill=True, padding=2) self.layout() events.connect(events.CONFIG_MODIFIED, self.config_update)