def init(self, master): self.master = master self.mw = app.mw self.pcontainer = self.master.master self.document = self.mw.document TFrame.__init__(self, self.master, style='FlatFrame', borderwidth=0) self.top = TFrame(self, style='PWinHead', borderwidth=3) self.panel = TFrame(self, style='PWinBody', borderwidth=3) self.activated = 1 self.visible = 1 self.packed = 1 for item in self.pcontainer.loaded: if not item.collapsed: item.collapse_panel() self.pack(side=TOP, fill=self.fill, expand=self.expand, padx=1, pady=1) self.top.pack(side=TOP, fill=X) self.panel.pack(side=TOP, fill=BOTH, expand=1) self.iconlabel = TLabel(self.top, style='PWLabel', image=self.icon) self.textlabel = TLabel(self.top, style='PWLabel', text=self.title, anchor=W) if not 'bold' in self.textlabel['font'].split(): self.textlabel['font'] += ' bold' self.closebut = TButton(self.top, style='PWButton', image='close_pw', command=self.close_panel) self.collapsebut = TButton(self.top, style='PWButton', image='minimize_pw', command=self.click) self.iconlabel.pack(side=LEFT, padx=2) self.textlabel.pack(side=LEFT, fill=BOTH, expand=1, padx=3) self.closebut.pack(side=RIGHT) self.collapsebut.pack(side=RIGHT) self.textlabel.bind("<Button-1>", self.click) self.mw.Subscribe(DOCUMENT, self.doc_changed)
def build_dlg(self): root = TFrame(self.top, style='FlatFrame', borderwidth = 10) root.pack(side = TOP, fill = BOTH, expand = 1) middle = TFrame(root, style='FlatFrame', borderwidth = 5) middle.pack(side = TOP, fill = X, expand = 1) label = TLabel(middle, text = _("Delete page No.:")+" ", style='FlatLabel') label.pack(side = LEFT) self.pagenum_spin = TSpinbox(middle, var=app.mw.document.active_page+1, vartype=0, textvariable = self.pagenum, min = 1, max = len(app.mw.document.pages), step = 1, width = 6, command = self.ok) self.pagenum_spin.pack(side = LEFT) if len(app.mw.document.pages)==1: self.pagenum_spin.set_state('disabled') bottom = TFrame(root, style='FlatFrame', borderwidth = 5) bottom.pack(side = BOTTOM, fill = X, expand = 1) cancel = TButton(bottom, text=_("Cancel"), command=self.cancel) cancel.pack(side = RIGHT) label = TLabel(bottom, text = ' ', style='FlatLabel') label.pack(side = RIGHT) ok = TButton(bottom, text=_("OK"), command=self.ok) ok.pack(side = RIGHT) self.focus_widget = ok self.top.bind('<Escape>', self.cancel) self.top.protocol('WM_DELETE_WINDOW', self.cancel) self.top.resizable (width=0, height=0)
def __init__(self, master=None, min=0, max=100, step=1, textvariable=None, var=0, vartype=0, command=None, state=NORMAL, width=5, args=(), **kw): '''vartype=0 - integer vartype=1 - float ''' self.min_value = min self.max_value = max self.step = step self.variable = var self.vartype = vartype if textvariable: self.text_var = textvariable else: self.text_var = StringVar() self.command = command self.state = state self.width = width apply(TFrame.__init__, (self, master), kw) self["style"] = "FlatFrame" self.entry = TEntryExt(self, textvariable=self.text_var, width=self.width, style='SpinEntry') self.entry.pack(side=LEFT, expand=1, fill=BOTH) self.button_frame = TFrame(self, style="FlatFrame") self.button_frame.pack(side=LEFT, fill=Y) self.up_button = TButton(self.button_frame, class_='Repeater', command=self.increase, image='pal_arrow_up', style='SpinUpButton', takefocus=0) self.up_button.pack(side=TOP) self.down_button = TButton(self.button_frame, class_='Repeater', command=self.decrease, image='pal_arrow_down', style='SpinDownButton', takefocus=0) self.down_button.pack(side=TOP) if self.vartype == 1: self.variable = float(self.variable) else: self.variable = int(self.variable) self.text_var.set(str(self.variable)) self.entry.bind('<Button-4>', self.wheel_increase) self.entry.bind('<Button-5>', self.wheel_decrease) self.entry.bind('<Key-Up>', self.wheel_increase) self.entry.bind('<Key-Down>', self.wheel_decrease) self.entry.bind('<Key-Return>', self.apply_command) self.entry.bind('<Key-KP_Enter>', self.apply_command)
def init(self, master): PluginPanel.init(self, master) self.initial_color = self.default_color self.current_color = copy.copy(self.initial_color) top = TFrame(self.panel, style='FlatFrame', borderwidth=5) top.pack(side=TOP, fill=BOTH) self.selector = ColorSpaceSelector(top, self.refresh_widgets, self.current_color, self.sign) self.selector.pack(side=TOP, expand=1, fill=X) self.picker = ColorChooserWidget(top, self.refresh_widgets, self.current_color) self.picker.pack(side=TOP, expand=1, fill=X) self.digitizer = ColorDigitizer(top, self.refresh_widgets, self.current_color) self.digitizer.pack(side=TOP, expand=1, fill=X) button = UpdatedButton(top, text=_("Apply"), command=self.apply_pattern, sensitivecb=self.is_selection) button.pack(side=BOTTOM, expand=1, fill=X) self.Subscribe(SELECTION, button.Update) button_frame = TFrame(top, style='FlatFrame', borderwidth=1) button_frame.pack(side=BOTTOM, fill=X, pady=5) button = TButton(button_frame, style='TSmallbutton', text=' ', image='small_colorpicker', command=self.copy_from) button.pack(side=LEFT) tooltips.AddDescription(button, _("Copy From...")) button = TButton(button_frame, style='TSmallbutton', text=' ', image='restore_color', command=self.restore_color) button.pack(side=LEFT, padx=5) tooltips.AddDescription(button, _("Restore color")) self.var_autoupdate = IntVar(top) self.var_autoupdate.set(1) self.autoupdate_check = TCheckbutton(button_frame, text=_("Auto Update"), variable=self.var_autoupdate, command=self.init_from_doc) self.autoupdate_check.pack(side=RIGHT, anchor=W, padx=10) self.init_from_doc() self.subscribe_receivers()
def __init__(self, parent): CtxSubPanel.__init__(self, parent) b = TButton(self.panel, command=self.flip, style='Toolbutton', image='context_hflip') tooltips.AddDescription(b, _('Flip Horizontal')) b.pack(side = LEFT) b = TButton(self.panel, command=self.flop, style='Toolbutton', image='context_vflip') tooltips.AddDescription(b, _('Flip Vertical')) b.pack(side = LEFT)
def __init__(self, master, dialog, **kw): self.dialog = dialog apply(TFrame.__init__, (self, master), kw) cancel_bt = TButton(self, text=_("Cancel"), command=self.dialog.cancel) cancel_bt.pack(side=RIGHT) ok_bt = TButton(self, text=_("OK"), command=self.dialog.ok) ok_bt.pack(side=RIGHT, padx=5)
def __init__(self, parent): CtxSubPanel.__init__(self, parent) b = TButton(self.panel, command=self.makePageFrame, style='Toolbutton', image='context_add_page_frame') tooltips.AddDescription(b, _('Add page frame')) b.pack(side=LEFT) b = TButton(self.panel, command=self.addCenteredGuides, style='Toolbutton', image='context_add_centered_guides') tooltips.AddDescription(b, _('Add guides for page center')) b.pack(side=LEFT) ############# b = TLabel(self.panel, image="toolbar_sep") b.pack(side=LEFT) b = TButton(self.panel, command=self.addGuidesFrame, style='Toolbutton', image='context_add_guides_frame') tooltips.AddDescription(b, _('Add guides across page border')) b.pack(side=LEFT) self.var_jump_number = DoubleVar(self.mw.root) unit = config.preferences.default_unit var_jump_unit = StringVar(self.mw.root) self.var_jump = LengthVar(10, unit, self.var_jump_number, var_jump_unit) self.entry_jump = TSpinbox(self.panel, var=0, vartype=1, textvariable=self.var_jump_number, min=-1000, max=1000, step=5, width=6, command=self.addGuidesFrame) self.entry_jump.pack(side=LEFT, padx=2) config.preferences.Subscribe(CHANGED, self.update) self.var_jump.set(0) self.update(0, 0) b = TLabel(self.panel, image="toolbar_sep") b.pack(side=LEFT) ############## b = TButton(self.panel, command=self.removeAllGuides, style='Toolbutton', image='context_remove_all_guides') tooltips.AddDescription(b, _('Remove all guides')) b.pack(side=LEFT)
def __init__(self, master, dialog, **kw): apply(TFrame.__init__, (self, master), kw) self.prev_btn = TButton(self, image='fd-go-previous', style="Toolbutton") self.prev_btn.pack(side=LEFT) self.up_btn = TButton(self, image='fd-go-up', style="Toolbutton") self.up_btn.pack(side=LEFT) self.next_btn = TButton(self, image='fd-go-next', style="Toolbutton") self.next_btn.pack(side=LEFT)
def build_dlg(self): root = self.top top = TFrame(root, borderwidth=5, style='FlatFrame') top.pack(side=TOP, expand=0, fill=BOTH) top2 = TFrame(top, style='FlatFrame') top2.pack(side=TOP, expand=0, fill=X) format_label = TLabel(top2, text=_('Style name:'), borderwidth=0) format_label.pack(side=LEFT, pady=3) self.entry_name = TEntrybox(top, command=self.ok, width=15) self.entry_name.pack(side=TOP, fill=X) top2 = TFrame(top, height=5, style='FlatFrame') top2.pack(side=TOP, expand=0, fill=X) prop_cont = TLabelframe(top, text=_('Style properties'), padding=10) prop_cont.pack(side=TOP, fill=X) properties = self.object.Properties() self.flags = {} for prop in property_names: type = property_types[prop] if type == FillProperty: state = self.object.has_fill and NORMAL or DISABLED elif type == LineProperty: state = self.object.has_line and NORMAL or DISABLED elif type == FontProperty: state = self.object.has_font and NORMAL or DISABLED else: # unknown property type! continue long, short = property_titles[prop] self.flags[prop] = var = IntVar(root) var.set(state == NORMAL) radio = TCheckbutton(prop_cont, text=long, state=state, variable=var) radio.pack(side=TOP, anchor=W) top2 = TFrame(top, height=3, style='FlatFrame') top2.pack(side=TOP, expand=0, fill=X) but_frame = Frame(top) but_frame.pack(side=TOP, fill=X) button = TButton(but_frame, text=_("Cancel"), command=self.cancel) button.pack(side=RIGHT, padx=5) button = TButton(but_frame, text=_("OK"), command=self.ok) button.pack(side=RIGHT, padx=5) root.resizable (width=0, height=0) self.entry_name.set_focus()
def __init__(self, parent, toplevel, size=300, orient=LEFT, min=200, max=500, cnf={}, **kw): TFrame.__init__(self, parent, style='FlatFrame', **kw) self.parent = parent self.panel = TFrame(self, style='FlatFrame') self.orient = orient self.min = min self.max = max self.size = size self.toplevel = toplevel self.canv_size = 0 self.counter = 0 if orient in [LEFT, RIGHT]: self.spacer = Frame(self, width=size, height=1) self.grip = TButton(self, style='VGrip', cursor=appconst.CurHResize) if orient == LEFT: self.spacer.pack(side=TOP) self.grip.pack(side=LEFT, fill=Y) self.panel.pack(side=RIGHT, fill=BOTH, expand=1) else: self.spacer.pack(side=TOP) self.grip.pack(side=RIGHT, fill=Y) self.panel.pack(side=LEFT, fill=BOTH, expand=1) else: self.spacer = Frame(self, width=1, height=size) self.grip = TButton(self, style='HGrip', cursor=appconst.CurVResize) if orient == BOTTOM: self.grip.pack(side=BOTTOM, fill=X) self.spacer.pack(side=RIGHT) self.panel.pack(side=LEFT, fill=BOTH, expand=1) else: self.grip.pack(side=TOP, fill=X) self.spacer.pack(side=RIGHT) self.panel.pack(side=LEFT, fill=BOTH, expand=1) self.grip.bind("<Button-1>", self.start) self.grip.bind("<ButtonRelease-1>", self.stop)
def __init__(self, parent, mainwindow): self.parent = parent self.mainwindow = mainwindow TFrame.__init__(self, self.parent, name='pagerPanel', style='FlatFrame', borderwidth=0) top_border = TLabel(self, style='FlatLabel', image='space_1') top_border.pack(side=TOP, fill=X) self.container = TFrame(self, style='FlatFrame', borderwidth=0) space = TLabel(self.container, style='FlatLabel', image='space_3') space.pack(side=LEFT, fill=Y) self.home_but = TButton(self.container, style='PagerHome', command=self.PageHome) self.home_but.pack(side=LEFT) self.home_but = TButton(self.container, style='PagerPrevious', command=self.PagePrevious) self.home_but.pack(side=LEFT) self.text = TLabel(self.container, style='FlatLabel', text=' ' + _('Page 2 of 2') + ' ') self.text.pack(side=LEFT) self.home_but = TButton(self.container, style='PagerNext', command=self.PageNext) self.home_but.pack(side=LEFT) self.home_but = TButton(self.container, style='PagerEnd', command=self.PageEnd) self.home_but.pack(side=LEFT) space = TLabel(self.container, style='FlatLabel', image='space_3') space.pack(side=LEFT, fill=Y) self.mainwindow.Subscribe(DOCUMENT, self.Resubscribe) self.Resubscribe() self.doc_paged() self.text.bind('<Double-Button-1>', self.GoToPage)
def build_dlg(self): root = self.top top = TFrame(root, style='FlatFrame', borderwidth=13) top.pack(side=TOP) label = TLabel(top, text=_("Please select the object categories whose\n default properties you want to change")) label.pack(side=TOP, anchor=W) frame = TFrame(top, style='FlatFrame', borderwidth=10) frame.pack(side=TOP) self.var_graphics_style = IntVar(top) self.var_graphics_style.set(0) if self.category != 'font': self.var_graphics_style.set(1) button = TCheckbutton(frame, text=_("Graphics Objects"), state=(self.category == 'font' and DISABLED or NORMAL), variable=self.var_graphics_style) button.pack(side=TOP, anchor=W) self.var_text_style = IntVar(top) self.var_text_style.set(0) if self.category == 'font': self.var_text_style.set(1) button = TCheckbutton(frame, text=_("Text Objects"), state=(self.category == 'line' and DISABLED or NORMAL), variable=self.var_text_style) button.pack(side=TOP, anchor=W) label = TLabel(top, style="HLine") label.pack(side=TOP, fill=BOTH) but_frame = TFrame(top, style='FlatFrame') but_frame.pack(side=TOP, fill=BOTH, expand=1) button = TButton(but_frame, text=_("Cancel"), command=self.cancel) button.pack(side=RIGHT, expand=1) button = TButton(but_frame, text=_("OK"), command=self.ok) button.pack(side=RIGHT, expand=1) root.resizable (width=0, height=0)
def __init__(self, parent): CtxSubPanel.__init__(self, parent) self.angle = DoubleVar(self.mw.root) self.angle.set(0) label = TLabel(self.panel, image='context_R') label.pack(side=LEFT) self.entry_width = TSpinbox(self.panel, var=0, vartype=1, textvariable=self.angle, min=-360, max=360, step=1, width=6, command=self.applyRotate) tooltips.AddDescription(self.entry_width, _('Rotation angle')) self.entry_width.pack(side=LEFT, padx=5) b = TButton(self.panel, command=self.rotLeft, style='Toolbutton', image='context_rotate_ccw') tooltips.AddDescription(b, _(u'Rotate -90°')) b.pack(side=LEFT) b = TButton(self.panel, command=self.rot180, style='Toolbutton', image='context_rotate') tooltips.AddDescription(b, _(u'Rotate 180°')) b.pack(side=LEFT) b = TButton(self.panel, command=self.rotRight, style='Toolbutton', image='context_rotate_cw') tooltips.AddDescription(b, _(u'Rotate 90°')) b.pack(side=LEFT)
def build_dlg(self): self.root = TFrame(self.top, style='FlatFrame', borderwidth=5) self.root.pack(side=TOP, fill=BOTH, expand=1) panel = TFrame(self.root, style='FlatFrame', borderwidth=5) panel.pack(side=TOP, fill=X) icon = TLabel(panel, style='FlatLabel', image='icon_sk1_48') icon.pack(side=LEFT, padx=5, pady=5) panel = TFrame(panel, style='FlatFrame', borderwidth=5) panel.pack(side=LEFT) text = TLabel(panel, style='FlatLabel', text='sK1 v.%s' % app.sKVersion, font=app.config.preferences.large_font + ' bold') text.pack(side=TOP, anchor=W) text = TLabel( panel, style='FlatLabel', text=_('Uses libraries: Tcl/Tk %s; Python %s; LCMS %s') % (TclVersion, string.split(sys.version)[0], cms.get_version())) text.pack(side=TOP, anchor=W) self.nb = TNotebook(self.root, height=150, width=500, padding=5) self.nb.pack(side=TOP, fill=BOTH, expand=1) self.build_tab_about() self.build_tab_authors() self.build_tab_localization() self.build_tab_license() ok = TButton(self.root, text=_("Close"), command=self.ok) ok.pack(side=RIGHT, padx=5, pady=5) self.focus_widget = ok self.top.bind('<Escape>', self.cancel) self.top.protocol('WM_DELETE_WINDOW', self.cancel) self.top.resizable(width=0, height=0)
def build_dlg(self): if not self.builded: cmds = self.mw.canvas.commands.Ellipse label = TLabel(self.panel, text=_("Start:")) label.pack(side=LEFT, padx=2) self.entry_start = TSpinbox(self.panel, var=0, vartype=1, textvariable=self.start, min=-360, max=360, step=5, width=6, command=self.applyAngle) self.entry_start.pack(side=LEFT, padx=2) tooltips.AddDescription(self.entry_start, _('Arc start point angle')) #-------------- sep = FlatFrame(self.panel, width=5, height=2) sep.pack(side=LEFT) #-------------- label = TLabel(self.panel, text=_("End:")) label.pack(side=LEFT, padx=2) self.entry_end = TSpinbox(self.panel, var=0, vartype=1, textvariable=self.end, min=-360, max=360, step=5, width=6, command=self.applyAngle) self.entry_end.pack(side=LEFT, padx=2) tooltips.AddDescription(self.entry_end, _('Arc end point angle')) b = TButton(self.panel, command=self.ResetAngle, style='Toolbutton', image='context_arc_reset') tooltips.AddDescription(b, _('Reset angles')) b.pack(side=LEFT) b = TButton(self.panel, command=self.SwapAngle, style='Toolbutton', image='context_arc_swap') tooltips.AddDescription(b, _('Swap angles')) b.pack(side=LEFT) b = TLabel(self.panel, image="toolbar_sep") b.pack(side=LEFT) b = TButton(self.panel, command=cmds.EllipseArc.Invoke, style='Toolbutton', image='context_arc') tooltips.AddDescription(b, _('to Arc')) b.pack(side=LEFT) b = TButton(self.panel, command=cmds.EllipseChord.Invoke, style='Toolbutton', image='context_chord') tooltips.AddDescription(b, _('to Chord')) b.pack(side=LEFT) b = TButton(self.panel, command=cmds.EllipsePieSlice.Invoke, style='Toolbutton', image='context_pie') tooltips.AddDescription(b, _('to Pie')) b.pack(side=LEFT) self.builded = 1 else: obj = self.mw.document.CurrentObject() if obj and obj.is_Ellipse: start_angle = round(obj.start_angle / degrees, 2) end_angle = round(obj.end_angle / degrees, 2) self.entry_start.set_value(start_angle) self.entry_end.set_value(end_angle)
def init(self, master): PluginPanel.init(self, master) root = self.mw.root top = TFrame(self.panel, style='FlatFrame', borderwidth=5) top.pack(side=TOP, fill=BOTH) ########### APPLY BUTTON ################################################ button = UpdatedButton(top, text=_("Apply"), command=self.apply_properties, sensitivecb=self.is_correct_selection) button.pack(side=BOTTOM, expand=1, fill=X) self.Subscribe(SELECTION, button.Update) ########### COLOR BUTTON ################################################ color_frame = TFrame(top, style='FlatFrame', borderwidth=3) color_frame.pack(side=TOP) label = TLabel(color_frame, style='FlatLabel', text=_('Color:')) label.pack(side=LEFT, padx=5) self.color_button = TColorButton(color_frame, command=self.show_outline_color) self.color_button.pack(side=LEFT, padx=5) self.color_button.set_color((255, 0, 0)) ########### LINE WIDTH ################################################## self.var_width_number = DoubleVar(root) self.var_width_base = DoubleVar(root) var_width_unit = StringVar(root) unit = config.preferences.default_unit self.var_width = LengthVar(10, unit, self.var_width_number, var_width_unit) line_width_frame = TFrame(top, style='FlatFrame', borderwidth=3) line_width_frame.pack(side=TOP, fill=BOTH) self.labelwunit = TLabel(line_width_frame, style='FlatLabel', text=self.var_width.unit) self.labelwunit.pack(side=RIGHT, padx=5) self.entry_width = TSpinbox(line_width_frame, var=0, vartype=1, textvariable=self.var_width_number, min=0, max=50000, step=.1, width=8, command=self.update_pattern) self.entry_width.pack(side=RIGHT) label = TLabel(line_width_frame, style='FlatLabel', text=_('Line width:')) label.pack(side=RIGHT, padx=5) ########### LINE STYLE ################################################# style_frame = TFrame(top, style='FlatFrame', borderwidth=5) style_frame.pack(side=TOP, fill=X) for item in range(1, 12): self.dashlist.append("dash%d" % (item)) self.style_button = TOptionMenu(style_frame, self.dashlist, command=self.set_dash, entry_type='image', style='TComboSmall') self.style_button.pack(side=RIGHT, fill=X) label = TLabel(style_frame, style='FlatLabel', text=_('Style:')) label.pack(side=RIGHT, padx=5) ######################################################################## selection_frame = TFrame(top, style='FlatFrame', borderwidth=1) selection_frame.pack(side=TOP) ########### CORNERS ##################################################### label = TLabel(selection_frame, text=" " + _("Corners:") + " ", style="FlatLabel") label.pack() corners_frame = TLabelframe(selection_frame, labelwidget=label, style='Labelframe', borderwidth=8) corners_frame.pack(side=LEFT, fill=Y, pady=1, padx=1) self.var_corner = IntVar(root) radio = UpdatedRadiobutton(corners_frame, image="join_miter", variable=self.var_corner, value=const.JoinMiter, command=self.update_pattern) radio.pack(side=TOP, anchor=W, pady=2) radio = UpdatedRadiobutton(corners_frame, image="join_round", variable=self.var_corner, value=const.JoinRound, command=self.update_pattern) radio.pack(side=TOP, anchor=W, pady=2) radio = UpdatedRadiobutton(corners_frame, image="join_bevel", variable=self.var_corner, value=const.JoinBevel, command=self.update_pattern) radio.pack(side=TOP, anchor=W, pady=2) ########### LINE CAPS ################################################### label = TLabel(selection_frame, text=" " + _("Line caps:") + " ", style="FlatLabel") label.pack() caps_frame = TLabelframe(selection_frame, labelwidget=label, style='Labelframe', borderwidth=8) caps_frame.pack(side=RIGHT, fill=Y, pady=1, padx=1) self.var_caps = IntVar(root) radio = UpdatedRadiobutton(caps_frame, image="cap_butt", variable=self.var_caps, value=const.CapButt, command=self.update_pattern) radio.pack(side=TOP, anchor=W, pady=2) radio = UpdatedRadiobutton(caps_frame, image="cap_round", variable=self.var_caps, value=const.CapRound, command=self.update_pattern) radio.pack(side=TOP, anchor=W, pady=2) radio = UpdatedRadiobutton(caps_frame, image="cap_projecting", variable=self.var_caps, value=const.CapProjecting, command=self.update_pattern) radio.pack(side=TOP, anchor=W, pady=2) self.var_caps.set(0) ############ BOTTOM BUTTONS ############################################# button_frame = TFrame(top, style='FlatFrame', borderwidth=1) button_frame.pack(side=BOTTOM, fill=X, pady=5) button = TButton(button_frame, style='TSmallbutton', text=' ', image='small_colorpicker', command=self.copy_from) button.pack(side=LEFT) tooltips.AddDescription(button, _("Copy From...")) button = TButton(button_frame, style='TSmallbutton', text=' ', image='restore_color', command=self.restore_properties) button.pack(side=LEFT, padx=5) tooltips.AddDescription(button, _("Restore properties")) self.var_autoupdate = IntVar(top) self.var_autoupdate.set(1) self.autoupdate_check = TCheckbutton(button_frame, text=_("Auto Update"), variable=self.var_autoupdate, command=self.init_from_doc) self.autoupdate_check.pack(side=RIGHT, anchor=W, padx=10) ####################################################################### self.set_default_style() self.init_from_doc() self.subscribe_receivers()
def init(self, master): PluginPanel.init(self, master) root = self.mw.root self.var_reference = StringVar(root) self.var_reference.set(SELECT) #--------------------------------------------------------- top = TFrame(self.panel, style='FlatFrame') top.pack(side=TOP, fill=BOTH) #--------------------------------------------------------- label = TLabel(top, text=" " + _("Relative to") + " ", style="FlatLabel") label.pack(side=TOP, fill=BOTH, padx=5) rel_frame = TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=3) rel_frame.pack(side=TOP, fill=X, padx=5, pady=2) self.reference = TCombobox(rel_frame, state='readonly', values=self.make_cs_list(), style='ComboNormal', width=14, textvariable=self.var_reference, postcommand=self.set_cs) self.reference.pack(side=TOP) #--------------------------------------------------------- label = TLabel(top, text=" " + _("Alignment type") + " ", style="FlatLabel") label.pack(side=TOP, fill=BOTH, padx=5) framec = TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=3) framec.pack(side=TOP, fill=X, padx=5, pady=2) framex = TFrame(framec, style='FlatFrame') framex.pack(side=TOP, expand=0, padx=5, pady=5) framey = TFrame(framec, style='FlatFrame') framey.pack(side=TOP, expand=0, padx=5, pady=5) x_pixmaps = ['aoleft', 'aocenterh', 'aoright'] y_pixmaps = ['aotop', 'aocenterv', 'aobottom'] x_tooltips = [ _('Align left sides'), _('Center on vertical axis'), _('Align right sides') ] y_tooltips = [ _('Align tops'), _('Center on horizontal axis'), _('Align bottoms') ] self.var_x = IntVar(top) self.var_x.set(0) self.value_x = 0 self.var_y = IntVar(top) self.var_y.set(0) self.value_y = 0 for i in range(1, 4): button = make_button(framex, image=x_pixmaps[i - 1], value=i, variable=self.var_x, command=self.apply_x) tooltips.AddDescription(button, x_tooltips[i - 1]) button.pack(side=LEFT, padx=3) button = make_button(framey, image=y_pixmaps[i - 1], value=i, variable=self.var_y, command=self.apply_y) tooltips.AddDescription(button, y_tooltips[i - 1]) button.pack(side=LEFT, padx=3) #--------------------------------------------------------- # Auto Apply Check self.var_auto_apply = IntVar(top) self.var_auto_apply.set(0) self.auto_apply_check = TCheckbutton(top, text=_("Auto Apply"), variable=self.var_auto_apply, command=self.reset) self.auto_apply_check.pack(side=TOP, anchor=W, padx=5, pady=5) #--------------------------------------------------------- # Button frame self.button_frame = TFrame(top, style='FlatFrame', borderwidth=5) self.button_frame.pack(side=BOTTOM, fill=BOTH) self.update_buttons = [] self.button_apply = TButton(self.button_frame, text=_("Apply"), command=self.apply) self.apply_button_show(1) self.init_from_doc() self.subscribe_receivers()
def build_dlg(self): self.root = TFrame(self.top, style='FlatFrame', borderwidth=10) self.root.pack(side=TOP, fill=BOTH, expand=1) ##### top panel #########################RoundedFrame toppanel = TFrame(self.root, style='FlatFrame') toppanel.pack(side=TOP, fill=BOTH, expand=1) rpanel = ResizableTFrame(toppanel, self.top, size=220, orient=RIGHT) rpanel.pack(side=LEFT, fill=Y) panel = TFrame(rpanel.panel, style='RoundedFrame', borderwidth=5) panel.pack(side=LEFT, fill=BOTH, expand=1) ctheme = app.uimanager.currentColorTheme self.scanvas = ScrolledCanvas(panel, bg=ctheme.editfieldbackground, height=420, width=200) self.scanvas.frame.pack(side=LEFT, fill=BOTH, expand=1) self.plugpanel = TFrame(toppanel, style='FlatFrame') self.plugpanel.pack(side=RIGHT, fill=BOTH, expand=1) # lab=TLabel(self.plugpanel, style='FlatLabel', text='Test label') # lab.pack(side = LEFT) ##### line ######################### line = TLabel(self.root, style='HLine2') line.pack(side=TOP, fill=X) ##### bottom panel ######################### botpanel = TFrame(self.root, style='FlatFrame') botpanel.pack(side=BOTTOM, fill=X, expand=0) cancel_bt = TButton(botpanel, text=_("Cancel"), command=self.cancel) cancel_bt.pack(side=RIGHT) apply_bt = TButton(botpanel, text=_("Apply"), command=self.do_apply) apply_bt.pack(side=RIGHT, padx=10) ok_bt = TButton(botpanel, text=_("OK"), command=self.ok) ok_bt.pack(side=RIGHT) help_bt = TButton(botpanel, text=_("Help"), state='disabled') help_bt.pack(side=LEFT) rdefs_bt = TButton(botpanel, text=_("Restore Defaults"), command=self.do_restore) rdefs_bt.pack(side=LEFT, padx=10) self.focus_widget = cancel_bt self.top.bind('<Escape>', self.cancel) self.top.protocol('WM_DELETE_WINDOW', self.cancel) self.width = 700 self.height = 500 self.build_plugins_tree() item = PluginsTreeItem(self.root_cat, self) node = TreeNode(self.scanvas.canvas, None, item, ctheme, 26) node.expand() self.loadByName('general')
def build_dlg(self): root = TFrame(self.top, style='FlatFrame', borderwidth=10) root.pack(side=TOP, fill=BOTH, expand=1) top = TFrame(root, style='FlatFrame', borderwidth=5) top.pack(side=TOP, fill=X, expand=1) label = TLabel(top, text=_("Insert:") + " ", style='FlatLabel') label.pack(side=LEFT) self.numpages_spin = TSpinbox(top, var=1, vartype=0, textvariable=self.numpages, min=1, max=1000, step=1, width=6, command=self.ok) self.numpages_spin.pack(side=LEFT) label = TLabel(top, text=" " + _("page(s)"), style='FlatLabel') label.pack(side=LEFT) middle = TFrame(root, style='FlatFrame', borderwidth=5) middle.pack(side=TOP, fill=X, expand=1) rbframe = TFrame(middle, style='FlatFrame', borderwidth=5) rbframe.pack(side=LEFT) self.var_reference = StringVar(self.master) if self.is_before: self.var_reference.set('before') else: self.var_reference.set('after') radio = UpdatedRadiobutton(rbframe, value='before', text=_("Before") + " ", variable=self.var_reference) radio.pack(side=TOP, anchor=W) radio = UpdatedRadiobutton(rbframe, value='after', text=_("After") + " ", variable=self.var_reference) radio.pack(side=TOP, anchor=W) label = TLabel(middle, text=" " + _("page No.:") + " ", style='FlatLabel') label.pack(side=LEFT) self.pagenum_spin = TSpinbox(middle, var=app.mw.document.active_page + 1, vartype=0, textvariable=self.pagenum, min=1, max=len(app.mw.document.pages), step=1, width=6, command=self.ok) self.pagenum_spin.pack(side=LEFT) if len(app.mw.document.pages) == 1: self.pagenum_spin.set_state('disabled') bottom = TFrame(root, style='FlatFrame', borderwidth=5) bottom.pack(side=BOTTOM, fill=X, expand=1) cancel = TButton(bottom, text=_("Cancel"), command=self.cancel) cancel.pack(side=RIGHT) label = TLabel(bottom, text=' ', style='FlatLabel') label.pack(side=RIGHT) ok = TButton(bottom, text=_("OK"), command=self.ok) ok.pack(side=RIGHT) self.focus_widget = ok self.top.bind('<Escape>', self.cancel) self.top.protocol('WM_DELETE_WINDOW', self.cancel) self.top.resizable(width=0, height=0)
def build_dlg(self): super = self.top top = TFrame(super, borderwidth=10, style='FlatFrame') top.pack(side=TOP, fill=BOTH, expand=1) frame = TFrame(top, style='FlatFrame') frame.pack(side=BOTTOM, fill=BOTH, expand=0) label = TLabel(top, style="HLine") label.pack(side=BOTTOM, fill=BOTH, expand=0) button = TButton(frame, text=_("Cancel"), command=self.cancel) button.pack(side=RIGHT, expand=0) label = TLabel(frame, image="space_6", style="FlatLabel") label.pack(side=RIGHT) button = TButton(frame, text=_("OK"), command=self.ok) button.pack(side=RIGHT, expand=0) button = TButton(frame, image='colorpicker', state='disabled') button.pack(side=LEFT, expand=0) # RGBlabel_frame = TFrame(top, borderwidth = 1, style='FlatFrame') # RGBlabel_frame.pack(side = BOTTOM, fill = BOTH) # # self.label = TLabel(RGBlabel_frame, style="FlatLabel") # self.label.pack(side = LEFT) frame = TFrame(top, style="RoundedFrame", borderwidth=5) frame.pack(side=LEFT) viewxy = ChooseRGBXY(frame, xyramp_size[0], xyramp_size[1], 0, 1) viewxy.pack(side=LEFT) frame = TFrame(top, style="RoundedFrame", borderwidth=5) frame.pack(side=LEFT) viewz = ChooseRGBZ(frame, zramp_size[0], zramp_size[1], 2) viewz.pack(side=LEFT) frame1 = TFrame(top, borderwidth=3, style='FlatFrame') frame1.pack(side=RIGHT) CS_frame = TFrame(frame1, borderwidth=1, style='FlatFrame') CS_frame.pack(side=TOP) label = TLabel(CS_frame, text="Old color: \nNew color: ", justify='right') label.pack(side=LEFT) frame = TFrame(CS_frame, style="RoundedFrame", borderwidth=5) frame.pack(side=LEFT) self.sample = ColorSample(frame, self.color, width=60, height=20) self.sample.pack(side=BOTTOM) sample = ColorSample(frame, self.color, width=60, height=20) sample.pack(side=TOP) label = TLabel(frame1, style="HLine") label.pack(side=TOP, fill=BOTH, expand=0) spin_frame = TFrame(frame1, borderwidth=1, style='FlatFrame') spin_frame.pack(side=TOP) hsv_frame = TFrame(spin_frame, borderwidth=2, style='FlatFrame') hsv_frame.pack(side=LEFT) frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame') frame.pack(side=TOP) label = TLabel(frame, text="H: ") label.pack(side=LEFT) self.var1 = TSpinbox(frame, min=0, max=1.0, step=0.01, vartype=1, command=self.component_changed) self.var1.pack(side=RIGHT) frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame') frame.pack(side=TOP) label = TLabel(frame, text="S: ") label.pack(side=LEFT) self.var2 = TSpinbox(frame, min=0, max=1.0, step=0.01, vartype=1, command=self.component_changed) self.var2.pack(side=RIGHT) frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame') frame.pack(side=TOP) label = TLabel(frame, text="V: ") label.pack(side=LEFT) self.var3 = TSpinbox(frame, min=0, max=1.0, step=0.01, vartype=1, command=self.component_changed) self.var3.pack(side=RIGHT) rgb_frame = TFrame(spin_frame, borderwidth=2, style='FlatFrame') rgb_frame.pack(side=LEFT) frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame') frame.pack(side=TOP) label = TLabel(frame, text="R: ") label.pack(side=LEFT) self.var4 = TSpinbox(frame, min=0, max=255, step=1, vartype=0, command=self.rgb_component_changed) self.var4.pack(side=RIGHT) frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame') frame.pack(side=TOP) label = TLabel(frame, text="G: ") label.pack(side=LEFT) self.var5 = TSpinbox(frame, min=0, max=255, step=1, vartype=0, command=self.rgb_component_changed) self.var5.pack(side=RIGHT) frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame') frame.pack(side=TOP) label = TLabel(frame, text="B: ") label.pack(side=LEFT) self.var6 = TSpinbox(frame, min=0, max=255, step=1, vartype=0, command=self.rgb_component_changed) self.var6.pack(side=RIGHT) HTML_frame = TFrame(frame1, borderwidth=3, style='FlatFrame') HTML_frame.pack(side=TOP) label = TLabel(HTML_frame, text="HTML: ") label.pack(side=LEFT) self.html = TEntrybox(HTML_frame, text='#000000', width=10, command=self.html_component_changed) self.html.pack(side=LEFT) viewxy.Subscribe(CHANGED, self.color_changed) viewz.Subscribe(CHANGED, self.color_changed) self.viewxy = viewxy self.viewz = viewz super.resizable(width=0, height=0) self.color_changed(self.color)
def init(self, master): PluginPanel.init(self, master) top = self.panel top = TFrame(top, borderwidth=2, style='FlatFrame') top.pack(side=TOP, expand=1, fill=X) button_frame = TFrame(top, borderwidth=2, style='FlatFrame') button_frame.pack(side=BOTTOM, fill=BOTH, expand=1) button = TButton(button_frame, text=_('Apply'), command=self.replace) button.pack(side=TOP) #---------------------------------------------------------- main_frame = TFrame(top, style='FlatFrame', borderwidth=3) main_frame.pack(side=TOP, fill=X) self.find_var = StringVar(top) self.find_var.set('') findField = TEntryExt(main_frame, textvariable=self.find_var) findField.pack(side=RIGHT) label = TLabel(main_frame, style='FlatLabel', text=_("Find:") + " ") label.pack(side=RIGHT, anchor=E) #--------------------------------------------------------- main_frame = TFrame(top, style='FlatFrame', borderwidth=3) main_frame.pack(side=TOP, fill=X) self.replace_var = StringVar(top) self.replace_var.set('') replaceField = TEntryExt(main_frame, textvariable=self.replace_var) replaceField.pack(side=RIGHT) label = TLabel(main_frame, style='FlatLabel', text=_("Replace to:") + " ") label.pack(side=RIGHT, anchor=E) main_frame = TFrame(top, style='FlatFrame', borderwidth=3) main_frame.pack(side=TOP) #--------------------------------------------------------- label = TLabel(top, text=" " + _("Parameters") + " ", style="FlatLabel") label.pack() parametersFrameLabel = TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=4) parametersFrameLabel.pack(side=TOP, fill=X, pady=4, padx=4) parametersFrame = TFrame(parametersFrameLabel, style='FlatFrame') self.var_case_sensitive = BooleanVar(top) self.var_case_sensitive.set(False) self.case_sensitive_check = TCheckbutton( parametersFrame, text=_("Case sensitive"), variable=self.var_case_sensitive) self.case_sensitive_check.pack(side=TOP, anchor=W, padx=5) self.var_whole_word = BooleanVar(top) self.var_whole_word.set(False) self.whole_word_check = TCheckbutton(parametersFrame, text=_("Whole word"), variable=self.var_whole_word) self.whole_word_check.pack(side=TOP, anchor=W, padx=5) self.var_regexp = BooleanVar(top) self.var_regexp.set(False) self.regexpCheck = TCheckbutton(parametersFrame, text=_("RegExp search"), variable=self.var_regexp, command=self.disable_enable_action) self.regexpCheck.pack(side=TOP, anchor=W, padx=5) parametersFrame.pack(side=TOP, fill=X, pady=2)
def build_dlg(self): if not self.builded: cmds = self.mw.canvas.commands.PolyBezierEditor b = TButton(self.panel, command=cmds.InsertNodes.Invoke, style='Toolbutton', image='context_node_add') tooltips.AddDescription(b, _('Insert node')) b.pack(side=LEFT) b = TButton(self.panel, command=cmds.DeleteNodes.Invoke, style='Toolbutton', image='context_node_remove') tooltips.AddDescription(b, _('Remove nodes')) b.pack(side=LEFT) ############# b = TLabel(self.panel, image="toolbar_sep") b.pack(side=LEFT) b = TButton(self.panel, command=cmds.CloseNodes.Invoke, style='Toolbutton', image='context_node_join') tooltips.AddDescription(b, _('Join selected nodes')) b.pack(side=LEFT) b = TButton(self.panel, command=cmds.OpenNodes.Invoke, style='Toolbutton', image='context_node_break') tooltips.AddDescription(b, _('Break path at selected nodes')) b.pack(side=LEFT) ############# b = TLabel(self.panel, image="toolbar_sep") b.pack(side=LEFT) b = TButton(self.panel, command=cmds.ContAngle.Invoke, style='Toolbutton', image='context_node_corner') tooltips.AddDescription(b, _('Make selected nodes corner')) b.pack(side=LEFT) b = TButton(self.panel, command=cmds.ContSmooth.Invoke, style='Toolbutton', image='context_node_smooth') tooltips.AddDescription(b, _('Make selected nodes smooth')) b.pack(side=LEFT) b = TButton(self.panel, command=cmds.ContSymmetrical.Invoke, style='Toolbutton', image='context_node_symm') tooltips.AddDescription(b, _('Make selected nodes symmetric')) b.pack(side=LEFT) ############# b = TLabel(self.panel, image="toolbar_sep") b.pack(side=LEFT) b = TButton(self.panel, command=cmds.SegmentsToLines.Invoke, style='Toolbutton', image='context_node_line') tooltips.AddDescription(b, _('Make selected segments lines')) b.pack(side=LEFT) b = TButton(self.panel, command=cmds.SegmentsToCurve.Invoke, style='Toolbutton', image='context_node_curve') tooltips.AddDescription(b, _('Make selected segments curves')) b.pack(side=LEFT) ############# b = TLabel(self.panel, image="toolbar_sep") b.pack(side=LEFT) b = TButton(self.panel, command=cmds.SelectAllNodes.Invoke, style='Toolbutton', image='context_node_all') tooltips.AddDescription(b, _('Select all nodes in path')) b.pack(side=LEFT) self.builded = 1