def play(self): self.play_pause_button.SetBitmapLabel( wx.BitmapFromImage(get_builtin_image('pause'))) self.play_pause_button.SetToolTipString("Pause") self.previous_pauses_duration += time.time() - self.pause_start_time self.pause_start_time = None self.paused = False
def get_cp_image(): """The CellProfiler icon as a wx.Image""" global cp_image if cp_image is None: cp_image = get_builtin_image('CellProfilerIcon') return cp_image
def __init__(self, *args, **kwds): if sys.platform.startswith("win"): kwds["style"] = wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) self.Show() if wx.Platform == '__WXMAC__' and hasattr(self, 'MacGetTopLevelWindowRef'): try: from AppKit import NSWindow, NSApp, NSFloatingWindowLevel window_ref = self.MacGetTopLevelWindowRef() nsw = NSWindow.alloc().initWithWindowRef_(window_ref) nsw.setLevel_(NSFloatingWindowLevel) except ImportError: print "No AppKit module => can't make progress window stay on top." self.start_time = time.time() self.end_times = None self.current_module = None self.pause_start_time = None self.previous_pauses_duration = 0. # GUI stuff self.BackgroundColour = cellprofiler.preferences.get_background_color() self.tbicon = wx.TaskBarIcon() self.tbicon.SetIcon(get_cp_icon(), "CellProfiler2.0") self.SetTitle("CellProfiler %s"%(version.title_string)) self.SetSize((640, 480)) self.panel = wx.Panel(self, wx.ID_ANY) sizer = wx.BoxSizer(wx.VERTICAL) times_sizer = wx.BoxSizer(wx.HORIZONTAL) self.elapsed_control = wx.StaticText(self.panel, -1, label=self.elapsed_label(), style=wx.ALIGN_LEFT) self.remaining_control = wx.StaticText(self.panel, -1, label=self.remaining_label(), style=wx.ALIGN_RIGHT) times_sizer.Add(self.elapsed_control, 1, wx.ALIGN_LEFT | wx.ALL, 5) times_sizer.Add(self.remaining_control, 1, wx.ALIGN_RIGHT | wx.ALL, 5) sizer.Add(times_sizer, 0, wx.EXPAND) self.gauge = wx.Gauge(self.panel, -1, style=wx.GA_HORIZONTAL) self.gauge.SetValue(0) self.gauge.SetRange(100) sizer.Add(self.gauge, 0, wx.ALL | wx.EXPAND, 5) self.image_set_control = wx.StaticText(self.panel, -1, label=image_set_label(None, None)) sizer.Add(self.image_set_control, 0, wx.LEFT | wx.RIGHT, 5) self.current_module_control = wx.StaticText(self.panel, -1, label=module_label(None)) sizer.Add(self.current_module_control, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM, 5) buttons_sizer = wx.BoxSizer(wx.HORIZONTAL) self.play_pause_button = wx.BitmapButton(self.panel, -1, bitmap=wx.BitmapFromImage(get_builtin_image('pause'))) self.play_pause_button.SetToolTipString("Pause") buttons_sizer.Add(self.play_pause_button, 0, wx.ALL, 5) self.stop_button = wx.BitmapButton(self.panel, -1, bitmap=wx.BitmapFromImage(get_builtin_image('stop'))) self.stop_button.SetToolTipString("Stop") buttons_sizer.Add(self.stop_button, 0, wx.ALL, 5) save_bitmap = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_CMN_DIALOG, (16,16)) self.save_button = wx.BitmapButton(self.panel, -1, bitmap = save_bitmap) self.save_button.SetToolTipString("Save measurements") buttons_sizer.Add(self.save_button, 0, wx.ALL, 5) sizer.Add(buttons_sizer, 0, wx.CENTER) self.panel.SetSizer(sizer) sizer.Fit(self) # Timer that updates elapsed timer_id = wx.NewId() self.timer = wx.Timer(self.panel, timer_id) self.timer.Start(500) wx.EVT_TIMER(self.panel, timer_id, self.on_timer)
def pause(self): self.play_pause_button.SetBitmapLabel( wx.BitmapFromImage(get_builtin_image('play'))) self.play_pause_button.SetToolTipString("Resume") self.pause_start_time = time.time() self.paused = True
Website: http://www.cellprofiler.org """ import wx from cellprofiler.icons import get_builtin_image import cStringIO import cellprofiler.preferences as cpp from cellprofiler.gui.errordialog import display_error_dialog import sys # Make sure sys.excepthook is called for any uncaught exceptions, even in threads. import cellprofiler.utilities.thread_excepthook cellprofiler.utilities.thread_excepthook.install_thread_sys_excepthook() CellProfilerSplash = get_builtin_image('CellProfilerSplash') class CellProfilerApp(wx.App): def __init__(self, *args, **kwargs): # allow suppression of version checking (primarily for nosetests). self.check_for_new_version = kwargs.pop('check_for_new_version', False) self.show_splashbox = kwargs.pop('show_splashbox', False) self.workspace_path = kwargs.pop('workspace_path', None) self.pipeline_path = kwargs.pop('pipeline_path', None) self.abort_initialization = False super(CellProfilerApp, self).__init__(*args, **kwargs) def OnInit(self): # The wx.StandardPaths aren't available until this is set. self.SetAppName('CellProfiler2.0')
Website: http://www.cellprofiler.org """ import wx from cellprofiler.icons import get_builtin_image import cStringIO import cellprofiler.preferences as cpp from cellprofiler.gui.errordialog import display_error_dialog import sys # Make sure sys.excepthook is called for any uncaught exceptions, even in threads. import cellprofiler.utilities.thread_excepthook cellprofiler.utilities.thread_excepthook.install_thread_sys_excepthook() CellProfilerSplash = get_builtin_image('CellProfilerSplash') class CellProfilerApp(wx.App): def __init__(self, *args, **kwargs): # allow suppression of version checking (primarily for nosetests). self.check_for_new_version = kwargs.pop('check_for_new_version', False) self.show_splashbox = kwargs.pop('show_splashbox', False) self.workspace_path = kwargs.pop('workspace_path', None) self.pipeline_path = kwargs.pop('pipeline_path', None) self.abort_initialization = False super(CellProfilerApp, self).__init__(*args, **kwargs) def OnInit(self): # The wx.StandardPaths aren't available until this is set. from cellprofiler.utilities.version import dotted_version self.SetAppName('CellProfiler%s' % dotted_version)
def __init__(self, *args, **kwds): if sys.platform.startswith("win"): kwds["style"] = wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) self.Show() if wx.Platform == '__WXMAC__' and hasattr(self, 'MacGetTopLevelWindowRef'): try: from AppKit import NSWindow, NSApp, NSFloatingWindowLevel window_ref = self.MacGetTopLevelWindowRef() nsw = NSWindow.alloc().initWithWindowRef_(window_ref) nsw.setLevel_(NSFloatingWindowLevel) except ImportError: print "No AppKit module => can't make progress window stay on top." self.start_time = time.time() self.end_times = None self.current_module = None self.pause_start_time = None self.previous_pauses_duration = 0. # GUI stuff self.BackgroundColour = cellprofiler.preferences.get_background_color() self.tbicon = wx.TaskBarIcon() self.tbicon.SetIcon(get_cp_icon(), "CellProfiler2.0") self.SetTitle("CellProfiler %s" % (version.title_string)) self.SetSize((640, 480)) self.panel = wx.Panel(self, wx.ID_ANY) sizer = wx.BoxSizer(wx.VERTICAL) times_sizer = wx.BoxSizer(wx.HORIZONTAL) self.elapsed_control = wx.StaticText(self.panel, -1, label=self.elapsed_label(), style=wx.ALIGN_LEFT) self.remaining_control = wx.StaticText(self.panel, -1, label=self.remaining_label(), style=wx.ALIGN_RIGHT) times_sizer.Add(self.elapsed_control, 1, wx.ALIGN_LEFT | wx.ALL, 5) times_sizer.Add(self.remaining_control, 1, wx.ALIGN_RIGHT | wx.ALL, 5) sizer.Add(times_sizer, 0, wx.EXPAND) self.gauge = wx.Gauge(self.panel, -1, style=wx.GA_HORIZONTAL) self.gauge.SetValue(0) self.gauge.SetRange(100) sizer.Add(self.gauge, 0, wx.ALL | wx.EXPAND, 5) self.image_set_control = wx.StaticText(self.panel, -1, label=image_set_label( None, None)) sizer.Add(self.image_set_control, 0, wx.LEFT | wx.RIGHT, 5) self.current_module_control = wx.StaticText(self.panel, -1, label=module_label(None)) sizer.Add(self.current_module_control, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM, 5) buttons_sizer = wx.BoxSizer(wx.HORIZONTAL) self.play_pause_button = wx.BitmapButton( self.panel, -1, bitmap=wx.BitmapFromImage(get_builtin_image('pause'))) self.play_pause_button.SetToolTipString("Pause") buttons_sizer.Add(self.play_pause_button, 0, wx.ALL, 5) self.stop_button = wx.BitmapButton(self.panel, -1, bitmap=wx.BitmapFromImage( get_builtin_image('stop'))) self.stop_button.SetToolTipString("Stop") buttons_sizer.Add(self.stop_button, 0, wx.ALL, 5) save_bitmap = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_CMN_DIALOG, (16, 16)) self.save_button = wx.BitmapButton(self.panel, -1, bitmap=save_bitmap) self.save_button.SetToolTipString("Save measurements") buttons_sizer.Add(self.save_button, 0, wx.ALL, 5) sizer.Add(buttons_sizer, 0, wx.CENTER) self.panel.SetSizer(sizer) sizer.Fit(self) # Timer that updates elapsed timer_id = wx.NewId() self.timer = wx.Timer(self.panel, timer_id) self.timer.Start(500) wx.EVT_TIMER(self.panel, timer_id, self.on_timer)
__version__="$Revision$" from StringIO import StringIO import time import base64 import math import zlib import wx import sys import cellprofiler.pipeline as cpp import cellprofiler.gui.movieslider as cpgmov from cellprofiler.gui.cpfigure import window_name, find_fig from cellprofiler.icons import get_builtin_image IMG_OK = get_builtin_image('IMG_OK') IMG_ERROR = get_builtin_image('IMG_ERROR') IMG_EYE = get_builtin_image('IMG_EYE') IMG_CLOSED_EYE = get_builtin_image('IMG_CLOSED_EYE') IMG_PAUSE = get_builtin_image('IMG_PAUSE') IMG_GO = get_builtin_image('IMG_GO') BMP_WARNING = wx.ArtProvider.GetBitmap(wx.ART_WARNING,size=(16,16)) NO_PIPELINE_LOADED = 'No pipeline loaded' PADDING = 1 def plv_get_bitmap(data): return wx.BitmapFromImage(data) PAUSE_COLUMN = 0 EYE_COLUMN = 1
from StringIO import StringIO import logging import time import base64 import math import zlib import wx import sys import cellprofiler.pipeline as cpp import cellprofiler.gui.movieslider as cpgmov from cellprofiler.gui.cpfigure import window_name, find_fig from cellprofiler.icons import get_builtin_image from cellprofiler.gui.moduleview import request_module_validation IMG_OK = get_builtin_image('IMG_OK') IMG_ERROR = get_builtin_image('IMG_ERROR') IMG_EYE = get_builtin_image('IMG_EYE') IMG_CLOSED_EYE = get_builtin_image('IMG_CLOSED_EYE') IMG_PAUSE = get_builtin_image('IMG_PAUSE') IMG_GO = get_builtin_image('IMG_GO') BMP_WARNING = wx.ArtProvider.GetBitmap(wx.ART_WARNING, size=(16, 16)) NO_PIPELINE_LOADED = 'No pipeline loaded' PADDING = 1 def plv_get_bitmap(data): return wx.BitmapFromImage(data)
CPLD_ALPHA_VALUE = "alpha_value" CPLD_LABELS = "labels" CPLD_LINE_WIDTH = "line_width" CPLD_MODE = "mode" CPLD_NAME = "name" CPLD_OUTLINE_COLOR = "outline_color" CPLD_SHOW = "show" EVT_NAV_MODE_CHANGE = wx.PyEventBinder(wx.NewEventType()) MATPLOTLIB_FILETYPES = ["png", "pdf"] MATPLOTLIB_UNSUPPORTED_FILETYPES = [] MENU_CLOSE_ALL = wx.NewId() MENU_CLOSE_WINDOW = wx.NewId() MENU_FILE_SAVE = wx.NewId() MENU_FILE_SAVE_TABLE = wx.NewId() MENU_LABELS_ALPHA = {} MENU_LABELS_LINES = {} MENU_LABELS_OFF = {} MENU_LABELS_OUTLINE = {} MENU_LABELS_OVERLAY = {} MENU_RGB_CHANNELS = {} MENU_SAVE_SUBPLOT = {} MENU_TOOLS_MEASURE_LENGTH = wx.NewId() MODE_MEASURE_LENGTH = 2 MODE_NONE = 0 NAV_MODE_NONE = "" NAV_MODE_PAN = "pan/zoom" NAV_MODE_ZOOM = "zoom rect" NAV_MODE_MEASURE = "measure" BMP_MEASURE = wx.Bitmap(get_builtin_image("IMG_MEASURE")) WINDOW_IDS = []