Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_python_shell_window(application, **kwargs):
""" Factory method for constructing application window instances. """
window = PythonShellWindow(**kwargs)
# Override the window's menubar with an enhanced one.
# One of the advantages of Tasks is that we can extend easily, rather
# than just overriding.
window.menu_bar_manager = MenuBarManager(
MenuManager(
Group(CreateWindowAction(application=application), id="new_group"),
Group(
CloseActiveWindowAction(application=application),
ExitAction(application=application),
id="close_group",
),
name="&File",
id="File",
),
MenuManager(
Group(RunFileAction(window=window), id="run_group"),
name="&Run",
id="Run",
),
MenuManager(
Group(
OpenURLAction(
def get_group(self, location, menu_name, group_name):
actions = self.get_actions_wrapper(location, menu_name, group_name)
return Group(*actions, id=group_name)
def get_actions_Menu_View_ColorGroup(self):
return [
SMenu(
Group(
va.ColorStandardAction(name="NTSC", color_standard=0),
va.ColorStandardAction(name="PAL", color_standard=1),
id="a0", separator=True),
Group(
va.UseColorsAction(name="ANTIC Powerup Colors", colors=colors.powerup_colors()),
id="a1", separator=True),
Group(
va.AnticColorAction(),
id="a2", separator=True),
id='mm4', separator=False, name="Colors"),
]
self.exit_action = exit_action
# Test action to toggle visibility of exit action and some action groups
test_action = Action(name="&Toggle", on_perform=self.toggle)
# Add a menu bar.
self.menu_bar_manager = MenuBarManager(
MenuManager(exit_action, name="&File")
)
# Add some tool bars, with the first one subdivided into action groups
self.tool_bar_managers = [
ToolBarManager(
Group(exit_action, exit_action, id="a"),
Group(id="b"), # empty, so will remain hidden
Group(exit_action, exit_action, id="c"),
Group(exit_action, test_action, exit_action, id="d"),
name="Tool Bar 1",
show_tool_names=True,
),
ToolBarManager(
exit_action, name="Tool Bar 2", show_tool_names=True
),
ToolBarManager(
test_action, name="Tool Bar 3", show_tool_names=True
),
]
# Add a status bar.
self.status_bar_manager = StatusBarManager()
self.status_bar_manager.message = "Example application window"
def _create_other_group(self, window):
""" Creates a group containing the 'Other...' action. """
group = Group()
group.append(ShowViewAction(name="Other...", window=window))
return group
def get_context_menu(self, node):
""" Returns the context menu for a node. """
sat = Group(id="SystemActionsTop")
nsa = Group(id="NodeSpecificActions")
sab = Group(id="SystemActionsBottom")
# The 'New' menu.
new_actions = self.get_new_actions(node)
if new_actions is not None and len(new_actions) > 0:
sat.append(MenuManager(name="New", *new_actions))
# Node-specific actions.
actions = self.get_actions(node)
if actions is not None and len(actions) > 0:
for item in actions:
nsa.append(item)
# System actions (actions available on ALL nodes).
system_actions = self.node_manager.system_actions
if len(system_actions) > 0:
for item in system_actions:
def get_actions_Menu_View_PredefinedGroup(self):
actions = []
for m in machine.predefined['machine']:
actions.append(PredefinedMachineAction(machine=m))
return [
SMenu(
Group(
*actions,
id="a1", separator=True),
id='MachineChoiceSubmenu1', separator=False, name="Predefined Machines"),
]
def _create_reset_perspective_group(self, window):
""" Create the reset perspective actions. """
group = Group(
ResetActivePerspectiveAction(window=window),
ResetAllPerspectivesAction(window=window),
)
return group
def get_actions_Menu_View_PredefinedGroup(self):
actions = []
for m in machine.predefined['machine']:
actions.append(va.PredefinedMachineAction(machine=m))
return [
SMenu(
Group(
*actions,
id="a1", separator=True),
id='MachineChoiceSubmenu1', separator=False, name="Predefined Machines"),
]
def get_actions_Menu_View_SizeGroup(self):
return [
SMenu(
Group(
va.ViewerWidthAction(),
va.ViewerZoomAction(),
id="a1", separator=True),
id='mm8', separator=False, name="Viewer Size"),
]