本文整理汇总了Python中ginga.misc.Bunch类的典型用法代码示例。如果您正苦于以下问题:Python Bunch类的具体用法?Python Bunch怎么用?Python Bunch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Bunch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
super(Desktop, self).__init__()
# for tabs
self.tab = Bunch.caselessDict()
self.tabcount = 0
self.notebooks = Bunch.caselessDict()
for name in ('page-switch', 'page-select'):
self.enable_callback(name)
示例2: __init__
def __init__(self):
super(Desktop, self).__init__()
# for tabs
self.tab = Bunch.caselessDict()
self.tabcount = 0
self.notebooks = Bunch.caselessDict()
self.toplevels = []
for name in ('page-switch', 'page-select', 'all-closed'):
self.enable_callback(name)
self.popmenu = None
示例3: __init__
def __init__(self, app):
super(Desktop, self).__init__()
self.app = app
# for tabs
self.tab = Bunch.caselessDict()
self.tabcount = 0
self.workspace = Bunch.caselessDict()
self.toplevels = []
self._cur_dialogs = []
for name in ('page-switch', 'all-closed'):
self.enable_callback(name)
示例4: __init__
def __init__(self, fv):
# superclass defines some variables for us, like logger
super(Contents, self).__init__(fv)
columns = [ ('Name', 'NAME'), ('Object', 'OBJECT'),
('Date', 'DATE-OBS'), ('Time UT', 'UT'),
]
prefs = self.fv.get_preferences()
self.settings = prefs.createCategory('plugin_Contents')
self.settings.addDefaults(columns=columns, always_expand=True)
self.settings.load(onError='silent')
# For table-of-contents pane
self.nameDict = Bunch.caselessDict()
# TODO: this ought to be customizable by channel
self.columns = self.settings.get('columns', columns)
self.cell_sort_funcs = []
for hdr, key in self.columns:
self.cell_sort_funcs.append(self._mksrtfnN(key))
self.gui_up = False
fv.set_callback('add-image', self.add_image)
fv.set_callback('remove-image', self.remove_image)
fv.set_callback('delete-channel', self.delete_channel)
示例5: __init__
def __init__(self, fv):
# superclass defines some variables for us, like logger
super(Contents, self).__init__(fv)
columns = [ ('Name', 'NAME'), ('Object', 'OBJECT'),
('Date', 'DATE-OBS'), ('Time UT', 'UT'),
]
prefs = self.fv.get_preferences()
self.settings = prefs.createCategory('plugin_Contents')
self.settings.addDefaults(columns=columns, always_expand=True,
highlight_tracks_keyboard_focus=False,
color_alternate_rows=True)
self.settings.load(onError='silent')
# For table-of-contents pane
self.name_dict = Bunch.caselessDict()
# TODO: this ought to be customizable by channel
self.columns = self.settings.get('columns', columns)
self.treeview = None
# paths of highlighted entries, by channel
self._hl_path = {}
self.highlight_tracks_keyboard_focus = self.settings.get(
'highlight_tracks_keyboard_focus', False)
self.gui_up = False
fv.add_callback('add-image', self.add_image)
fv.add_callback('remove-image', self.remove_image)
fv.add_callback('add-channel', self.add_channel)
fv.add_callback('delete-channel', self.delete_channel)
if self.highlight_tracks_keyboard_focus:
fv.add_callback('active-image', self.focus_cb)
self._hl_path['none'] = None
示例6: recreate_imlist
def recreate_imlist(self):
"""Refresh image list for new selection."""
if not self.gui_up:
return
treedict = Bunch.caselessDict()
for imname in self._imlist:
treedict[imname] = Bunch.Bunch(IMAGE=imname)
self.treeview.set_tree(treedict)
示例7: __init__
def __init__(self, fv, fitsimage):
# superclass defines some variables for us, like logger
super(TVMark, self).__init__(fv, fitsimage)
self.layertag = 'tvmark-canvas'
self.marktag = None
self.markhltag = None
self._mark_options = ['box', 'circle', 'cross', 'plus', 'point']
self._color_options = self._short_color_list()
self._dwidth = 2 # Additional width to highlight selection
# User preferences. Some are just default values and can also be
# changed by GUI.
prefs = self.fv.get_preferences()
self.settings = prefs.createCategory('plugin_TVMark')
self.settings.load(onError='silent')
self.marktype = self.settings.get('marktype', 'circle')
self.markcolor = self.settings.get('markcolor', 'green')
self.marksize = self.settings.get('marksize', 5)
self.markwidth = self.settings.get('markwidth', 1)
self.pixelstart = self.settings.get('pixelstart', 1)
self.use_radec = self.settings.get('use_radec', True)
self.extra_columns = self.settings.get('extra_columns', [])
# Display coords info table
self.treeview = None
self.treeviewsel = None
self.treeviewbad = None
self.tree_dict = Bunch.caselessDict()
self.columns = [('No.', 'MARKID'), ('RA', 'RA'), ('DEC', 'DEC'),
('X', 'X'), ('Y', 'Y')]
# Append extra columns to table header
self.columns += [(colname, colname) for colname in self.extra_columns]
# Store results
self.coords_dict = defaultdict(list)
self._xarr = []
self._yarr = []
self._treepaths = []
self.dc = self.fv.getDrawClasses()
canvas = self.dc.DrawingCanvas()
canvas.enable_draw(True)
canvas.enable_edit(False)
canvas.set_callback('draw-event', self.hl_canvas2table_box)
canvas.set_callback('cursor-down', self.hl_canvas2table)
canvas.setSurface(self.fitsimage)
canvas.set_drawtype('rectangle', color='green', linestyle='dash')
self.canvas = canvas
fv.add_callback('remove-image', lambda *args: self.redo())
self.gui_up = False
示例8: recreate_pxdq
def recreate_pxdq(self, dqparser, dqs, pixval):
"""Refresh single pixel results table with given data."""
if not self.gui_up:
return
dqstr = self.settings.get('dqstr', 'long')
treedict = Bunch.caselessDict()
for row in dqs:
flag = row[dqparser._dqcol]
val = row[dqstr]
treedict[str(flag)] = Bunch.Bunch(FLAG=flag, DESCRIP=val)
self.pxdqlist.set_tree(treedict)
self.w.dq.set_text(str(pixval))
示例9: __init__
def __init__(self, logger, fitsview, ds, mm):
super(PluginManagerBase, self).__init__()
self.logger = logger
self.fv = fitsview
self.ds = ds
self.mm = mm
self.lock = threading.RLock()
self.plugin = Bunch.caselessDict()
self.active = {}
self.focus = set([])
self.exclusive = set([])
self.focuscolor = "lightgreen"
self.hbox = None
示例10: __init__
def __init__(self, logger, fitsview, ds, mm):
super(PluginManager, self).__init__()
self.logger = logger
self.fv = fitsview
self.ds = ds
self.mm = mm
self.lock = threading.RLock()
self.plugin = Bunch.caselessDict()
self.active = {}
self.focus = set([])
self.exclusive = set([])
for name in ('activate-plugin', 'deactivate-plugin',
'focus-plugin', 'unfocus-plugin'):
self.enable_callback(name)
示例11: recreate_imdq
def recreate_imdq(self, dqparser):
"""Refresh image DQ results table with given data."""
if not self.gui_up:
return
dqstr = self.settings.get('dqstr', 'long')
treedict = Bunch.caselessDict()
for key in self._curpxmask:
if len(self._curpxmask[key][0]) == 0:
continue
row = dqparser.tab[dqparser.tab[dqparser._dqcol] == key]
flag = row[dqparser._dqcol][0]
val = row[dqstr][0]
treedict[str(flag)] = Bunch.Bunch(FLAG=flag, DESCRIP=val)
self.imdqlist.set_tree(treedict)
示例12: __init__
def __init__(self, fv):
# superclass defines some variables for us, like logger
super(ChangeHistory, self).__init__(fv)
self.columns = [('Timestamp (UTC)', 'MODIFIED'),
('Description', 'DESCRIP'),
]
# For table-of-contents pane
self.name_dict = Bunch.caselessDict()
self.treeview = None
prefs = self.fv.get_preferences()
self.settings = prefs.createCategory('plugin_ChangeHistory')
self.settings.addDefaults(always_expand=True,
color_alternate_rows=True,
ts_colwidth=250)
self.settings.load(onError='silent')
fv.add_callback('remove-image', self.remove_image_cb)
fv.add_callback('delete-channel', self.delete_channel_cb)
self.gui_up = False
示例13: clear
def clear(self):
self.name_dict = Bunch.caselessDict()
self.recreate_toc()
示例14: clear
def clear(self):
self.name_dict = Bunch.caselessDict()
self._hl_path = set([])
self.recreate_toc()
示例15: clear
def clear(self):
self.name_dict = Bunch.caselessDict()
self.clear_selected_history()
self.recreate_toc()