"Fossies" - the Fresh Open Source Software Archive

Member "relax-5.0.0/gui/icons.py" (2 Dec 2019, 2828 Bytes) of package /linux/privat/relax-5.0.0.src.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "icons.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 4.1.3_vs_5.0.0.

    1 ###############################################################################
    2 #                                                                             #
    3 # Copyright (C) 2011,2019 Edward d'Auvergne                                   #
    4 #                                                                             #
    5 # This file is part of the program relax (http://www.nmr-relax.com).          #
    6 #                                                                             #
    7 # This program is free software: you can redistribute it and/or modify        #
    8 # it under the terms of the GNU General Public License as published by        #
    9 # the Free Software Foundation, either version 3 of the License, or           #
   10 # (at your option) any later version.                                         #
   11 #                                                                             #
   12 # This program is distributed in the hope that it will be useful,             #
   13 # but WITHOUT ANY WARRANTY; without even the implied warranty of              #
   14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
   15 # GNU General Public License for more details.                                #
   16 #                                                                             #
   17 # You should have received a copy of the GNU General Public License           #
   18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
   19 #                                                                             #
   20 ###############################################################################
   21 
   22 # Module docstring.
   23 """All of the icons for relax."""
   24 
   25 # Python module imports.
   26 from os import sep
   27 import sys
   28 import wx
   29 
   30 # relax module imports.
   31 import dep_check
   32 from status import Status; status = Status()
   33 
   34 
   35 class Relax_icons(wx.IconBundle):
   36     """The icon bundle singleton class of the main relax icons."""
   37 
   38     # Class variable for storing the class instance (for the singleton).
   39     _instance = None
   40 
   41     def __new__(self, *args, **kargs):
   42         """Replacement method for implementing the singleton design pattern."""
   43 
   44         # First instantiation.
   45         if self._instance is None:
   46             # Instantiate.
   47             self._instance = wx.IconBundle.__new__(self, *args, **kargs)
   48 
   49         # Already instantiated, so return the instance.
   50         return self._instance
   51 
   52 
   53     def setup(self):
   54         """Set up the icons after the main app is created."""
   55 
   56         # This is disabled on Macs.
   57         if not 'darwin' in sys.platform:
   58             if dep_check.wx_classic:
   59                 self.AddIconFromFile(status.install_path + sep + 'graphics' + sep + 'ulysses.ico', wx.BITMAP_TYPE_ANY)
   60             else:
   61                 self.AddIcon(status.install_path + sep + 'graphics' + sep + 'ulysses.ico', wx.BITMAP_TYPE_ANY)