Пример #1
0
    def build_tab_license(self):
        panel = TFrame(self.root, style='FlatFrame', borderwidth=5)
        self.nb.add(panel, text=_('License'))

        subpanel = TFrame(panel, style='RoundedFrame', borderwidth=4)
        subpanel.grid(sticky=N + S + E + W)

        panel.rowconfigure(0, weight=1)
        panel.columnconfigure(0, weight=1)
        subpanel.rowconfigure(0, weight=1)
        subpanel.columnconfigure(0, weight=1)

        sb = TScrollbar(subpanel)
        sb.grid(row=0, column=1, sticky=N + S)

        text = Text(subpanel,
                    highlightthickness=0,
                    font=app.config.preferences.fixed_font,
                    wrap=NONE)
        text.grid(row=0, column=0, sticky=N + S + E + W)

        text['yscrollcommand'] = sb.set
        sb['command'] = text.yview

        text['state'] = NORMAL
        import aboutdlg_lic
        txt = aboutdlg_lic.LICENSE
        text.insert(END, txt)
        text['state'] = DISABLED
Пример #2
0
	def build_tab_license(self):
		panel = TFrame(self.root, style='FlatFrame', borderwidth=5)
		self.nb.add(panel, text=_('License'))

		subpanel = TFrame(panel, style='RoundedFrame', borderwidth=4)
		subpanel.grid(sticky=N + S + E + W)

		panel.rowconfigure(0, weight=1)
		panel.columnconfigure(0, weight=1)
		subpanel.rowconfigure(0, weight=1)
		subpanel.columnconfigure(0, weight=1)

		sb = TScrollbar(subpanel)
		sb.grid(row=0, column=1, sticky=N + S)

		text = Text(subpanel, highlightthickness=0,
				font=app.config.preferences.fixed_font, wrap=NONE)
		text.grid(row=0, column=0, sticky=N + S + E + W)

		text['yscrollcommand'] = sb.set
		sb['command'] = text.yview

		text['state'] = NORMAL
		import aboutdlg_lic
		txt = aboutdlg_lic.LICENSE
		text.insert(END, txt)
		text['state'] = DISABLED
Пример #3
0
	def build_tab_authors(self):
		panel = TFrame(self.root, style='FlatFrame', borderwidth=5)
		self.nb.add(panel, text=_('Authors'))

		subpanel = TFrame(panel, style='RoundedFrame', borderwidth=4)
		subpanel.grid(sticky=N + S + E + W)

		panel.rowconfigure(0, weight=1)
		panel.columnconfigure(0, weight=1)
		subpanel.rowconfigure(0, weight=1)
		subpanel.columnconfigure(0, weight=1)

		sb = TScrollbar(subpanel)
		sb.grid(row=0, column=1, sticky=N + S)

		text = Text(subpanel, bg='white', highlightthickness=0, wrap=NONE)
		text.grid(row=0, column=0, sticky=N + S + E + W)

		text['yscrollcommand'] = sb.set
		sb['command'] = text.yview

		txt = _('\nTo report bugs please use project bugtracker: https://bugs.launchpad.net/sk1/\n\n')
		txt += _('Igor Novikov\n   [email protected]\n   Project Leader\n\n')
		txt += _('Maxim Barabash\n   [email protected]\n   Designer\n\n')
		txt += _('Acknowledgments:\n=======================================\n')
		txt += _('Valek Fillipov\n   CDR format reverse engineering\n\n')
		txt += _('Alexandre Prokoudine\n   [email protected]\n   Information support (http://linuxgraphics.ru)')
		text['state'] = NORMAL
		text.insert(END, txt)
		text['state'] = DISABLED
Пример #4
0
	def build_tab_localization(self):
		panel = TFrame(self.root, style='FlatFrame', borderwidth=5)
		self.nb.add(panel, text=_('Localization'))

		subpanel = TFrame(panel, style='RoundedFrame', borderwidth=4)
		subpanel.grid(sticky=N + S + E + W)

		panel.rowconfigure(0, weight=1)
		panel.columnconfigure(0, weight=1)
		subpanel.rowconfigure(0, weight=1)
		subpanel.columnconfigure(0, weight=1)

		sb = TScrollbar(subpanel)
		sb.grid(row=0, column=1, sticky=N + S)

		text = Text(subpanel, bg='white', highlightthickness=0, wrap=NONE)
		text.grid(row=0, column=0, sticky=N + S + E + W)

		text['yscrollcommand'] = sb.set
		sb['command'] = text.yview

		text['state'] = NORMAL
		text.insert(END, TRANSLATORS)
		text['state'] = DISABLED
Пример #5
0
    def build_tab_localization(self):
        panel = TFrame(self.root, style='FlatFrame', borderwidth=5)
        self.nb.add(panel, text=_('Localization'))

        subpanel = TFrame(panel, style='RoundedFrame', borderwidth=4)
        subpanel.grid(sticky=N + S + E + W)

        panel.rowconfigure(0, weight=1)
        panel.columnconfigure(0, weight=1)
        subpanel.rowconfigure(0, weight=1)
        subpanel.columnconfigure(0, weight=1)

        sb = TScrollbar(subpanel)
        sb.grid(row=0, column=1, sticky=N + S)

        text = Text(subpanel, bg='white', highlightthickness=0, wrap=NONE)
        text.grid(row=0, column=0, sticky=N + S + E + W)

        text['yscrollcommand'] = sb.set
        sb['command'] = text.yview

        text['state'] = NORMAL
        text.insert(END, TRANSLATORS)
        text['state'] = DISABLED
Пример #6
0
    def build_tab_authors(self):
        panel = TFrame(self.root, style='FlatFrame', borderwidth=5)
        self.nb.add(panel, text=_('Authors'))

        subpanel = TFrame(panel, style='RoundedFrame', borderwidth=4)
        subpanel.grid(sticky=N + S + E + W)

        panel.rowconfigure(0, weight=1)
        panel.columnconfigure(0, weight=1)
        subpanel.rowconfigure(0, weight=1)
        subpanel.columnconfigure(0, weight=1)

        sb = TScrollbar(subpanel)
        sb.grid(row=0, column=1, sticky=N + S)

        text = Text(subpanel, bg='white', highlightthickness=0, wrap=NONE)
        text.grid(row=0, column=0, sticky=N + S + E + W)

        text['yscrollcommand'] = sb.set
        sb['command'] = text.yview

        txt = _(
            '\nTo report bugs please use project bugtracker: https://bugs.launchpad.net/sk1/\n\n'
        )
        txt += _(
            'Igor Novikov\n   [email protected]\n   Project Leader\n\n')
        txt += _(
            'Maxim Barabash\n   [email protected]\n   Designer\n\n')
        txt += _('Acknowledgments:\n=======================================\n')
        txt += _('Valek Fillipov\n   CDR format reverse engineering\n\n')
        txt += _(
            'Alexandre Prokoudine\n   [email protected]\n   Information support (http://linuxgraphics.ru)'
        )
        text['state'] = NORMAL
        text.insert(END, txt)
        text['state'] = DISABLED
Пример #7
0
	def build_window(self):
		root = self.application.root

		# the menu
		self.mbar = TFrame(root, name='menubar', style='MenuBarFrame', borderwidth=2)
		self.mbar.pack(fill=X)

		# the toolbar
		self.tbar = TFrame(root, name='toolbar', style='ToolBarFrame', borderwidth=2)
		self.tbar.pack(fill=X)

		# the context panel
		self.ctxpanel = ctxPanel.ContexPanel(root, self)
		self.ctxpanel.panel.pack(fill=X)

		b = ToolbarButton(self.ctxpanel.panel, self.commands.PCshowHide, image="show_side_panel")
		tooltips.AddDescription(b, self.commands.PCshowHide.menu_name)
		b.pack(side=RIGHT)

		# the status bar
		self.status_bar = TFrame(root, name='statusbar', style='FlatFrame')
		self.status_bar.pack(side=BOTTOM, fill=X)

		# the tools bar
		self.tframe = TFrame(root, name='tools_frame', style='FlatFrame', borderwidth=2)
		self.tframe.pack(side=LEFT, fill=Y)

		# the palette

		p_frame = TFrame(root, style='FlatFrame')
		p_frame.pack(side='right', fill=Y)

		palette_frame = TFrame(p_frame, style='FlatFrame')
		palette_frame.pack(side='right', fill=Y, pady=5, padx=3)

		b = TLabel(root, style='VLine2')
		b.pack(side=RIGHT, fill=Y)

		####################################
		# Drawing area creating
		####################################

		pc_frame = TFrame(root, style='FlatFrame')
		pc_frame.pack(side='right', fill=Y, expand=1)

		self.pc = PluginContainer(pc_frame, self.root, self)

		base_frame = TFrame(root, name='drawing_area_frame', style='FlatFrame')
		base_frame.pack(side=LEFT, fill=BOTH, expand=1)

		self.tabspanel = TabsPanel(base_frame, self)
		self.tabspanel.pack(side=TOP, fill=X)
		self.docmanager.Activate(self.tabspanel)

		label = TLabel(base_frame, style='DrawingAreaBottom', image='space_5')
		label.pack(side=BOTTOM, fill=X)

		label = TLabel(base_frame, style='DrawingAreaLeft', image='space_5')
		label.pack(side=LEFT, fill=Y, expand=1)

		label = TLabel(base_frame, style='DrawingAreaRight', image='space_5')
		label.pack(side=RIGHT, fill=Y, expand=1)

		####################################
		frame = TFrame(base_frame, name='canvas_frame', style='FlatFrame')
		frame.pack(side=LEFT, fill=BOTH, expand=1)

		vbar = TScrollbar(frame)
		vbar.grid(in_=frame, column=3, row=1, sticky='ns')
		vbar.bind('<Button-4>', self.ScrollUpCanvas)
		vbar.bind('<Button-5>', self.ScrollDownCanvas)

		############Pager###################
		pframe = TFrame(frame, style='FlatFrame')
		pframe.grid(in_=frame, column=2, row=2, sticky='ew')

		lab = Pager(pframe, self)
		lab.pack(side=LEFT, fill=Y)
		####################################
		hbar = TScrollbar(pframe, orient=HORIZONTAL)
		hbar.pack(side=RIGHT, fill=X, expand=1)
		hbar.bind('<Button-4>', self.ScrollLeftCanvas)
		hbar.bind('<Button-5>', self.ScrollRightCanvas)
		####################################

		hrule = tkruler.Ruler(frame, orient=tkruler.HORIZONTAL,
							  bg=config.preferences.ruler_color, relief='flat')

		hrule.grid(in_=frame, column=2, row=0, sticky='nsew', columnspan=2)
		hrule.bind('<Double-Button-1>', self.RulerDoublePressH)

		####################################

		vrule = tkruler.Ruler(frame, orient=tkruler.VERTICAL,
							  bg=config.preferences.ruler_color, relief='flat')

		vrule.grid(in_=frame, column=1, row=1, sticky='nsew', rowspan=2)
		vrule.bind('<Double-Button-1>', self.RulerDoublePressV)

		#ruler corner
		b = tkruler.RulerCorner(frame, bg=config.preferences.ruler_color)
		tooltips.AddDescription(b, _('Change system coordinates'))
		b.grid(column=1, row=0, sticky='news')

		resolution = config.preferences.screen_resolution
		self.canvas = SketchCanvas(root, toplevel=root, background='white', name='canvas',
				width=self.root.winfo_screenwidth(), height=self.root.winfo_screenheight(),
				resolution=resolution, main_window=self, document=self.document)

		self.canvas.grid(in_=frame, column=2, row=1, sticky='news')
		self.canvas.focus()
		self.canvas.SetScrollbars(hbar, vbar)
		self.canvas.SetRulers(hrule, vrule)

		vrule.SetCanvas(self.canvas)
		hrule.SetCanvas(self.canvas)

		frame.columnconfigure(0, weight=0)
		frame.columnconfigure(1, weight=0)
		frame.columnconfigure(2, weight=1)
		frame.columnconfigure(3, weight=0)
		frame.rowconfigure(0, weight=0)
		frame.rowconfigure(1, weight=1)
		frame.rowconfigure(2, weight=0)
		hbar['command'] = self.canvas._w + ' xview'
		vbar['command'] = self.canvas._w + ' yview'

		# the palette

		pal = palette.get_default_palette()

		palette_trough = TFrame(palette_frame, style='FlatFrame')
		palette_container = TFrame(palette_trough, style='FlatFrame')

		self.palette = palette.PaletteWidget(palette_container)
		self.palette.SetPalette(pal)
		ScrollXUnits = self.palette.ScrollXUnits
		ScrollXPages = self.palette.ScrollXPages
		CanScrollLeft = self.palette.CanScrollLeft
		CanScrollRight = self.palette.CanScrollRight

		but1 = UpdatedTButton(palette_frame, class_='Repeater', style='Pal2TopButton', image='pal_dbl_arrow_up',
					command=ScrollXPages, args=-1, sensitivecb=CanScrollLeft)
		but1.pack(side=TOP)
		but2 = UpdatedTButton(palette_frame, class_='Repeater', style='PalTopButton', image='pal_arrow_up',
					command=ScrollXUnits, args=-1, sensitivecb=CanScrollLeft)
		but2.pack(side=TOP)

		palette_trough.pack(side=TOP, fill=Y, expand=1)

		b = TLabel(palette_trough, style='PalLBorder')
		b.pack(side=LEFT, fill=Y)

		palette_container.pack(side=LEFT, fill=Y, expand=1)

		but = UpdatedTButton(palette_container, style='PalNoColorButton', image='pal_no_color',
					command=self.no_pattern, args='fill')
		but.pack(side=TOP)
		but.bind('<ButtonPress-3>', self.no_pattern, 'line')
		tooltips.AddDescription(but, _("No color"))

		self.palette.pack(side=LEFT, fill=Y, expand=1)

		b = TLabel(palette_trough, style='PalRBorder')
		b.pack(side='right', fill=Y)

		but3 = UpdatedTButton(palette_frame, class_='Repeater', style='PalBottomButton', image='pal_arrow_down',
					command=ScrollXUnits, args=+1, sensitivecb=CanScrollRight)
		but3.pack(side=TOP)
		but4 = UpdatedTButton(palette_frame, class_='Repeater', style='Pal2BottomButton', image='pal_dbl_arrow_down',
					command=ScrollXPages, args=+1, sensitivecb=CanScrollRight)
		but4.pack(side=TOP)

		self.palette.Subscribe(COLOR1, self.canvas.FillSolid)
		self.palette.Subscribe(COLOR2, self.canvas.LineColor)
		root.protocol('WM_DELETE_WINDOW', tkext.MakeMethodCommand(self.Exit))

		#Binding for mouse wheel
		self.palette.bind('<Button-4>', self.ScrollUpPallette)
		self.palette.bind('<Button-5>', self.ScrollDownPallette)
		self.canvas.bind('<Button-4>', self.ScrollUpCanvas)
		self.canvas.bind('<Button-5>', self.ScrollDownCanvas)
		self.canvas.bind('<Control-Button-4>', self.ScrollLeftCanvas)
		self.canvas.bind('<Control-Button-5>', self.ScrollRightCanvas)
		self.canvas.bind('<Shift-Button-4>', self.CanvasZoomingOut)
		self.canvas.bind('<Shift-Button-5>', self.CanvasZoomingIn)
Пример #8
0
class ScrolledCanvas:
    def __init__(self, master, **opts):
        if not opts.has_key('yscrollincrement'):
            opts['yscrollincrement'] = 20
        self.master = master
        self.frame = TFrame(master, style="FlatFrame")
        self.frame.rowconfigure(0, weight=1)
        self.frame.columnconfigure(0, weight=1)
        self.canvas = Canvas(self.frame, **opts)
        self.canvas.grid(row=0, column=0, sticky="nsew")
        self.vbar = TScrollbar(self.frame, name="vbar")
        self.vbar.grid(row=0, column=1, sticky="nse")
        self.hbar = TScrollbar(self.frame, name="hbar", orient="horizontal")
        self.hbar.grid(row=1, column=0, sticky="ews")
        self.canvas['yscrollcommand'] = lambda f, l: self.scroll_sh(
            self.vbar, f, l)
        self.vbar['command'] = self.canvas.yview
        self.canvas['xscrollcommand'] = lambda f, l: self.scroll_sh(
            self.hbar, f, l)
        self.hbar['command'] = self.canvas.xview
        self.canvas.bind("<Key-Prior>", self.page_up)
        self.canvas.bind("<Key-Next>", self.page_down)
        self.canvas.bind("<Key-Up>", self.unit_up)
        self.canvas.bind("<Key-Down>", self.unit_down)
        self.canvas.bind("<Alt-Key-2>", self.zoom_height)
        self.canvas.bind("<Button-4>", self.unit_up)
        self.canvas.bind("<Button-5>", self.unit_down)
        self.canvas.focus_set()

    def page_up(self, event):
        self.canvas.yview_scroll(-1, "page")
        return "break"

    def page_down(self, event):
        self.canvas.yview_scroll(1, "page")
        return "break"

    def unit_up(self, event):
        first, last = self.vbar.get()
        if first <= 0 and last >= 1:
            return "break"
        self.canvas.yview_scroll(-1, "unit")
        return "break"

    def unit_down(self, event):
        first, last = self.vbar.get()
        if first <= 0 and last >= 1:
            return "break"
        self.canvas.yview_scroll(1, "unit")
        return "break"

    def zoom_height(self, event):
        return "break"

    def scroll_sh(self, scroll, first, last):
        first, last = float(first), float(last)
        if first <= 0 and last >= 1:
            scroll.grid_remove()
        else:
            scroll.grid()
        scroll.set(first, last)
Пример #9
-1
class ScrolledCanvas:
	def __init__(self, master, **opts):
		if not opts.has_key('yscrollincrement'):
			opts['yscrollincrement'] = 20
		self.master = master		
		self.frame = TFrame(master, style="FlatFrame")
		self.frame.rowconfigure(0, weight=1)
		self.frame.columnconfigure(0, weight=1)
		self.canvas = Canvas(self.frame, **opts)
		self.canvas.grid(row=0, column=0, sticky="nsew")
		self.vbar = TScrollbar(self.frame, name="vbar")
		self.vbar.grid(row=0, column=1, sticky="nse")
		self.hbar = TScrollbar(self.frame, name="hbar", orient="horizontal")
		self.hbar.grid(row=1, column=0, sticky="ews")
		self.canvas['yscrollcommand'] = lambda f, l: self.scroll_sh(self.vbar, f, l)
		self.vbar['command'] = self.canvas.yview
		self.canvas['xscrollcommand'] = lambda f, l: self.scroll_sh(self.hbar, f, l)
		self.hbar['command'] = self.canvas.xview
		self.canvas.bind("<Key-Prior>", self.page_up)
		self.canvas.bind("<Key-Next>", self.page_down)
		self.canvas.bind("<Key-Up>", self.unit_up)
		self.canvas.bind("<Key-Down>", self.unit_down)
		self.canvas.bind("<Alt-Key-2>", self.zoom_height)
		self.canvas.bind("<Button-4>", self.unit_up)
		self.canvas.bind("<Button-5>", self.unit_down)
		self.canvas.focus_set()
	def page_up(self, event):
		self.canvas.yview_scroll(-1, "page")
		return "break"
	def page_down(self, event):
		self.canvas.yview_scroll(1, "page")
		return "break"
	def unit_up(self, event):
		first,last=self.vbar.get()
		if first <= 0 and last >= 1:
			return "break"
		self.canvas.yview_scroll(-1, "unit")
		return "break"
	def unit_down(self, event):
		first,last=self.vbar.get()
		if first <= 0 and last >= 1:
			return "break"
		self.canvas.yview_scroll(1, "unit")
		return "break"
	def zoom_height(self, event):
		return "break"
	def scroll_sh(self, scroll, first, last):
	    first, last = float(first), float(last)
	    if first <= 0 and last >= 1:
	        scroll.grid_remove()
	    else:
	        scroll.grid()
	    scroll.set(first, last)