コード例 #1
0
    def _splash_screen_default(self):
        """ Trait initializer. """

        splash_screen = SplashScreen(image=ImageResource('splash'),
                                     show_log_messages=True,
                                     log_level=DEBUG)

        return splash_screen
コード例 #2
0
    def _splash_screen_default(self):
        """ Trait initializer. """
        if preference_manager.root.show_splash_screen:
            splash_screen = SplashScreen(
                image=ImageResource('m2_about.jpg', search_path=[IMG_DIR]),
                show_log_messages=True,
            )
        else:
            splash_screen = None

        return splash_screen
コード例 #3
0
ファイル: app.py プロジェクト: pmrup/labtools
def open_gui(module,
             gui,
             splash='splash',
             text_color='white',
             text_location=(5, 285)):
    """This function takes gui object (should ba a valid HasTraits object) and constructs
    GUI by running the configure_traits, before opening the GUI, splash screen
    is opened. The object must have a close method, which is responsible for clean-up
    and is called after exiting the window.
    
    Parameters
    ----------
    module : str
        module name in which the gui callable is located
    gui : str
        callable that should return an instance of HasTraits object
    splash : str
        name of the splash screen image
    text_color : trait color
        color name of the logging messages
    """
    splash_screen = SplashScreen(image=ImageResource(splash),
                                 text_color=text_color,
                                 text_location=text_location)
    splash_screen.open()
    logger.info('Importing libraries. This may take some time...')
    import importlib
    m = importlib.import_module(module)
    gui = getattr(m, gui)
    import contextlib
    logger.info('Building %s...' % gui)
    with contextlib.closing(gui()) as s:
        splash_screen.close()
        s.configure_traits()
コード例 #4
0
    def _splash_screen_default(self):
        """ Initialize the Splash Screen """

        if preference_manager.cviewerui.show_splash_screen:
            splash_screen = SplashScreen(
                image=ImageResource('cviewer_about.png',
                                    search_path=self._image_path),
                show_log_messages=True,
            )
        else:
            splash_screen = None

        return splash_screen
コード例 #5
0
ファイル: pyfibre_gui.py プロジェクト: franklongford/PyFibre
class PyFibreGUI(TasksApplication):

    id = 'pyfibre.pyfibre_gui'

    name = 'PyFibre GUI'

    window_size = Tuple((1680, 1050))

    splash_screen = SplashScreen(image=ImageResource("images/splash"))

    # The default window-level layout for the application.
    default_layout = List(TaskWindowLayout)

    # Whether to restore the previous application-level layout
    # when the application is started.
    always_use_default_layout = Bool(True)

    n_proc = Int(1)

    def _default_layout_default(self):
        tasks = [factory.id for factory in self.task_factories]
        return [
            TaskWindowLayout(*tasks,
                             active_task='pyfibre.pyfibre_main_task',
                             size=self.window_size)
        ]

    def _load_state(self):
        super(PyFibreGUI, self)._load_state()
        if (self._state.window_layouts
                and self._state.window_layouts[0].get_active_task() is None):
            # This is a possible way a corrupted state file would manifest
            # Remove it and try again with a default state.
            state_file = os.path.join(self.state_location,
                                      'application_memento')
            if os.path.exists(state_file):
                os.unlink(state_file)
                logger.warning("The state file at {!r} was corrupted and has "
                               "been removed.".format(state_file))
            super(PyFibreGUI, self)._load_state()
コード例 #6
0
 def _splash_screen_default(self):
     sp = SplashScreen(image=ImageResource(
         name='splash.png',
         search_path=[paths.app_resources, paths.splashes]))
     return sp
コード例 #7
0
ファイル: explorer.py プロジェクト: youningnihaobang/pyface
        python_shell.bind('window', self)
        python_shell.bind('actions', self._actions)

        return python_shell.control

    #### Trait event handlers #################################################

    def _on_selection_changed(self, selection):
        """ Called when the selection in the tree is changed. """

        if len(selection) > 0:
            self._table_viewer.input = selection[0]

        return


# Application entry point.
if __name__ == '__main__':
    # Create the GUI and put up a splash screen (this does NOT start the GUI
    # event loop).
    gui = GUI(splash_screen=SplashScreen())

    # Create and open the main window.
    window = MainWindow()
    window.open()

    # Start the GUI event loop.
    gui.start_event_loop()

##### EOF #####################################################################
コード例 #8
0
 def _splash_screen_default(self):
     sp = SplashScreen(image=splash_icon(self.shortname))
     return sp
コード例 #9
0
"""Example of using a splash screen (and the use of pyface Timer)."""

import time

from pyface.timer.api import Timer
from pyface.api import GUI, ApplicationWindow, ImageResource, SplashScreen
from pyface.action.api import Action, MenuManager, MenuBarManager
from traits.api import Any, Int

splash_screen = SplashScreen(image=ImageResource("images/splash"))


class MainWindow(ApplicationWindow):
    """ The main application window. """

    # The pyface Timer.
    my_timer = Any()

    # Count each time the timer task executes.
    counter = Int()

    def __init__(self, **traits):
        """ Creates a new application window. """

        # Base class constructor.
        super().__init__(**traits)

        # Add a menu bar.
        self.menu_bar_manager = MenuBarManager(
            MenuManager(
                Action(name="Start Timer", on_perform=self._start_timer),
コード例 #10
0
    def _splash_screen_default(self):
        from kromatography.ui.image_resources import splash_screen

        splash_screen = SplashScreen(image=splash_screen)
        return splash_screen
コード例 #11
0
ファイル: splash_screen.py プロジェクト: jdmarch/pyface
"""Example of using a splash screen (and the use of pyface Timer)."""

import time

from pyface.timer.api import Timer
from pyface.api import GUI, ApplicationWindow, ImageResource, SplashScreen
from pyface.action.api import Action, MenuManager, MenuBarManager
from traits.api import Any, Int


splash_screen = SplashScreen(image=ImageResource('images/splash'))


class MainWindow(ApplicationWindow):
    """ The main application window. """

    # The pyface Timer.
    my_timer = Any()

    # Count each time the timer task executes.
    counter = Int

    def __init__(self, **traits):
        """ Creates a new application window. """

        # Base class constructor.
        super(MainWindow, self).__init__(**traits)

        # Add a menu bar.
        self.menu_bar_manager = MenuBarManager(
            MenuManager(
コード例 #12
0
ファイル: splash_screen.py プロジェクト: TGXnet/consumercheck
#  any later version.
#
#  ConsumerCheck is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with ConsumerCheck.  If not, see <http://www.gnu.org/licenses/>.
#-----------------------------------------------------------------------------

import os

from pyface.image_resource import ImageResource
from pyface.api import SplashScreen

# Local imports
import cc_config as conf

img = ImageResource(
    'ConsumerCheckLogo.png',
    search_path=[conf.graphics_path()],
)
splash = SplashScreen(image=img)

if __name__ == '__main__':
    from time import sleep
    splash.open()
    sleep(4)
    splash.close()