def __init__(self, master, app): CNCRibbon.ButtonMenuGroup.__init__( self, master, N_("Edit"), app, [(_("Autolevel"), "level", lambda a=app: a.insertCommand("AUTOLEVEL", True)), (_("Color"), "color", lambda a=app: a.event_generate("<<ChangeColor>>")), (_("Import"), "load", lambda a=app: a.insertCommand("IMPORT", True)), (_("Inkscape"), "inkscape", lambda a=app: a.insertCommand("INKSCAPE all", True)), (_("Round"), "digits", lambda s=app: s.insertCommand("ROUND", True))]) self.grid3rows() # --- col, row = 0, 0 # b = Ribbon.LabelButton(self.frame, app, "<<Add>>", # image=Utils.icons["add"], # text=_("Add"), # compound=LEFT, # anchor=W, # background=Ribbon._BACKGROUND) # b.grid(row=row, column=col, padx=0, pady=0, sticky=NSEW) # tkExtra.Balloon.set(b, _("Insert a new block or line of code [Ins or Ctrl-Enter]")) # self.addWidget(b) b = Ribbon.LabelButton(self.frame, self.app, "<<Add>>", image=Utils.icons["add"], anchor=W, background=Ribbon._BACKGROUND) b.grid(row=row, column=col, padx=0, pady=0, sticky=NSEW) tkExtra.Balloon.set( b, _("Insert a new block or line of code [Ins or Ctrl-Enter]")) self.addWidget(b) menulist = [(_("Line"), "add", lambda a=self.app: a.event_generate("<<AddLine>>")), (_("Block"), "add", lambda a=self.app: a.event_generate("<<AddBlock>>"))] b = Ribbon.MenuButton(self.frame, menulist, text=_("Add"), image=Utils.icons["triangle_down"], compound=RIGHT, anchor=W, background=Ribbon._BACKGROUND) b.grid(row=row, column=col + 1, padx=0, pady=0, sticky=NSEW) tkExtra.Balloon.set( b, _("Insert a new block or line of code [Ins or Ctrl-Enter]")) # --- row += 1 b = Ribbon.LabelButton(self.frame, app, "<<Clone>>", image=Utils.icons["clone"], text=_("Clone"), compound=LEFT, anchor=W, background=Ribbon._BACKGROUND) b.grid(row=row, column=col, columnspan=2, padx=0, pady=0, sticky=NSEW) tkExtra.Balloon.set(b, _("Clone selected lines or blocks [Ctrl-D]")) self.addWidget(b) # --- row += 1 b = Ribbon.LabelButton(self.frame, app, "<<Delete>>", image=Utils.icons["x"], text=_("Delete"), compound=LEFT, anchor=W, background=Ribbon._BACKGROUND) b.grid(row=row, column=col, columnspan=2, padx=0, pady=0, sticky=NSEW) tkExtra.Balloon.set(b, _("Delete selected lines or blocks [Del]")) self.addWidget(b) # --- col, row = 2, 0 b = Ribbon.LabelButton( self.frame, self.app, "<<EnableToggle>>", image=Utils.icons["toggle"], # text=_("Toggle"), # compound=LEFT, anchor=W, background=Ribbon._BACKGROUND) b.grid(row=row, column=col, padx=0, pady=0, sticky=NSEW) tkExtra.Balloon.set( b, _("Toggle enable/disable block of g-code [Ctrl-L]")) self.addWidget(b) menulist = [(_("Enable"), "enable", lambda a=self.app: a.event_generate("<<Enable>>")), (_("Disable"), "disable", lambda a=self.app: a.event_generate("<<Disable>>"))] b = Ribbon.MenuButton(self.frame, menulist, text=_("Active"), image=Utils.icons["triangle_down"], compound=RIGHT, anchor=W, background=Ribbon._BACKGROUND) b.grid(row=row, column=col + 1, padx=0, pady=0, sticky=NSEW) tkExtra.Balloon.set(b, _("Enable or disable blocks of gcode")) # --- row += 1 b = Ribbon.LabelButton(self.frame, self.app, "<<Expand>>", image=Utils.icons["expand"], text=_("Expand"), compound=LEFT, anchor=W, background=Ribbon._BACKGROUND) b.grid(row=row, column=col, columnspan=2, padx=0, pady=0, sticky=NSEW) tkExtra.Balloon.set( b, _("Toggle expand/collapse blocks of gcode [Ctrl-E]")) self.addWidget(b) # --- row += 1 b = Ribbon.LabelButton(self.frame, image=Utils.icons["comment"], text=_("Comment"), compound=LEFT, anchor=W, state=DISABLED, background=Ribbon._BACKGROUND) b.grid(row=row, column=col, columnspan=2, padx=0, pady=0, sticky=NSEW) tkExtra.Balloon.set(b, _("(Un)Comment selected lines")) self.addWidget(b)
def __init__(self, master, app): CNCRibbon.ButtonMenuGroup.__init__( self, master, N_("Edit"), app, [(_("Autolevel"), "level", lambda a=app: a.insertCommand("AUTOLEVEL", True)), (_("Color"), "color", lambda a=app: a.event_generate("<<ChangeColor>>")), (_("Import"), "load", lambda a=app: a.insertCommand("IMPORT", True)), (_("Round"), "digits", lambda s=app: s.insertCommand("ROUND", True))]) self.grid3rows() col, row = 0, 0 b = Ribbon.LabelButton(self.frame, OCV.APP, "<<Add>>", image=OCV.icons["add"], anchor=Tk.W, background=OCV.COLOR_BACKGROUND) b.grid(row=row, column=col, padx=0, pady=0, sticky=Tk.NSEW) tkExtra.Balloon.set( b, _("Insert a new block or line of code [Ins or Ctrl-Enter]")) self.addWidget(b) menulist = [(_("Line"), "add", lambda a=OCV.APP: a.event_generate("<<AddLine>>")), (_("Block"), "add", lambda a=OCV.APP: a.event_generate("<<AddBlock>>"))] b = Ribbon.MenuButton(self.frame, menulist, text=_("Add"), image=OCV.icons["triangle_down"], compound=Tk.RIGHT, anchor=Tk.W, background=OCV.COLOR_BACKGROUND) b.grid(row=row, column=col + 1, padx=0, pady=0, sticky=Tk.NSEW) tkExtra.Balloon.set( b, _("Insert a new block or line of code [Ins or Ctrl-Enter]")) row += 1 b = Ribbon.LabelButton(self.frame, app, "<<Clone>>", image=OCV.icons["clone"], text=_("Clone"), compound=Tk.LEFT, anchor=Tk.W, background=OCV.COLOR_BACKGROUND) b.grid(row=row, column=col, columnspan=2, padx=0, pady=0, sticky=Tk.NSEW) tkExtra.Balloon.set(b, _("Clone selected lines or blocks [Ctrl-D]")) self.addWidget(b) row += 1 b = Ribbon.LabelButton(self.frame, app, "<<Delete>>", image=OCV.icons["x"], text=_("Delete"), compound=Tk.LEFT, anchor=Tk.W, background=OCV.COLOR_BACKGROUND) b.grid(row=row, column=col, columnspan=2, padx=0, pady=0, sticky=Tk.NSEW) tkExtra.Balloon.set(b, _("Delete selected lines or blocks [Del]")) self.addWidget(b) col, row = 2, 0 b = Ribbon.LabelButton( self.frame, OCV.APP, "<<EnableToggle>>", image=OCV.icons["toggle"], # text=_("Toggle"), # compound=Tk.LEFT, anchor=Tk.W, background=OCV.COLOR_BACKGROUND) b.grid(row=row, column=col, padx=0, pady=0, sticky=Tk.NSEW) tkExtra.Balloon.set( b, _("Toggle enable/disable block of g-code [Ctrl-L]")) self.addWidget(b) menulist = [(_("Enable"), "enable", lambda a=OCV.APP: a.event_generate("<<Enable>>")), (_("Disable"), "disable", lambda a=OCV.APP: a.event_generate("<<Disable>>"))] b = Ribbon.MenuButton(self.frame, menulist, text=_("Active"), image=OCV.icons["triangle_down"], compound=Tk.RIGHT, anchor=Tk.W, background=OCV.COLOR_BACKGROUND) b.grid(row=row, column=col + 1, padx=0, pady=0, sticky=Tk.NSEW) tkExtra.Balloon.set(b, _("Enable or disable blocks of gcode")) row += 1 b = Ribbon.LabelButton(self.frame, OCV.APP, "<<Expand>>", image=OCV.icons["expand"], text=_("Expand"), compound=Tk.LEFT, anchor=Tk.W, background=OCV.COLOR_BACKGROUND) b.grid(row=row, column=col, columnspan=2, padx=0, pady=0, sticky=Tk.NSEW) tkExtra.Balloon.set( b, _("Toggle expand/collapse blocks of gcode [Ctrl-E]")) self.addWidget(b) row += 1 b = Ribbon.LabelButton(self.frame, OCV.APP, "<<Comment>>", image=OCV.icons["comment"], text=_("Comment"), compound=Tk.LEFT, anchor=Tk.W, background=OCV.COLOR_BACKGROUND) b.grid(row=row, column=col, columnspan=2, padx=0, pady=0, sticky=Tk.NSEW) tkExtra.Balloon.set(b, _("(Un)Comment selected lines")) self.addWidget(b) # --- col += 2 row = 0 b = Ribbon.LabelButton(self.frame, OCV.APP, "<<Join>>", image=OCV.icons["union"], text=_("Join"), compound=Tk.LEFT, anchor=Tk.W, background=OCV.COLOR_BACKGROUND) b.grid(row=row, column=col, columnspan=2, padx=0, pady=0, sticky=Tk.NSEW) tkExtra.Balloon.set(b, _("Join selected blocks")) self.addWidget(b) row += 1 b = Ribbon.LabelButton(self.frame, OCV.APP, "<<Split>>", image=OCV.icons["cut"], text=_("Split"), compound=Tk.LEFT, anchor=Tk.W, background=OCV.COLOR_BACKGROUND) b.grid(row=row, column=col, columnspan=2, padx=0, pady=0, sticky=Tk.NSEW) tkExtra.Balloon.set(b, _("Split selected blocks")) self.addWidget(b) row += 1 b = Ribbon.LabelButton(self.frame, OCV.APP, "<<ClearEditor>>", image=OCV.icons["clear"], text=_("Clear All"), compound=Tk.LEFT, anchor=Tk.W, background=OCV.COLOR_BACKGROUND) b.grid(row=row, column=col, columnspan=2, padx=0, pady=0, sticky=Tk.NSEW) tkExtra.Balloon.set(b, _("Clear Editor Window")) self.addWidget(b)