def __init__(self, app, parent): self.app = app actions = app.actions wal.HPanel.__init__(self, parent) action_id = pdids.ID_SNAP_TO_GRID tooltip_txt = get_tooltip_text(action_id) icons_dict = { True: [icons.PD_SNAP_TO_GRID_ON, tooltip_txt], False: [icons.PD_SNAP_TO_GRID_OFF, tooltip_txt] } sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) action_id = pdids.ID_SNAP_TO_GUIDE tooltip_txt = get_tooltip_text(action_id) icons_dict = { True: [icons.PD_SNAP_TO_GUIDE_ON, tooltip_txt], False: [icons.PD_SNAP_TO_GUIDE_OFF, tooltip_txt] } sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) action_id = pdids.ID_SNAP_TO_OBJ tooltip_txt = get_tooltip_text(action_id) icons_dict = { True: [icons.PD_SNAP_TO_OBJ_ON, tooltip_txt], False: [icons.PD_SNAP_TO_OBJ_OFF, tooltip_txt] } sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) action_id = pdids.ID_SNAP_TO_PAGE tooltip_txt = get_tooltip_text(action_id) icons_dict = { True: [icons.PD_SNAP_TO_PAGE_ON, tooltip_txt], False: [icons.PD_SNAP_TO_PAGE_OFF, tooltip_txt] } sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) self.pack(wal.PLine(self.panel), fill=True, padding=5)
def __init__(self, app, parent): self.app = app actions = app.actions wal.HPanel.__init__(self, parent) action_id = pdids.ID_SNAP_TO_GRID tooltip_txt = get_tooltip_text(action_id) icons_dict = { True:[icons.PD_SNAP_TO_GRID_ON, tooltip_txt], False:[icons.PD_SNAP_TO_GRID_OFF, tooltip_txt]} sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) action_id = pdids.ID_SNAP_TO_GUIDE tooltip_txt = get_tooltip_text(action_id) icons_dict = { True:[icons.PD_SNAP_TO_GUIDE_ON, tooltip_txt], False:[icons.PD_SNAP_TO_GUIDE_OFF, tooltip_txt]} sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) action_id = pdids.ID_SNAP_TO_OBJ tooltip_txt = get_tooltip_text(action_id) icons_dict = { True:[icons.PD_SNAP_TO_OBJ_ON, tooltip_txt], False:[icons.PD_SNAP_TO_OBJ_OFF, tooltip_txt]} sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) action_id = pdids.ID_SNAP_TO_PAGE tooltip_txt = get_tooltip_text(action_id) icons_dict = { True:[icons.PD_SNAP_TO_PAGE_ON, tooltip_txt], False:[icons.PD_SNAP_TO_PAGE_OFF, tooltip_txt]} sw = ActionImageSwitch(self, actions[action_id], icons_dict) self.pack(sw, padding=2) self.pack(wal.VLine(self.panel), fill=True, padding=2)
def get_tooltip_text(self): txt = resources.get_tooltip_text(self.action_id) if self.is_acc: shortcut = self.get_shortcut_text() txt = '%s (%s)' % (txt, shortcut) return txt
def get_tooltip_text(self): return resources.get_tooltip_text(self.action_id)