本文整理汇总了Python中matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg.get_window_title方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasGTKAgg.get_window_title方法的具体用法?Python FigureCanvasGTKAgg.get_window_title怎么用?Python FigureCanvasGTKAgg.get_window_title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg
的用法示例。
在下文中一共展示了FigureCanvasGTKAgg.get_window_title方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import get_window_title [as 别名]
def __init__(self, parent):
self.db = parent.db
parent_window = parent._main_window
self.view_star = parent.view_star # LEMONJuicerGUI.view_star()
self.toggle_toolbar_button = parent.set_finding_chart_button_active
self.builder = gtk.Builder()
self.builder.add_from_file(glade.FINDING_CHART_DIALOG)
self.dialog = self.builder.get_object('finding-chart-dialog')
self.dialog.set_resizable(True)
self.dialog.set_title("Finding Chart: %s" % self.db.field_name)
# gtk.RESPONSE_PREFERENCES doesn't exist: use gtk.RESPONSE_OK
self.dialog.add_button(gtk.STOCK_PREFERENCES, gtk.RESPONSE_OK)
self.dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
self.dialog.set_default_response(gtk.RESPONSE_CLOSE)
# Connect to the accelerators of the parent window
self.dialog.add_accel_group(parent.global_accelators)
# This private variable stores whether the gtk.Dialog is currently
# visible or not. It is update to True and False when the show() and
# hide() methods are called, respectively.
self._currently_shown = False
# The matplotlib figure...
matplotlib_container = self.builder.get_object('matplotlib-container')
self.image_box = self.builder.get_object('image-container-box')
self.figure = matplotlib.figure.Figure()
canvas = FigureCanvas(self.figure)
self.image_box.pack_start(canvas)
# ... and the navigation toolbar
self.navigation_box = self.builder.get_object('navigation-toolbar-box')
self.navig = NavigationToolbar(canvas, self.image_box.get_window())
self.navigation_box.pack_start(self.navig)
matplotlib_container.show_all()
# Use the field name as the suggested filename of the FileChooserDialog
# when the user clicks on the 'Save' button on the navigation toolbar.
# See the docstring of app.StarDetailsGUI.update_file_selector_name()
# for an explanation on why we are monkey-patching this method.
canvas.get_window_title = lambda: self.db.field_name
self.dialog.set_transient_for(parent_window)
self.dialog.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
ax1 = self.figure.add_subplot(111)
ax1.get_xaxis().set_visible(False)
ax1.get_yaxis().set_visible(False)
# Temporarily save to disk the FITS file used as a reference frame
path = self.db.mosaic
atexit.register(methods.clean_tmp_files, path)
self.wcs = astropy.wcs.WCS(path)
with pyfits.open(path) as hdu:
data = hdu[0].data
# Ignore any NaN pixels
self.data_min = numpy.nanmin(data)
self.data_max = numpy.nanmax(data)
self.aplpy_plot = aplpy.FITSFigure(path, figure = self.figure)
self.figure.canvas.mpl_connect('button_press_event', self.mark_closest_star)
self.aplpy_plot.show_grayscale()
self.aplpy_plot.add_grid()
self.aplpy_plot.grid.set_alpha(0.2)
# Create a PreferencesDialog object, whose __init__() method reads Vmin
# and Vmax from the LEMONdB or, in case these values are not stored in
# the database, uses the values computed by FITSFigure.show_grayscale()
# and stored in the APLpyNormalize object. After the PreferencesDialog
# is created we can call its normalize_plot() method for the first time
# in order to apply the normalization parameters to the finding chart.
#
# Note: we must create the PreferencesDialog *after* show_grayscale()
# has been called, because until then the underlying APLpyNormalize
# object (i.e., aplpy.FITSFigure.image.norm) does not exist, and the
# __init__() method of the PreferencesDialog class needs to access to
# it if the values of Vmin and Vmax cannot be read from the LEMONdB.
assert hasattr(self.aplpy_plot.image, 'norm')
self.preferences_dialog = PreferencesDialog(self)
self.preferences_dialog.normalize_plot()
# The dialog has always the same width; the height is adjusted
# proportionally depending on the dimensions of the FITS image.
size = data.shape[::-1]
size_ratio = size[1] / size[0]
new_size = self.WIDTH, int(self.WIDTH * size_ratio)
self.dialog.resize(*new_size)
# We cannot run() the dialog because it blocks in a recursive main
# loop, while we want it to be non-modal. Therefore, we need to show()
# it. But this means that we cannot get the response ID directly from
# run(), so we have to connect to the dialog 'response' event.
self.dialog.connect('response', self.handle_response)
# Don't destroy the gtk.Dialog if we click on the window's close button
#.........这里部分代码省略.........