예제 #1
0
 def _actions_default(self):
     filter_actions = self._build_filter_actions()
     module_actions = self._build_module_actions()
     return [
         Menu(name='Add Filter', *filter_actions),
         Menu(name='Add Module', *module_actions)
     ]
예제 #2
0
    def populate_rightclick_menu(self, info):
        """
        Populate the right-click menu with options to add and delete Steps, and
        to assign Steps to available programs.

        Called from the main application handler.
        """
        assign_items = []
        assign_items.append(
            Action(name='New Program',
                   action='handler.assign(info, to_program="new")'))
        for program in sorted(self.app.all_programs.programs,
                              key=lambda prg: prg.name):
            assign_items.append(
                Action(name=program.name,
                       action='handler.assign(info, to_program=%d)' %
                       program.ID))

        menu = Menu(
            Action(name='New Step', action='info.object.new_step()'),
            Action(name='Delete Selected',
                   action='handler.object_delete_changed(info)'),
            Action(name='Duplicate Selected',
                   action='handler.object_duplicate_changed(info)'),
            Action(name='Set Parameters for All Selected ...',
                   action='handler.set_all(info)'),
            Action(name='Interpolate ...', action='handler.interpolate(info)'),
            Menu(*assign_items, name="Assign Selected to Program ..."))
        for column in info.steps.columns:
            column.menu = menu
예제 #3
0
파일: _viewer.py 프로젝트: nrua/books
def launch_viewer(sources=None):
    '''Create the plot window'''
    if sources is None:
        sources = []

    if not isinstance(sources, (list, tuple)):
        sources = [sources]

    h = -20
    info_pane = Item('ipane', show_label=False, resizable=False)
    plot_window = VGroup(
        spring,
        HGroup(Item('displayed_fields', show_label=False), spring,
               Item('displayed_files', show_label=False), spring,
               Item('frame_first', show_label=False),
               Item('frame_prev', show_label=False),
               Item('frame_next', show_label=False),
               Item('frame_last', show_label=False),
               Item('sfstr', show_label=False, editor=TitleEditor())),
        HGroup(
            VGroup(
                Item('plotu', show_label=False),
                Item('plotd', show_label=False),
                Item('plotcu', show_label=False),
                Item('plotcd', show_label=False),
                Item('plotscale', show_label=False),
                Item('plotpts', show_label=False),
                '_',
                #Item('plotf', show_label=False),
                Item('plotana', show_label=False),
                '_',
                Item('plotp', show_label=False)),
            VGroup(
                Item('plotter',
                     show_label=False,
                     springy=True,
                     resizable=True,
                     width=900,
                     height=600))))

    menubar = MenuBar(
        Menu(Action(name='Open Output Database', action='open_file'),
             Action(name='Take Screenshot', action='print_screen'),
             Action(name='Quit', action='quit'),
             name='File'), Menu(name='Edit'),
        Menu(Action(name='Plot Analytic Function', action='plot_analytic'),
             Action(name='Field Variable', action='change_field'),
             Action(name='Scale', action='adjust_plot_scales'),
             name='Plot Options'), Menu(name='Help'))
    toolbar = None
    title = "Viewer"
    view = View(HSplit(info_pane, plot_window),
                style='custom',
                resizable=True,
                title=title,
                menubar=menubar,
                toolbar=toolbar)
    main_window = Application(sources=sources)
    main_window.configure_traits(view=view, handler=ApplicationHandler)
    return main_window
예제 #4
0
    def _quick_drag_menu(self, object):
        """ Displays the quick drag menu for a specified drag object.
        """

        # Get all the features it could be dropped on:
        feature_lists = []
        if isinstance(object, IFeatureTool):
            msg = "Apply to"
            for dc in self.dock_control.dock_controls:
                if dc.visible and (
                        object.feature_can_drop_on(dc.object)
                        or object.feature_can_drop_on_dock_control(dc)):
                    from .feature_tool import FeatureTool

                    feature_lists.append([FeatureTool(dock_control=dc)])
        else:
            msg = "Send to"
            for dc in self.dock_control.dock_controls:
                if dc.visible:
                    allowed = [
                        f for f in dc.features
                        if (f.feature_name != "") and f.can_drop(object)
                    ]
                    if len(allowed) > 0:
                        feature_lists.append(allowed)

        # If there are any compatible features:
        if len(feature_lists) > 0:
            # Create the pop-up menu:
            features = []
            actions = []
            for list in feature_lists:
                if len(list) > 1:
                    sub_actions = []
                    for feature in list:
                        sub_actions.append(
                            Action(
                                name="%s Feature" % feature.feature_name,
                                action="self._drop_on(%d)" % len(features),
                            ))
                        features.append(feature)
                    actions.append(
                        Menu(name="%s the %s" %
                             (msg, feature.dock_control.name),
                             *sub_actions))
                else:
                    actions.append(
                        Action(
                            name="%s %s" % (msg, list[0].dock_control.name),
                            action="self._drop_on(%d)" % len(features),
                        ))
                    features.append(list[0])

            # Display the pop-up menu:
            self._object = object
            self._features = features
            self.popup_menu(Menu(name="popup", *actions))
            self._object = self._features = None
예제 #5
0
 def default_menubar(self):
     return MenuBar(
         Menu(Action(name="&Open", action="load_run"),
              Action(name="&Save", action="save_run"),
              Action(name="&Exit", action="exit"),
              name="&File"),
         Menu(Action(name="About PStudy", action="about_pstudy"),
              HelpAction,
              name="Help"))
    def _get_feature_menu(self):
        """ Returns the 'Features' sub_menu.
        """
        enable_features_action.enabled = disable_features_action.enabled = False
        for feature in features:
            if feature.feature_name != '':
                if feature.state == 1:
                    disable_features_action.enabled = True
                    if enable_features_action.enabled:
                        break
                else:
                    enable_features_action.enabled = True
                    if disable_features_action.enabled:
                        break

        actions = []
        for feature in features:
            if feature.feature_name != '':
                actions.append(
                    Action(name=feature.feature_name,
                           action='on_toggle_feature',
                           _feature=feature,
                           style='toggle',
                           checked=(feature.state == 1)))

        if len(actions) > 0:
            actions.sort(lambda l, r: cmp(l.name, r.name))
            actions[0:0] = [Separator()]

        return Menu(name='Features',
                    *([enable_features_action, disable_features_action] +
                      actions))
예제 #7
0
    def _menu_default(self):
        """ Standard menus for network nodes """

        menu_actions = [Separator(), \
                        self._OpenFile]

        return Menu(*menu_actions)
 def _menu_default(self):
     """ Standard menus for network nodes """
     
     menu_actions = []
     
     
     return Menu( *menu_actions)
예제 #9
0
 def default_traits_view(self):
     """ Returns the default view to use for this class.
     """
     # NOTE: I moved the view to this method so we can declare a handler
     # for the view. Alternatively, we could move the DemoController class
     # to the top and declare view=Instance(HasTraits) instead.
     traits_view = View(
         Item(
             'plot',
             editor=ComponentEditor(),
             show_label=False,
         ),
         menubar=MenuBar(
             Menu(
                 Action(name="Save Plot",
                        action="save"),  # see Controller for
                 Action(name="Load Plot", action="load"),  # these callbacks
                 Separator(),
                 CloseAction,
                 name="File",
             ), ),
         width=600,
         height=600,
         resizable=True,
         handler=DemoController)
     return traits_view
예제 #10
0
    def _get_feature_menu(self):
        """ Returns the 'Features' sub_menu.
        """
        enable_features_action.enabled = (
            disable_features_action.enabled) = False
        for feature in features:
            if feature.feature_name != "":
                if feature.state == 1:
                    disable_features_action.enabled = True
                    if enable_features_action.enabled:
                        break
                else:
                    enable_features_action.enabled = True
                    if disable_features_action.enabled:
                        break

        actions = []
        for feature in features:
            if feature.feature_name != "":
                actions.append(
                    Action(
                        name=feature.feature_name,
                        action="on_toggle_feature",
                        _feature=feature,
                        style="toggle",
                        checked=(feature.state == 1),
                    ))

        if len(actions) > 0:
            actions.sort(key=attrgetter("name"))
            actions[0:0] = [Separator()]

        return Menu(name="Features",
                    *([enable_features_action, disable_features_action] +
                      actions))
class AffectsAverageColumn(ObjectColumn):

    # Define the context menu for the column:
    menu = Menu(Action(name='Add', action='column.add(object)'),
                Action(name='Sub', action='column.sub(object)'))

    # Right-align numeric values (override):
    horizontal_alignment = 'center'

    # Column width (override):
    width = 0.09

    # Don't allow the data to be edited directly:
    editable = False

    # Action methods for the context menu items:

    def add(self, object):
        """ Increment the affected player statistic.
        """
        setattr(object, self.name, getattr(object, self.name) + 1)

    def sub(self, object):
        """ Decrement the affected player statistic.
        """
        setattr(object, self.name, getattr(object, self.name) - 1)
예제 #12
0
    def default_traits_view(self):
        menu = Menu(Action(name='Refresh', action='editor.update_editor'),
                    Action(name='Expand all', action='editor.expand_all'))
        self.menu = menu

        nodes = self.tree_generator.get_nodes(menu)

        self.tree_editor = TreeEditor(nodes=nodes,
                                      editable=False,
                                      orientation='vertical',
                                      hide_root=True,
                                      on_select=self._on_select,
                                      on_dclick=self._on_dclick)
        view = View(Group(
            VSplit(Item(name='_root', editor=self.tree_editor, resizable=True),
                   Item(name='selected', style='custom', resizable=True),
                   show_labels=False,
                   show_border=False)),
                    title='Pipeline browser',
                    help=False,
                    resizable=True,
                    undo=False,
                    revert=False,
                    width=.3,
                    height=.3)
        return view
예제 #13
0
class MainUi(HasTraits):

    traits_view = View(
        resizable=True,
        width=600,
        height=400,
        menubar=MenuBar(Menu(CloseAction, name='&File'), ),
    )
예제 #14
0
    def _menu_default(self):
        """ Standard menus for network nodes """

        menu_actions = [Separator(), \
                        self._TracksRender, \
                        self._TrackVisLaunchAction]

        return Menu(*menu_actions)
예제 #15
0
 def __menu_default(self):
     extras = []
     if self.menu_helper is not None:
         extras = self.menu_helper.actions + self._extra_menu_items()
     menu_actions = [Separator()] + extras + \
                    [Separator(), self._HideShowAction, Separator()] + \
                    deepcopy(standard_menu_actions)
     return Menu(*menu_actions)
예제 #16
0
 def get_menu(self):
     """ Returns the right-click context menu for an object.
     """
     return Menu(
         *
         [Action(
             name='Create Data',
             action='node.adapter.append_child',
         )])
 def get_menu(self, object, trait, row, column):
     column_name = self.column_map[column]
     if column_name not in ['name', 'average']:
         menu = Menu(
             Action(name='Add', action='editor.adapter.add(item, column)'),
             Action(name='Sub', action='editor.adapter.sub(item, column)'))
         return menu
     else:
         return super(PlayerAdapter, self).get_menu(object, trait, row,
                                                    column)
    def get_menu(self):
        # See TreeEditor on_context_menu code to understand the context the
        # actions are evaluated in.

        # FIXME The order of actions in the drop down are not easily controlled
        # When the order can be controlled, it should be set per comments
        # on PR#586.
        actions = self._standard_menu_actions()
        actions.extend(self._non_standard_menu_actions())
        return Menu(*actions)
예제 #19
0
    def pop_connection_menu(self, connects, new_connections, old_connections):
        """ Displays the pop-up connection menu for a specified set of
            connections.
        """

        # Create the list for holding the main menu actions:
        actions = []

        # Create the 'connect' submenus:
        if len(connects) > 0:
            names = connects.keys()
            if len(names) == 1:
                sub_menus = self.connect_actions(connects[names[0]])
            else:
                names.sort()
                sub_menus = []
                for name in names:
                    items = connects[name]
                    sub_menus.append(
                        Menu(name=items[0][0], *self.connect_actions(items)))
            actions.append(Menu(name='Connect', *sub_menus))

        # Create the 'disconnect' submenus:
        disconnects = []
        n = len(old_connections)
        if n > 0:
            names = old_connections.keys()
            if n == 1:
                sub_menus = self.disconnect_actions(old_connections[names[0]])
            else:
                names.sort()
                sub_menus = []
                for name in names:
                    sub_menus.append(
                        Menu(name=name,
                             *self.disconnect_actions(old_connections[name])))
            actions.append(Menu(name='Disconnect', *sub_menus))

        # Display the pop-up menu:
        self._new_connections = new_connections
        self.popup_menu(Menu(name='popup', *actions))
        self._new_connections = None
예제 #20
0
def _create_menubar_actions():
    desc = (('&File', ( {"name": "open_trace_file","tooltip":'open new file into pytimechart'},
                        {"name": "exit","tooltip":'exit pytimechart'})),
            ('&Help', ( {"name": "about","tooltip":'about'},{"name": "doc","tooltip":'doc'})))
    ret = []
    for menu in desc:
        actions = []
        for action in menu[1]:
            actions.append(_buildAction(action))
        ret.append(Menu(*tuple(actions), name = menu[0]))
    return tuple(ret)
예제 #21
0
    def populate_rightclick_menu(self, info):
        """
        Populate right-click menu to add Program Steps to another Program and
        to assign Programs to Wells.

        Called from the main application handler.
        """
        add_steps_items = []
        for program in sorted(info.object.programs, key=lambda prg: prg.name):
            add_steps_items.append(
                Action(name=program.name,
                       action="handler.add_to(info, to_program=%d)" %
                       program.ID))

        led_assign_items = []
        led_bulk_assign_items = []
        for i, led_type in enumerate(self.app.plate.led_types):
            led_assign_items.append(
                Action(name=led_type.name,
                       action='handler.assign_to(info, to_led=%d)' % i,
                       enabled_when='handler.allow_well_assign(info)'))
            led_bulk_assign_items.append(
                Action(name=led_type.name,
                       action='handler.bulk_assign(info, to_led=%d)' % i,
                       enabled_when='handler.allow_bulk_assign(info)'))
        for column in info.programs.columns:
            column.menu = Menu(
                Action(name='New Program', action='info.object.new_program()'),
                Action(name='Delete Selected',
                       action='handler.object_delete_changed(info)'),
                Action(name='Duplicate Selected',
                       action='handler.object_duplicate_changed(info)'),
                Action(name='Create dark Step with program duration',
                       action='handler.dark_step(info)'),
                Menu(*add_steps_items, name='Add program steps to ...'),
                Menu(*led_assign_items,
                     name='Assign Program to selected wells ...'),
                Menu(*led_bulk_assign_items,
                     name='Bulk assign selected Programs to selected wells ...'
                     ))
예제 #22
0
 def _get_layout_menus(self):
     """ Gets the sub-menus for the 'Restore layout' and 'Delete layout' menu
         options.
     """
     names = self._get_layout_names()
     if len(names) == 0:
         restore_actions = [Action(name="<empty>", enabled=False)]
         delete_actions = [Action(name="<empty>", enabled=False)]
     else:
         names.sort()
         restore_actions = [
             Action(name=name,
                    action="self.on_restore_layout(%s)" % repr(name))
             for name in names
         ]
         delete_actions = [
             Action(name=name,
                    action="self.on_delete_layout(%s)" % repr(name))
             for name in names
         ]
     return [
         Menu(name="Restore Layout", *restore_actions),
         Menu(name="Delete Layout", *delete_actions),
     ]
예제 #23
0
class ModelView(HasTraits):

    model = Instance(Model)
    view = Instance(PlotUI)
    traits_view = View(Item('@view', show_label=False),
                       menubar=MenuBar(
                           Menu(Action(name="Edit Model", action="edit_model"),
                                Action(name="Edit Plot", action="edit_plot"),
                                CloseAction,
                                name="File")),
                       handler=Controller,
                       title="Function Inspector",
                       resizable=True)

    @on_trait_change('model, view')
    def update_view(self):
        if self.model is not None and self.view is not None:
            self.view.update(self.model)
예제 #24
0
class DialogWithToolbar(HasTraits):
    """Test dialog with toolbar and menu."""

    action_successful = Bool(False)

    def test_clicked(self):
        self.action_successful = True

    menubar = MenuBar(Menu(ActionGroup(TestAction), name='&Test menu'), )

    toolbar = ToolBar(ActionGroup(TestAction), )

    traits_view = View(
        Item(label="Click the button on the toolbar or the menu item.\n"
             "The 'Action successful' element should turn to True."),
        Item('action_successful', style='readonly'),
        menubar=menubar,
        toolbar=toolbar,
        buttons=['OK'])
예제 #25
0
class DialogWithToolbar(HasTraits):
    """Test dialog with toolbar and menu."""

    action_successful = Bool(False)

    def test_clicked(self):
        print("perform action")
        self.action_successful = True

    menubar = MenuBar(Menu(ActionGroup(TestAction), name="&Test menu"))

    toolbar = ToolBar(ActionGroup(TestAction))

    traits_view = View(
        Item(label="Click the button on the toolbar or the menu item.\n"
             "The 'Action successful' element should turn to True."),
        Item("action_successful", style="readonly"),
        menubar=menubar,
        toolbar=toolbar,
        buttons=[TestAction, "OK"],
    )
예제 #26
0
파일: browser.py 프로젝트: zyex1108/mayavi
    def __init__(self, renwin=None, **traits):
        """Initializes the object.

        Parameters
        ----------

        - renwin: `Scene` instance.  Defaults to None.

          This may be passed in addition to the renwins attribute
          which can be a list of scenes.

        """
        super(PipelineBrowser, self).__init__(**traits)
        self.ui = None
        self.view = None
        if renwin:
            self.renwins.append(renwin)

        self._root_object_changed(self.root_object)
        menu = Menu(Action(name='Refresh', action='editor.update_editor'),
                    Action(name='Expand all', action='editor.expand_all'))
        self.menu = menu

        nodes = self.tree_generator.get_nodes(menu)

        self.tree_editor = TreeEditor(nodes=nodes,
                                      editable=False,
                                      orientation='vertical',
                                      hide_root=True,
                                      on_dclick=self._on_dclick)
        self.view = View(Group(Item(name='_root',
                                    editor=self.tree_editor,
                                    resizable=True),
                               show_labels=False,
                               show_border=False,
                               orientation='vertical'),
                         title='Pipeline browser',
                         help=False,
                         resizable=True, undo=False, revert=False,
                         width=.3, height=.3)
예제 #27
0
          add=[Department]),
 TreeNode(node_for=[Company],
          auto_open=True,
          children='employees',
          label='=Employees',
          view=no_view,
          add=[Employee]),
 TreeNode(node_for=[Department],
          auto_open=True,
          children='employees',
          label='name',
          menu=Menu(NewAction,
                    Separator(),
                    DeleteAction,
                    Separator(),
                    RenameAction,
                    Separator(),
                    CopyAction,
                    CutAction,
                    PasteAction),
          view=View(['name', '|<']),
          add=[Employee]),
 TreeNode(node_for=[Employee],
          auto_open=True,
          label='name',
          menu=Menu(NewAction,
                    Separator(),
                    Action(name='Default title',
                           action='object.default_title'),
                    Action(name='Department',
                           action='handler.employee_department(editor,object)'),
예제 #28
0
class MFnPolar(HasTraits):

    numpoints = Int(80)
    low = Float(0.)
    high = Float(2 * pi)
    # arguments to configure the Polar function to be plotted
    alpha = Range(0., pi, 0., auto_set=False)
    delta_alpha = Range(0., pi / 2, 0., auto_set=False)
    delta_trans = Range(0., pi, 0., auto_set=False)
    phi_residual = Float(0.65)
    phi_quasibrittle = Float(-0.25)
    strech_residual = Range(0., 1, 0., auto_set=False)
    strech_quasibrittle = Range(0., 1, 0., auto_set=False)
    # arguments to configure the plot
    plotrange_min = Float(0., desc='lower bound of the plot range')
    plotrange_max = Float(1., desc='upper bound of the plot range')
    frac_noplot = Range(0.,
                        1,
                        0.3,
                        desc='fraction of the \
    plot-circle that is not used for display of plot values ',
                        auto_set=False)
    # @todo: put this into the status bar
    info = Str('')

    theta = Array

    def _theta_default(self):
        theta_arr = arange(self.low, self.high,
                           (self.high - self.low) / self.numpoints)
        # add theta=0 to the end of theta-array
        theta_zero = array([0])
        return hstack([theta_arr, theta_zero])

    # function to be plotted (returns radius_value for a given theta_value)
    def radius_fn(self, theta, alpha, delta_alpha, delta_trans,
                  strech_residual, strech_quasibrittle, phi_residual,
                  phi_quasibrittle):
        # 1st quadrant
        if ((theta - alpha) >= 0. and (theta - alpha) <= (pi / 2)):
            theta_tilde = theta - alpha
        # 2nd quadrant
        elif ((theta - alpha) <= pi and (theta - alpha) >= pi / 2):
            theta_tilde = pi - (theta - alpha)
        # 3rd quadrant positive
        elif ((theta - alpha) >= pi and (theta - alpha) <= 3 * pi / 2):
            theta_tilde = theta - alpha - pi
        # 3rd quadrant negative
        elif ((theta - alpha) >= -pi and (theta - alpha) <= -pi / 2):
            theta_tilde = theta - alpha + pi
        # 4th quadrant positive
        elif ((theta - alpha) <= 2 * pi and (theta - alpha) >= 3 * pi / 2):
            theta_tilde = (2 * pi) - (theta - alpha)
        # 4th quadrant negative
        elif ((theta - alpha) <= 0. and (theta - alpha) >= -pi / 2):
            theta_tilde = -(theta - alpha)

        # Definition of function to be plotted in the range of 0 and Pi/2:
        _phi_residual = phi_residual + \
            (1 - phi_residual) * strech_residual
        _phi_quasibrittle = phi_quasibrittle + \
            (1 - phi_quasibrittle) * strech_quasibrittle

        # constant values with linear transition function:
        # (for delta_alpha = 0 the transition function is evaluated)
        if abs(theta_tilde) < delta_alpha:
            radius_fn = _phi_residual
        elif abs(theta_tilde) >= delta_alpha and \
                abs(theta_tilde) < delta_alpha + delta_trans:
            radius_fn = (_phi_residual -
                         ((theta_tilde - delta_alpha) *
                          (_phi_residual - _phi_quasibrittle) / (delta_trans)))
        else:
            radius_fn = _phi_quasibrittle
        return radius_fn

    radius = Property(Array,
                      depends_on='theta,alpha,delta_alpha,\
                                            delta_trans,frac_noplot,\
                                            strech_residual,\
                                            strech_quasibrittle,\
                                            phi_residual,phi_quasibrittle ')

    @cached_property
    def _get_radius(self):
        vradius_fn = frompyfunc(self.radius_fn, 8, 1)
        return array(vradius_fn(self.theta, self.alpha, self.delta_alpha,
                                self.delta_trans, self.strech_residual,
                                self.strech_quasibrittle, self.phi_residual,
                                self.phi_quasibrittle),
                     dtype='float_')

    def __call__(self, theta_value):
        # return a single value for the specified theta_value
        radius_value = self.radius_fn(theta_value, self.alpha,
                                      self.delta_alpha, self.delta_trans,
                                      self.strech_residual,
                                      self.strech_quasibrittle,
                                      self.phi_residual, self.phi_quasibrittle)
        return radius_value

    plot_type = Enum('polar')

    #     radiusplot = MFnPolarPlotItem("theta", ["radius", "plotrange_min",
    #                                             "plotrange_max", "frac_noplot"],
    #                                   type_trait="plot_type",
    #
    #                                   # Basic axis and label properties
    #                                   #                                  show_label=False,
    #                                   resizable=False,
    #                                   width=260,
    #                                   height=260,
    #
    #                                   # Plot properties
    #                                   color="green",
    #                                   bgcolor="lightyellow",
    #
    #                                   # Border, padding properties
    #                                   border_visible=True,
    #                                   show_label=False,
    #                                   border_width=1)

    radius_min = Property(Float,
                          depends_on='current_theta,alpha,delta_alpha,\
                                                delta_trans,strech_residual,\
                                                strech_quasibrittle')

    @cached_property
    def _get_radius_min(self):
        r_min = self.radius.min()
        return r_min

    radius_max = Property(Float,
                          depends_on='current_theta,alpha,delta_alpha,\
                                                delta_trans,strech_residual,\
                                                strech_quasibrittle')

    @cached_property
    def _get_radius_max(self):
        r_max = self.radius.max()
        return r_max

    info = Property(Float,
                    depends_on='current_theta,alpha,delta_alpha,\
                                          delta_trans,strech_residual,\
                                          strech_quasibrittle, plotrange_min, \
                                          plotrange_max')

    @cached_property
    # check for plausibility and return an information or an error message
    def _get_info(self):
        if self.plotrange_min >= self.plotrange_max:
            info = '### Error ###: invalid plot ranges. \
                    plotrange_max must be greater than plotrange_min.'

        elif not (self.plotrange_min <= self.radius_min
                  and self.radius_max <= self.plotrange_max):
            info = '# Note #: Some value of the function are out of \
                    the specified plot ranges!'

        else:
            info = '(valid plot ranges)'
        return info

    current_theta = Float(0.0)

    current_radius = Property(Float,
                              depends_on='current_theta,alpha,\
                                                    delta_alpha,delta_trans,\
                                                    strech_residual,\
                                                    strech_quasibrittle')

    @cached_property
    def _get_current_radius(self):
        return self.__call__(self.current_theta)

    traits_view = View(
        VGroup(
            Group(Item("alpha"),
                  Item("delta_alpha"),
                  Item("delta_trans"),
                  HGroup(
                      Spring(),
                      Item("phi_residual", resizable=False),
                      Spring(),
                      Item("phi_quasibrittle", resizable=False),
                      Spring(),
                  ),
                  Item("strech_residual"),
                  Item("strech_quasibrittle"),
                  show_border=True,
                  label='Function parameters'),
            HGroup(
                Group(
                    Item("plotrange_min"),
                    Item("plotrange_max"),
                    Item("frac_noplot"),
                    Item('current_theta'),
                    Item('current_radius', style='readonly'),
                    Item('radius_min', style='readonly'),
                    Item('radius_max', style='readonly'),
                    #Item('info', style = 'readonly' ),
                    springy=True,
                    show_border=True,
                    label='Plot parameters'),
                #                radiusplot
            ),
        ),
        buttons=[OKButton, CancelButton],
        menubar=MenuBar(
            Menu(Action(name="O&pen..", action="open_data"),
                 Action(name="S&ave..", action="save_file"),
                 Action(name="E&xit", action="exit_file"),
                 name='File')),
        handler=MFnWTHandler,
        resizable=True,
        scrollable=True,
        width=700,
        height=800)
예제 #29
0
           add       = [ Department ] ),
 TreeNode( node_for  = [ Company ],
           auto_open = True,
           children  = 'employees',
           label     = '=Employees',
           view      = no_view,
           add       = [ Employee ] ),
 TreeNode( node_for  = [ Department ],
           auto_open = True,
           children  = 'employees',
           label     = 'name',
           menu      = Menu( NewAction,
                             Separator(),
                             DeleteAction,
                             Separator(),
                             RenameAction,
                             Separator(),
                             CopyAction,
                             CutAction,
                             PasteAction ),
           view      = View( Group ('name',
                            orientation='vertical',
                            show_left=True )),
           add       = [ Employee ] ),
 TreeNode( node_for  = [ Employee ],
           auto_open = True,
           label     = 'name',
           menu=Menu( NewAction,
                      Separator(),
                      def_title_action,
                      dept_action,
예제 #30
0
 def _actions_default(self):
     module_actions = self._build_module_actions()
     return [Menu(name='Add Module', *module_actions)]