source: sasview/src/sas/sasgui/perspectives/file_converter/file_converter.py @ 367a31c

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalcmagnetic_scattrelease-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 367a31c was 463e7ffc, checked in by Ricardo Ferraz Leal <ricleal@…>, 8 years ago

getLogger with module name

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[77d92cd]1"""
2File Converter Plugin
3"""
4
5import logging
6from sas.sasgui.guiframe.plugin_base import PluginBase
7from sas.sasgui.perspectives.file_converter.converter_panel import ConverterWindow
8
[463e7ffc]9logger = logging.getLogger(__name__)
[c155a16]10
[77d92cd]11class Plugin(PluginBase):
[ba65aff]12    """
13    This class defines the interface for a Plugin class
14    for File Converter perspective
15    """
[77d92cd]16
17    def __init__(self):
18        PluginBase.__init__(self, name="File Converter")
[c155a16]19        logger.info("File Converter plug-in started")
[77d92cd]20        self._sub_menu = "Tool"
21        self.converter_frame = None
22
23    def get_tools(self):
24        """
25        Returns a set of menu entries
26        """
27        help_txt = "Convert single column ASCII data to CanSAS format"
28        return [("File Converter", help_txt, self.on_file_converter)]
29
30    def on_file_converter(self, event):
31        if self.converter_frame is None:
32            frame = ConverterWindow(parent=self.parent, base=self.parent,
33                manager=self)
34            self.put_icon(frame)
35            self.converter_frame = frame
36        else:
37            self.converter_frame.Show(False)
38        self.converter_frame.Show(True)
39
40    def put_icon(self, frame):
41        """
42        Put icon in the frame title bar
43        """
44        if hasattr(frame, "IsIconized"):
45            if not frame.IsIconized():
46                try:
47                    icon = self.parent.GetIcon()
48                    frame.SetIcon(icon)
49                except:
50                    pass
Note: See TracBrowser for help on using the repository browser.