def build_dlg(self): root = self.top top = TFrame(root, borderwidth=2, style='FlatFrame') top.pack(side=TOP, expand=0, fill=BOTH) top2 = TFrame(top, height=3, style='FlatFrame') top2.pack(side=BOTTOM, expand=0, fill=X) button = UpdatedButton(top, text=_("Apply style"), command=self.apply_style, sensitivecb=self.can_apply, width=15) button.pack(side=BOTTOM, expand=0) self.Subscribe(SELECTION, button.Update) top2 = TFrame(top, height=3, style='FlatFrame') top2.pack(side=BOTTOM, expand=0, fill=X) button = UpdatedButton(top, text=_("Delete style"), command=self.remove_style, sensitivecb=self.can_remove, width=15) button.pack(side=BOTTOM, expand=0) top2 = TFrame(top, height=3, style='FlatFrame') top2.pack(side=BOTTOM, expand=0, fill=X) button = UpdatedButton(top, text=_("Create new style"), command=self.CreateStyleFromSelection, sensitivecb=self.main_window.document.CanCreateStyle, width=15) button.pack(side=BOTTOM, expand=0) self.Subscribe(SELECTION, button.Update) top2 = TFrame(top, height=5, style='FlatFrame') top2.pack(side=BOTTOM, expand=0, fill=X) list_frame = TFrame(top, style="RoundedFrame", borderwidth=5) list_frame.pack(side=TOP, expand=1, fill=BOTH) sb_vert = TScrollbar(list_frame, takefocus=0) sb_vert.pack(side=RIGHT, fill=Y) styles = UpdatedListbox(list_frame, bg='white', borderwidth=0, selectborderwidth=0) styles.pack(expand=1, fill=BOTH) styles.Subscribe(COMMAND, self.apply_style) sb_vert['command'] = (styles, 'yview') styles['yscrollcommand'] = (sb_vert, 'set') self.styles = styles root.resizable(width=0, height=0)
def init(self, master): PluginPanel.init(self, master) top = self.panel grid_top = TFrame(top, borderwidth=2, style='FlatFrame') grid_top.pack(side=TOP, expand=1, fill=X) var_number = DoubleVar(top) var_unit = StringVar(top) self.var_pos = LengthVar(1.0, config.preferences.default_unit, var_number, var_unit, command=self.set_pos) top1 = TFrame(top, style='FlatFrame') top1.pack(side=TOP, expand=0, fill=BOTH) list_frame = TFrame(top1, style="RoundedFrame", borderwidth=5) list_frame.pack(side=TOP, expand=1, fill=BOTH) sb_vert = TScrollbar(list_frame) sb_vert.pack(side=RIGHT, fill=Y) guides = UpdatedListbox(list_frame, bg='white', borderwidth=0, selectborderwidth=0, width=20, height=8) guides.pack(expand=1, fill=BOTH) guides.Subscribe(SELECTION, self.select_guide) sb_vert['command'] = (guides, 'yview') guides['yscrollcommand'] = (sb_vert, 'set') self.guides = guides self.selected = None pos_frame = TFrame(top1, style='FlatFrame') pos_frame.pack(side=TOP, expand=0) top2 = TFrame(pos_frame, height=15, style='FlatFrame') top2.pack(side=TOP, expand=0, fill=X) self.var_label = StringVar(top) self.var_label.set('X: ') labelunit = UnitLabel(pos_frame) labelunit.pack(side=RIGHT, expand=0, anchor=W) label = TLabel(pos_frame, image='space_6', style='FlatLabel') label.pack(side=RIGHT) self.entry = TSpinbox(pos_frame, var=0, vartype=1, min=-50000, max=50000, step=.1, width=6, command=self.pos_changed) self.entry.pack(side=RIGHT, expand=0, anchor=E) label = TLabel(pos_frame, textvariable=self.var_label, style='FlatLabel') label.pack(side=RIGHT, expand=0, anchor=E) frame = TFrame(top1, style='FlatFrame') frame.pack(side=TOP, fill=X) top2 = TFrame(frame, height=15, width=120, style='FlatFrame') top2.pack(side=TOP) button = UpdatedButton(frame, text=_("Add Horizontal Guide"), command=self.add_guide, args=1) button.pack(side=TOP) top2 = TFrame(frame, height=3, style='FlatFrame') top2.pack(side=TOP, expand=0, fill=X) button = UpdatedButton(frame, text=_("Add Vertical Guide"), command=self.add_guide, args=0) button.pack(side=TOP) top2 = TFrame(frame, height=3, style='FlatFrame') top2.pack(side=TOP, expand=0, fill=X) button = UpdatedButton(frame, text=_("Delete Guide"), command=self.del_guide) button.pack(side=TOP) top2 = TFrame(frame, height=5, style='FlatFrame') top2.pack(side=TOP, expand=0, fill=X) app.mw.docmanager.activedoc.Subscribe(GUIDE_LINES, self.init_from_doc) app.mw.Subscribe(DOCUMENT, self.init_from_doc) self.init_from_doc()