Пример #1
0
 def init_plot_defaults(self):
     super(BasicImgPlotWindowController, self).init_plot_defaults()
     cfg = mainmodel.get_config()
     if cfg.has_option("ImgPlot", "colormap"):
         self.colormap = self.model.get_cmap(cfg.get("ImgPlot", "colormap"))
     else:
         self.colormap = self.model.get_cmap('Spectral')
Пример #2
0
 def init_plot_defaults(self):
     super(BasicImgPlotWindowController, self).init_plot_defaults()
     cfg = mainmodel.get_config()
     if cfg.has_option("ImgPlot", "colormap"):
         self.colormap = self.model.get_cmap(cfg.get("ImgPlot", "colormap"))
     else:
         self.colormap = self.model.get_cmap('Spectral')
Пример #3
0
 def test_get_config(self):
     """Verify returning the application's configuration"""
     expected_configuration = config.Configure(pathfinder.config_path()).config
     expected_configuration.read(pathfinder.config_path())
     returned_configuration = model.get_config().config
     returned_configuration.read(pathfinder.config_path())
     for section in expected_configuration.sections():
         self.assertListEqual(expected_configuration.items(section), returned_configuration.items(section))
Пример #4
0
 def init_plot_defaults(self):
     """Initializes the defaults for the Megaplot presentation."""
     super(MegaPlotWindowController, self).init_plot_defaults()
     cfg = mainmodel.get_config()
     if cfg.has_option("MegaPlot", "conventional bscans"):
         self.conventional_bscans = cfg.get_boolean("MegaPlot", "conventional bscans")
     else:
         self.conventional_bscans = False
     self.use_colorbar = self.get_colorbar_config()
Пример #5
0
 def init_plot_defaults(self):
     """Initializes the defaults for the Megaplot presentation."""
     super(MegaPlotWindowController, self).init_plot_defaults()
     cfg = mainmodel.get_config()
     if cfg.has_option("MegaPlot", "conventional bscans"):
         self.conventional_bscans = cfg.get_boolean("MegaPlot",
                                                    "conventional bscans")
     else:
         self.conventional_bscans = False
     self.use_colorbar = self.get_colorbar_config()
Пример #6
0
 def user_path(self):
     """Returns the currently-configured user path"""
     cfg = get_config()
     upath_key = "User Path"
     if cfg.has_app_option(upath_key):
         return cfg.get_app_option(upath_key)
     else:
         default_upath = os.path.normcase(os.path.join(os.path.expanduser('~'), 'nditoolbox'))
         cfg.set_app_option({upath_key: default_upath})
         return default_upath
Пример #7
0
 def log_path(self):
     """Returns the path to the log file.  If not already set,
     sets to user's home directory/nditoolbox.log and sets the default in the config file."""
     _config = get_config()
     logpath_key = "Log File"
     if _config.has_app_option(logpath_key):
         return _config.get_app_option(logpath_key)
     else:
         default_logpath = os.path.normcase(os.path.join(os.path.expanduser('~'), 'nditoolbox.log'))
         _config.set_app_option({logpath_key: default_logpath})
         return default_logpath
Пример #8
0
 def user_path(self):
     """Returns the currently-configured user path"""
     cfg = get_config()
     upath_key = "User Path"
     if cfg.has_app_option(upath_key):
         return cfg.get_app_option(upath_key)
     else:
         default_upath = os.path.normcase(
             os.path.join(os.path.expanduser('~'), 'nditoolbox'))
         cfg.set_app_option({upath_key: default_upath})
         return default_upath
Пример #9
0
 def log_path(self):
     """Returns the path to the log file.  If not already set,
     sets to user's home directory/nditoolbox.log and sets the default in the config file."""
     _config = get_config()
     logpath_key = "Log File"
     if _config.has_app_option(logpath_key):
         return _config.get_app_option(logpath_key)
     else:
         default_logpath = os.path.normcase(
             os.path.join(os.path.expanduser('~'), 'nditoolbox.log'))
         _config.set_app_option({logpath_key: default_logpath})
         return default_logpath
Пример #10
0
 def on_select_cmap(self, evt):
     """Generates a list of available matplotlib colormaps and sets the plot's
     colormap to the user's choice."""
     colormaps = self.model.get_colormap_choices()
     cmap_dlg = wx.lib.dialogs.singleChoiceDialog(self.view, "Select Colormap",
                                                  "Please select a colormap for this plot.",
                                                  colormaps)
     if cmap_dlg.accepted is True:
         cfg = mainmodel.get_config()
         colormap = cmap_dlg.selection
         if colormap == '':
             self.colormap = self.model.get_cmap('Spectral')
             cfg.set("ImgPlot", {"colormap":"spectral"})
         else:
             self.colormap = self.model.get_cmap(colormap)
             cfg.set("ImgPlot", {"colormap":colormap})
         if self.view.cscan_img is not None:
             self.view.cscan_img.set_cmap(self.colormap)
             self.update_plot()
Пример #11
0
 def on_select_cmap(self, evt):
     """Generates a list of available matplotlib colormaps and sets the plot's
     colormap to the user's choice."""
     colormaps = self.model.get_colormap_choices()
     cmap_dlg = wx.lib.dialogs.singleChoiceDialog(
         self.view.parent, "Select Colormap",
         "Please select a colormap for this plot.", colormaps)
     if cmap_dlg.accepted is True:
         cfg = mainmodel.get_config()
         colormap = cmap_dlg.selection
         if colormap == '':
             self.colormap = self.model.get_cmap('Spectral')
             cfg.set("ImgPlot", {"colormap": "spectral"})
         else:
             self.colormap = self.model.get_cmap(colormap)
             cfg.set("ImgPlot", {"colormap": colormap})
         if self.view.img is not None:
             self.view.img.set_cmap(self.colormap)
             self.refresh_plot()
Пример #12
0
 def on_change_bscans(self, evt):
     """Toggles using conventional Bscan imgplots or 1D cross-sections through the current Cscan"""
     self.conventional_bscans = self.view.plot_conventional_bscans
     cfg = mainmodel.get_config()
     cfg.set("MegaPlot", {"conventional bscans": self.conventional_bscans})
     self.update_plot()
Пример #13
0
 def set_navtools_config(self, navtools_enabled):
     """Sets the enable navtools option in the config"""
     cfg = mainmodel.get_config()
     cfg.set("MegaPlot", {"enable navtools": navtools_enabled})
Пример #14
0
 def on_change_bscans(self, evt):
     """Toggles using conventional Bscan imgplots or 1D cross-sections through the current Cscan"""
     self.conventional_bscans = self.view.plot_conventional_bscans
     cfg = mainmodel.get_config()
     cfg.set("MegaPlot", {"conventional bscans":self.conventional_bscans})
     self.update_plot()
Пример #15
0
 def set_colorbar_config(self, colorbar_enabled):
     """Sets the enable colorbar option in the config"""
     cfg = mainmodel.get_config()
     cfg.set("MegaPlot", {"show_colorbar":colorbar_enabled})
     self.use_colorbar = colorbar_enabled
Пример #16
0
 def get_colorbar_config(self):
     """Returns the enable colorbar setting from config."""
     cfg = mainmodel.get_config()
     if cfg.has_option("MegaPlot", "show_colorbar"):
         return cfg.get_boolean("MegaPlot", "show_colorbar")
     return False
Пример #17
0
 def get_navtools_config(self):
     """Returns the enable navtools setting from config."""
     cfg = mainmodel.get_config()
     if cfg.has_option("MegaPlot", "enable navtools"):
         return cfg.get_boolean("MegaPlot", "enable navtools")
     return True
Пример #18
0
 def set_navtools_config(self, navtools_enabled):
     """Sets the enable navtools option in the config"""
     cfg = mainmodel.get_config()
     cfg.set("MegaPlot", {"enable navtools":navtools_enabled})
Пример #19
0
 def get_navtools_config(self):
     """Returns the enable navtools setting from config."""
     cfg = mainmodel.get_config()
     if cfg.has_option("MegaPlot", "enable navtools"):
         return cfg.get_boolean("MegaPlot", "enable navtools")
     return True
Пример #20
0
 def set_colorbar_config(self, colorbar_enabled):
     """Sets the enable colorbar option in the config"""
     cfg = mainmodel.get_config()
     cfg.set("MegaPlot", {"show_colorbar": colorbar_enabled})
     self.use_colorbar = colorbar_enabled
Пример #21
0
 def get_colorbar_config(self):
     """Returns the enable colorbar setting from config."""
     cfg = mainmodel.get_config()
     if cfg.has_option("MegaPlot", "show_colorbar"):
         return cfg.get_boolean("MegaPlot", "show_colorbar")
     return False