Esempio n. 1
0
    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)
Esempio n. 2
0
    def __init__(self, parent, bgcolor=None):
        wal.ScrolledCanvas.__init__(self, parent)
        wal.Canvas.__init__(self)
        bgcolor = bgcolor or wal.WHITE
        self.set_bg(bgcolor)

        sb = wal.ScrollBar(self)
        self.sb_width = sb.get_size()[0]
        sb.destroy()
Esempio n. 3
0
	def __init__(self, parent, cms, border=False, onclick=None):
		self.cms = cms
		self.parent = parent
		self.callback = onclick
		wal.ScrolledPanel.__init__(self, parent, border)
		wal.SensitiveCanvas.__init__(self, True)
		sb = wal.ScrollBar(self)
		self.sb_width = sb.get_size()[0]
		sb.destroy()
		self.large_sel = get_icon(icons.PD_LARGE_SEL_PALETTE, size=wal.DEF_SIZE)
		self.small_sel = get_icon(icons.PD_SMALL_SEL_PALETTE, size=wal.DEF_SIZE)
		self.width = (self.cell_width - 1) * self.cell_in_line + 3 + self.sb_width
		self.set_size((self.width, -1))
		self.set_bg(wal.WHITE)
Esempio n. 4
0
    def __init__(self, app, parent):
        self.app = app
        self.mw = parent
        wal.VPanel.__init__(self, parent)

        self.ctxpanel = AppCtxPanel(self.app, self)
        self.doc_tabs = DocTabPanel(app, self,
                                    config.ui_style != appconst.GUI_CLASSIC)

        if config.ui_style == appconst.GUI_CLASSIC:
            if not wal.IS_MAC:
                self.pack(wal.HLine(self), fill=True)
            self.pack(self.ctxpanel, fill=True)
            self.pack(self.doc_tabs, fill=True)

        if config.ui_style == appconst.GUI_TABBED:
            self.pack(self.doc_tabs, fill=True)
            self.pack(self.ctxpanel, fill=True)
            self.pack(wal.PLine(self), fill=True)

        # ===== Main part
        hpanel = wal.HPanel(self)
        self.pack(hpanel, expand=True, fill=True)

        # ----- Tools
        self.tools = AppTools(self.app, hpanel)
        hpanel.pack(self.tools, fill=True, padding_all=2)
        hpanel.pack(wal.PLine(hpanel), fill=True)

        self.splitter = wal.Splitter(hpanel, hidden=True)

        # ----- Doc Area
        self.grid_panel = wal.GridPanel(self.splitter)
        self.grid_panel.add_growable_col(1)
        self.grid_panel.add_growable_row(1)
        self.corner = RulerSurface(self.app, self.grid_panel)
        self.grid_panel.add(self.corner)
        self.hruler = HRulerSurface(self.app, self.grid_panel)
        self.grid_panel.pack(self.hruler, fill=True)
        self.vruler = VRulerSurface(self.app, self.grid_panel)
        self.grid_panel.pack(self.vruler, fill=True)

        int_grid = wal.GridPanel(self.grid_panel)
        int_grid.add_growable_col(0)
        int_grid.add_growable_row(0)
        self.canvas = CanvasSurface(self.app, int_grid)
        int_grid.pack(self.canvas, fill=True)
        self.vscroll = wal.ScrollBar(int_grid)
        int_grid.pack(self.vscroll, fill=True)
        self.hscroll = wal.ScrollBar(int_grid, vertical=False)
        int_grid.pack(self.hscroll, fill=True)
        self.viewer = wal.VPanel(int_grid)
        int_grid.pack(self.viewer, fill=True)

        self.canvas.set_scrolls(self.hscroll, self.vscroll)
        self.grid_panel.pack(int_grid, fill=True)

        # ----- Doc Area End
        self.plg_area = PlgArea(self.app, self.splitter)
        self.app.mdiarea = self
        self.app.plg_area = self.plg_area

        self.splitter.split_vertically(self.grid_panel, 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.PLine(self.vp_panel), fill=True)
        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.PLine(self.hp_panel), fill=True)
        hpalette_panel = AppHPalette(self.hp_panel, self.app)
        self.hp_panel.pack(hpalette_panel, fill=True, padding=2)
        self.pack(self.hp_panel, fill=True)

        self.change_palette()

        # ----- Status bar
        self.pack(wal.PLine(self), fill=True)
        self.statusbar = AppStatusbar(self)
        self.pack(self.statusbar, fill=True)

        self.layout()
        events.connect(events.CONFIG_MODIFIED, self.config_update)