Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
snippets = List(CodeItem)
# The list of visible code items for the lab:
visible_snippets = Property(depends_on='visible', cached=True)
# The currently selected snippet:
snippet = Instance(CodeItem)
# Should normally hidden code items be shown?
visible = Bool(False)
# The dictionary containing the items from the Python code execution:
values = Dict # Any( {} )
# The run Python code button:
run = Button(image=ImageResource('run'), height_padding=1)
# User error message:
message = Str
# The output produced while the program is running:
output = Str
# The current demo pane (if any):
demo = Instance(DemoPane, ())
#-- Traits View Definitions ----------------------------------------------
view = View(
VSplit(
VGroup(
Item('visible_snippets',
def _get_image(self, image):
""" Converts a user specified image to a QIcon.
"""
if isinstance(image, basestring):
self.image = image
image = self.image
if isinstance(image, ImageResource):
result = self.image_resources.get(image)
if result is not None:
return result
return self._add_image(image)
return self.images.get(image)
from pyface.i_application_window import MApplicationWindow
from pyface.image_resource import ImageResource
from .window import Window
@provides(IApplicationWindow)
class ApplicationWindow(MApplicationWindow, Window):
""" The toolkit specific implementation of an ApplicationWindow. See the
IApplicationWindow interface for the API documentation.
"""
# 'IApplicationWindow' interface ---------------------------------------
icon = Instance(ImageResource)
menu_bar_manager = Instance(MenuBarManager)
status_bar_manager = Instance(StatusBarManager)
tool_bar_manager = Instance(ToolBarManager)
# If the underlying toolkit supports multiple toolbars then you can use
# this list instead.
tool_bar_managers = List(ToolBarManager)
# 'IWindow' interface -------------------------------------------------#
# fixme: We can't set the default value of the actual 'size' trait here as
# in the toolkit-specific event handlers for window size and position
# changes, we set the value of the shadow '_size' trait. The problem is
def _sensitivity_group(self):
im = ImageResource(
name='database_go.png',
search_path=paths.icon_search_path)
beditor = ButtonEditor(image=im)
grp = VGroup(
HGroup(
Item('save_sens', label='Save'),
UItem('sens_value', ),
UItem('db_sens_button',
style='custom',
editor=beditor)),
label='Sensitivity')
return grp
layout='tabbed',
label='Help',
id='help'
),
layout="tabbed",
springy=True,
id="tabs",
),
resizable=False,
handler=MyHandler(),
buttons=[run_sim, save_cfg, load_cfg, save_data, load_data],
statusbar="status_str",
title="PyBERT",
width=0.95,
height=0.9,
icon=ImageResource("icon.png"),
)
next_section = Property(depends_on='section', cached=True)
# The previous section:
previous_section = Property(depends_on='section', cached=True)
# The previous section button:
previous = Button(image=ImageResource('previous'), height_padding=1)
# The next section button:
next = Button(image=ImageResource('next'), height_padding=1)
# The parent section button:
parent = Button(image=ImageResource('parent'), height_padding=1)
# The reload tutor button:
reload = Button(image=ImageResource('reload'), height_padding=1)
# The title of the current session:
title = Property(depends_on='section')
#-- Traits View Definitions ----------------------------------------------
view = View(
VGroup(
HGroup(
Item('previous',
style='custom',
enabled_when='previous_section is not None',
tooltip='Go to previous section'
),
Item('parent',
style='custom',
if decorated:
webbrowser.open(url, autoraise=1)
else:
firefox = webbrowser.get('firefox')
firefox._invoke(['-chrome', url], remote=False, autoraise=True)
else:
webbrowser.open(url, autoraise=1)
class Bugfix(Action):
""" An action that pop up the bugfix GitHub page in a browser. """
name = "Bugfixes"
tooltip = "Bug Fixes ..."
description = "Bug Fixes ..."
image = ImageResource("bug.png", search_path=[IMAGE_PATH])
###########################################################################
# 'Action' interface.
###########################################################################
def perform(self, event):
""" Performs the action. """
browser_open(url='http://github.com/LTS5/connectomeviewer/issues', decorated = True)
class Keybindings(Action):
""" An action that creates a temporary html file to show the key bindings.. """
name = "Key Bindings"
tooltip = "Show Key Bindings in Browser"
description = "Key Bindings"
image = ImageResource("keyboard.png", search_path=[IMAGE_PATH])
path = Directory
# The root of the tutorial lesson tree:
root = Instance(ASection)
# The current section of the tutorial being displayed:
section = Instance(ASection)
# The next section:
next_section = Property(depends_on='section', cached=True)
# The previous section:
previous_section = Property(depends_on='section', cached=True)
# The previous section button:
previous = Button(image=ImageResource('previous'), height_padding=1)
# The next section button:
next = Button(image=ImageResource('next'), height_padding=1)
# The parent section button:
parent = Button(image=ImageResource('parent'), height_padding=1)
# The reload tutor button:
reload = Button(image=ImageResource('reload'), height_padding=1)
# The title of the current session:
title = Property(depends_on='section')
#-- Traits View Definitions ----------------------------------------------
view = View(
def _get_big_image(self):
size = self.item.size
if size > 65536:
return ImageResource('red_ball')
return (None, ImageResource('blue_ball'))[size > 16384]