def _show_menu(self, event, obj): actions = [] if self.manager.mode != 'client': if isinstance(self.active_item, BaseValve): t = 'Lock' if obj.soft_lock: t = 'Unlock' action = self._action_factory(t, 'OnLock') actions.append(action) #else: # if self.active_item.name # # actions.append(self._action_factory('Isolate', 'OnIsolate', # klass=ExtractionLineAction, # chamber=self.active_item.name)) # actions = [self._action_factory(name, func) for name, func in []] if actions: menu_manager = MenuManager(*actions) self._active_item = self.active_item menu = menu_manager.create_menu(event.window.control, None) menu.show()
def _show_menu(self, event, obj): actions = [] if self.manager.mode != 'client' or not globalv.client_only_locking: # print self.active_item, isinstance(self.active_item, Switch) # if isinstance(self.active_item, Switch): if isinstance(self.active_item, BaseValve): t = 'Lock' if obj.soft_lock: t = 'Unlock' action = self._action_factory(t, 'on_lock') actions.append(action) if self.force_actuate_enabled: action = self._action_factory('Force Close', 'on_force_close') actions.append(action) action = self._action_factory('Force Open', 'on_force_open') actions.append(action) if actions: menu_manager = MenuManager(*actions) self._active_item = self.active_item menu = menu_manager.create_menu(event.window.control, None) menu.show()
def _show_menu(self, event, obj): actions = [] if self.manager.mode != 'client': if isinstance(self.active_item, BaseValve): t = 'Lock' if obj.soft_lock: t = 'Unlock' action = self._action_factory(t, 'on_lock') actions.append(action) if actions: menu_manager = MenuManager(*actions) self._active_item = self.active_item menu = menu_manager.create_menu(event.window.control, None) menu.show()
def _show_menu(self, event, obj): actions = [] if self.manager.mode != 'client' or not globalv.client_only_locking: if isinstance(self.active_item, BaseValve): t = 'Lock' if obj.soft_lock: t = 'Unlock' action = self._action_factory(t, 'on_lock') actions.append(action) if actions: menu_manager = MenuManager(*actions) self._active_item = self.active_item menu = menu_manager.create_menu(event.window.control, None) menu.show()