當前位置: 首頁>>代碼示例>>Python>>正文


Python NavigationToolbar2GTKAgg.set_name方法代碼示例

本文整理匯總了Python中matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg.set_name方法的典型用法代碼示例。如果您正苦於以下問題:Python NavigationToolbar2GTKAgg.set_name方法的具體用法?Python NavigationToolbar2GTKAgg.set_name怎麽用?Python NavigationToolbar2GTKAgg.set_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg的用法示例。


在下文中一共展示了NavigationToolbar2GTKAgg.set_name方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: AppView

# 需要導入模塊: from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg [as 別名]
# 或者: from matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg import set_name [as 別名]
class AppView(BaseView, HasChildView, FormattedTitleView):
    """
        The main application interface view.
        
        Attributes:
            project: the project view
            specimen: the specimen view
            markers: the markers view
            phases: the phases view
            atom_types: the atom_types view
            statistics: the statistics view
            mixtures: the mixtures view
            
        
    """
    builder = resource_filename(__name__, "glade/application.glade")
    top = "main_window"
    title_format = "PyXRD - %s"

    child_views = {
        "project": ProjectView,
        "specimen": SpecimenView,
        "markers": EditMarkersView, # FIXME this should be part of the specimen view/controller code
        "phases": ObjectListStoreView,
        "atom_types": ObjectListStoreView,
        # ("statistics": ???
        "mixtures": ObjectListStoreView
    }

    widget_groups = {
        'full_mode_only': [
            "tbtn_edit_phases",
            "tbtn_edit_atom_types",
            "tbtn_edit_mixtures",
            "tbtn_separator1",
            "btn_sample",
            "separator3",
            "separator4",
            "separator5",
            "main_menu_item_edit_phases",
            "main_menu_item_edit_atom_types",
            "main_menu_item_edit_mixtures",
            "navtoolbar"
        ]
    }

    # ------------------------------------------------------------
    #      Initialisation and other internals
    # ------------------------------------------------------------
    def __init__(self, *args, **kwargs):
        super(AppView, self).__init__(*args, **kwargs)

        # Setup about window:
        def on_aboutbox_response(dialog, response, *args):
            if response < 0:
                dialog.hide()
                dialog.emit_stop_by_name('response')

        def on_aboutbox_close(widget, event=None):
            self["about_window"].hide()
            return gtk.TRUE

        self["about_window"].set_version(settings.VERSION)
        pixbuf = gtk.gdk.pixbuf_new_from_file(resource_filename(__name__, "icons/pyxrd.png")) # @UndefinedVariable
        scaled_buf = pixbuf.scale_simple(212, 160, gtk.gdk.INTERP_BILINEAR) # @UndefinedVariable
        self["about_window"].set_logo(scaled_buf)
        self["about_window"].connect("response", on_aboutbox_response)
        self["about_window"].connect("close", on_aboutbox_close)
        self["about_window"].connect("delete_event", on_aboutbox_close)

        self["main_window"].set_icon_list(*get_icon_list())

        # self.set_layout_modes()
        self.reset_all_views()
        if not settings.DEBUG:
            self.get_top_widget().maximize()

        self.get_top_widget().show()

        return

    def setup_plot(self, plot_controller):
        self.plot_controller = plot_controller
        self["matplotlib_box"].add(self.plot_controller.canvas)
        self["matplotlib_box"].show_all()
        self.nav_toolbar = NavigationToolbar(self.plot_controller.canvas, self.get_top_widget())
        self.nav_toolbar.set_name("navtoolbar")
        self["navtoolbar"] = self.nav_toolbar
        self["navtoolbar_box"].add(self.nav_toolbar)

    def reset_child_view(self, view_name, class_type=None):
        if getattr(self, view_name, None) is not None:
            getattr(self, view_name).hide()
            setattr(self, view_name, None)
        if class_type == None:
            class_type = self.child_views[view_name]
        view = class_type(parent=self)
        setattr(self, view_name, view)
        view.set_layout_mode(self.current_layout_state)

#.........這裏部分代碼省略.........
開發者ID:claudioquaglia,項目名稱:PyXRD,代碼行數:103,代碼來源:views.py


注:本文中的matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg.set_name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。