本文整理汇总了Python中cpa.properties.Properties.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Python Properties.getInstance方法的具体用法?Python Properties.getInstance怎么用?Python Properties.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cpa.properties.Properties
的用法示例。
在下文中一共展示了Properties.getInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_save_workspace
# 需要导入模块: from cpa.properties import Properties [as 别名]
# 或者: from cpa.properties.Properties import getInstance [as 别名]
def on_save_workspace(self, evt):
p = Properties.getInstance()
dlg = wx.FileDialog(self, message="Save workspace as...", defaultDir=os.getcwd(),
defaultFile='%s_%s.workspace'%(os.path.splitext(os.path.split(p._filename)[1])[0], p.image_table),
style=wx.SAVE|wx.FD_OVERWRITE_PROMPT|wx.FD_CHANGE_DIR)
if dlg.ShowModal() == wx.ID_OK:
wx.GetApp().save_workspace(dlg.GetPath())
示例2: OnInit
# 需要导入模块: from cpa.properties import Properties [as 别名]
# 或者: from cpa.properties.Properties import getInstance [as 别名]
def OnInit(self):
"""Initialize CPA
"""
"""List of tables created by the user during this session"""
self.user_tables = []
# splashscreen
splashimage = cpa.icons.cpa_splash.ConvertToBitmap()
# If the splash image has alpha, it shows up transparently on
# windows, so we blend it into a white background.
splashbitmap = wx.EmptyBitmapRGBA(splashimage.GetWidth(), splashimage.GetHeight(), 255, 255, 255, 255)
dc = wx.MemoryDC()
dc.SelectObject(splashbitmap)
dc.DrawBitmap(splashimage, 0, 0)
dc.Destroy() # necessary to avoid a crash in splashscreen
splash = wx.SplashScreen(splashbitmap, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, 2000, None, -1)
self.splash = splash
p = Properties.getInstance()
if not p.is_initialized():
from cpa.guiutils import show_load_dialog
splash.Destroy()
if not show_load_dialog():
logging.error("CellProfiler Analyst requires a properties file. Exiting.")
return False
self.frame = MainGUI(p, None, size=(860, -1))
self.frame.Show(True)
db = cpa.dbconnect.DBConnect.getInstance()
# Black magic: Bus errors occur on Mac OS X if we wait until
# the JVM or the wx event look has started to connect. But it
# has to be done after we have read the properties file. So we
# do it here.
db.connect()
db.register_gui_parent(self.frame)
# The JVM has to be started after db.connect(), otherwise bus errors
# occur on Mac OS X.
javabridge.start_vm(class_path=bioformats.JARS, run_headless=False)
javabridge.attach()
javabridge.activate_awt()
try:
if __version__ != -1:
import cellprofiler.utilities.check_for_updates as cfu
cfu.check_for_updates(
"http://cellprofiler.org/CPAupdate.html",
max(__version__, cpaprefs.get_skip_version()),
new_version_cb,
user_agent="CPAnalyst/2.0.%d" % (__version__),
)
except ImportError:
logging.warn(
"CPA was unable to check for updates. Could not import cellprofiler.utilities.check_for_updates."
)
return True
示例3: on_save_properties
# 需要导入模块: from cpa.properties import Properties [as 别名]
# 或者: from cpa.properties.Properties import getInstance [as 别名]
def on_save_properties(self, evt):
p = Properties.getInstance()
dirname, filename = os.path.split(p._filename)
ext = os.path.splitext(p._filename)[-1]
dlg = wx.FileDialog(self, message="Save properties as...", defaultDir=dirname,
defaultFile=filename, wildcard=ext,
style=wx.SAVE|wx.FD_OVERWRITE_PROMPT|wx.FD_CHANGE_DIR)
if dlg.ShowModal() == wx.ID_OK:
p.save_file(dlg.GetPath())
示例4: clear_link_tables
# 需要导入模块: from cpa.properties import Properties [as 别名]
# 或者: from cpa.properties.Properties import getInstance [as 别名]
def clear_link_tables(self, evt=None):
p = Properties.getInstance()
dlg = wx.MessageDialog(self, 'This will delete the tables '
'"%s" and "%s" from your database. '
'CPA will automatically recreate these tables as it '
'discovers how your database is linked. Are you sure you '
'want to proceed?'
%(p.link_tables_table, p.link_columns_table),
'Clear table linking information?',
wx.YES_NO|wx.NO_DEFAULT|wx.ICON_QUESTION)
response = dlg.ShowModal()
if response != wx.ID_YES:
return
db = dbconnect.DBConnect.getInstance()
db.execute('DROP TABLE IF EXISTS %s'%(p.link_tables_table))
db.execute('DROP TABLE IF EXISTS %s'%(p.link_columns_table))
db.Commit()
示例5: start
# 需要导入模块: from cpa.properties import Properties [as 别名]
# 或者: from cpa.properties.Properties import getInstance [as 别名]
def start():
# Init
p = Properties.getInstance()
p.LoadFile("/vagrant/data/23_classes/az-dnaonly.properties")
# p.LoadFile('/vagrant/data/5_classes/2010_08_21_Malaria_MartiLab_Test_2011_05_27_DIC+Alexa.properties')
# p.LoadFile('/vagrant/data/cpa_example/example.properties')
db = dbconnect.DBConnect.getInstance()
dm = DataModel.getInstance()
classifier = Classifier(properties=p) # Create a classifier with p
classifier.LoadTrainingSet("/vagrant/data/23_classes/Anne_DNA_66.txt")
# classifier.LoadTrainingSet('/vagrant/data/5_classes/MyTrainingSet_AllStages_Half.txt')
# classifier.LoadTrainingSet('/vagrant/data/cpa_example/MyTrainingSet.txt')
settings["p"] = p
settings["db"] = db
settings["dm"] = dm
settings["classifier"] = classifier
示例6: Stderr
# 需要导入模块: from cpa.properties import Properties [as 别名]
# 或者: from cpa.properties.Properties import getInstance [as 别名]
# send everything to logfile
sys.stderr = Stderr()
sys.stdout = sys.stderr
if hasattr(sys, 'frozen') and sys.platform.startswith('win'):
# on windows, log to a file (Mac goes to console)
setup_frozen_logging()
logging.basicConfig(level=logging.DEBUG)
# Handles args to MacOS "Apps"
if len(sys.argv) > 1 and sys.argv[1].startswith('-psn'):
del sys.argv[1]
if len(sys.argv) > 1:
# Load a properties file if passed in args
p = Properties.getInstance()
if sys.argv[1] == '--incell':
# GE Incell xml wrapper
# LOOP
p.LoadIncellFiles(sys.argv[2], sys.argv[3], sys.argv[4:])
else:
p.LoadFile(sys.argv[1])
import threading
from cpa.classifier import Classifier
from cpa.tableviewer import TableViewer
from cpa.plateviewer import PlateViewer
from cpa.imageviewer import ImageViewer
from cpa.boxplot import BoxPlot
from cpa.scatter import Scatter
from cpa.histogram import Histogram
示例7: Start
# 需要导入模块: from cpa.properties import Properties [as 别名]
# 或者: from cpa.properties.Properties import getInstance [as 别名]
def Start(self):
'''Initialize CPA
'''
'''List of tables created by the user during this session'''
self.user_tables = []
# splashscreen
splashimage = cpa.icons.cpa_splash.ConvertToBitmap()
# If the splash image has alpha, it shows up transparently on
# windows, so we blend it into a white background.
splashbitmap = wx.EmptyBitmapRGBA(splashimage.GetWidth(),
splashimage.GetHeight(),
255, 255, 255, 255)
dc = wx.MemoryDC()
dc.SelectObject(splashbitmap)
dc.DrawBitmap(splashimage, 0, 0)
dc.Destroy() # necessary to avoid a crash in splashscreen
splash = wx.SplashScreen(splashbitmap, wx.SPLASH_CENTRE_ON_SCREEN |
wx.SPLASH_TIMEOUT, 2000, None, -1)
self.splash = splash
p = Properties.getInstance()
if not p.is_initialized():
from cpa.guiutils import show_load_dialog
splash.Destroy()
if not show_load_dialog():
splash.Destroy()
example_link_address = 'cellprofiler.org'
dlg = wx.MessageDialog(None, 'CellProfiler Analyst requires a properties file. Download an example at %s' % (
example_link_address), 'Properties file required', wx.OK)
response = dlg.ShowModal()
logging.error('CellProfiler Analyst requires a properties file. Exiting.')
return False
self.frame = MainGUI(p, None, size=(1000,-1))
db = DBConnect.getInstance()
# Black magic: Bus errors occur on Mac OS X if we wait until
# the JVM or the wx event look has started to connect. But it
# has to be done after we have read the properties file. So we
# do it here.
db.connect()
db.register_gui_parent(self.frame)
# The JVM has to be started after db.connect(), otherwise bus errors
# occur on Mac OS X.
javabridge.start_vm(class_path=bioformats.JARS, run_headless=True)
# removes the log4j warnings
javabridge.attach()
# TODO: check for updates
try:
if __version__ != -1:
import cpa.util.check_for_updates as cfu
cfu.check_for_updates('http://cellprofiler.org/updates/CPA.html',
max(__version__, cpa.cpaprefs.get_skip_version()),
new_version_cb,
user_agent='CPAnalyst/%s'%(__version__))
except ImportError:
logging.warn("CPA was unable to check for updates. Could not import cpa.util.check_for_updates.")
self.frame.Show() # Show frame
return True