-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCommon.py
71 lines (55 loc) · 2.21 KB
/
Common.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from matplotlib.pyplot import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from enthought.traits.api import *
from enthought.traits.ui.api import View,UItem, Item,Group, Heading, Label, \
HSplit, Handler, CheckListEditor, EnumEditor, TableEditor, \
ListEditor, Tabbed, VGroup, HGroup, RangeEditor, Spring, spring
from enthought.traits.ui.menu import NoButtons
from traitsui.ui_editors.array_view_editor import ArrayViewEditor
#from traits.api import Array
#from enthought.traits.api import Any, Instance
from enthought.traits.ui.wx.editor import Editor
from enthought.traits.ui.wx.basic_editor_factory import BasicEditorFactory
import numpy as np
from enthought.enable.api import ColorTrait
from traitsui.api import TabularEditor
from traitsui.tabular_adapter import TabularAdapter
from matplotlib import *
import os
import sys
import wx
import platform
import socket
import random
import subprocess
import pylab as plt
import modules.readsnapshots.readsnapHDF5 as rsHD
import modules.readsnapshots.readsnap as rs
import modules.readsnapshots.readids as readids
import modules.readhalos.readsubf as readsubf
import modules.readhalos.RSDataReaderv2 as RSDataReader
from modules.brendanlib.grifflib import *
from random import randint
class _MPLFigureEditor(Editor):
scrollable = True
def init(self, parent):
self.control = self._create_canvas(parent)
self.set_tooltip()
def update_editor(self):
pass
def _create_canvas(self, parent):
""" Create the MPL canvas. """
# The panel lets us add additional controls.
panel = wx.Panel(parent, -1, style=wx.CLIP_CHILDREN)
sizer = wx.BoxSizer(wx.VERTICAL)
panel.SetSizer(sizer)
# matplotlib commands to create a canvas
mpl_control = FigureCanvas(panel, -1, self.value)
sizer.Add(mpl_control, 1, wx.LEFT | wx.TOP | wx.GROW)
toolbar = NavigationToolbar2Wx(mpl_control)
sizer.Add(toolbar, 0, wx.EXPAND)
self.value.canvas.SetMinSize((10,10))
return panel
class MPLFigureEditor(BasicEditorFactory):
klass = _MPLFigureEditor