示例#1
0
    def __init__(self, parent, dsviewer):
        wx.Panel.__init__(self, parent, -1)
        dirname = os.path.dirname(__file__)

        self.do = dsviewer.do
        self.dsviewer = dsviewer

        self.bmStartSeek = wx.Bitmap(
            resources.getIconPath('media-skip-backward.png'))
        self.bmPlay = wx.Bitmap(
            resources.getIconPath('media-playback-start.png'))
        self.bmPause = wx.Bitmap(
            resources.getIconPath('media-playback-pause.png'))

        self.mode = 'HORIZ'
        self.moving = False

        #timer for playback
        self.tPlay = mytimer()
        self.tPlay.WantNotification.append(self.OnFrame)

        self.do.WantChangeNotification.append(self.update)

        self.genContents(self.mode)

        self.Bind(wx.EVT_SIZE, self.OnSize)
    def __init__(self, parent, scope, size=(-1, -1)):
        wx.Panel.__init__(self, parent, size=size)

        self.tickcount = 0
        self.messages = {}

        self.startTime = time.time()

        self.times = {'total': 6}

        with scope.settingsDB as conn:
            tims = conn.execute('SELECT * FROM StartupTimes').fetchall()

        for ti in tims:
            self.times[ti[0]] = ti[1]

        self.Bind(wx.EVT_PAINT, self.OnPaint)

        logofilename = resources.getIconPath('logo_fmhs.png')

        self.bmLogo = wx.Bitmap(logofilename, wx.BITMAP_TYPE_PNG)

        logofilename = resources.getIconPath('YSM_Shield.png')

        self.bmLogo2 = wx.Bitmap(logofilename, wx.BITMAP_TYPE_PNG)
    def CreateToolBar(self, wind):
        global bmCrosshairs, bmRectSelect, bmLineSelect, bmSquiggleSelect

        if bmCrosshairs is None:  #load bitmaps on first use
            bmCrosshairs = wx.Bitmap(resources.getIconPath('crosshairs.png'))
            bmRectSelect = wx.Bitmap(resources.getIconPath('rect_select.png'))
            bmLineSelect = wx.Bitmap(resources.getIconPath('line_select.png'))
            bmSquiggleSelect = wx.Bitmap(
                resources.getIconPath('squiggle_select.png'))

        self.toolB = aui.AuiToolBar(wind,
                                    -1,
                                    wx.DefaultPosition,
                                    wx.DefaultSize,
                                    agwStyle=aui.AUI_TB_DEFAULT_STYLE
                                    | aui.AUI_TB_OVERFLOW
                                    | aui.AUI_TB_VERTICAL)
        self.toolB.SetToolBitmapSize(wx.Size(16, 16))

        #ID_POINTER = wx.NewId()
        ID_CROSSHAIRS = wx.NewId()
        ID_RECTSELECT = wx.NewId()
        ID_LINESELECT = wx.NewId()
        ID_SQUIGGLESELECT = wx.NewId()

        self.toolB.AddRadioTool(ID_CROSSHAIRS, "Point selection", bmCrosshairs,
                                bmCrosshairs)
        self.toolB.AddRadioTool(ID_RECTSELECT, "Rectangle selection",
                                bmRectSelect, bmRectSelect)
        self.toolB.AddRadioTool(ID_LINESELECT, "Line selection", bmLineSelect,
                                bmLineSelect)
        self.toolB.AddRadioTool(ID_SQUIGGLESELECT, "Freeform selection",
                                bmSquiggleSelect, bmSquiggleSelect)

        self.toolB.Realize()

        #self._mgr.AddPane(tb5, aui.AuiPaneInfo().Name("tb5").Caption("Sample Vertical Toolbar").
        #                  ToolbarPane().Left().GripperTop())

        self.toolB.ToggleTool(ID_CROSSHAIRS, True)

        wind.Bind(wx.EVT_TOOL, self.OnSelectCrosshairs, id=ID_CROSSHAIRS)
        wind.Bind(wx.EVT_TOOL, self.OnSelectRectangle, id=ID_RECTSELECT)
        wind.Bind(wx.EVT_TOOL, self.OnSelectLine, id=ID_LINESELECT)
        wind.Bind(aui.EVT_AUITOOLBAR_RIGHT_CLICK,
                  self.OnLineThickness,
                  id=ID_LINESELECT)
        wind.Bind(wx.EVT_TOOL, self.OnSelectSquiggle, id=ID_SQUIGGLESELECT)

        return self.toolB
示例#4
0
    def OnAbout(self, event):
        from PYME.version import version
        from PYME.resources import getIconPath
        import wx.adv
        # msg = "PYME Visualise\n\n Visualisation of localisation microscopy data\nDavid Baddeley 2009"

        # dlg = wx.MessageDialog(self, msg, "About PYME Visualise",
        #                        wx.OK | wx.ICON_INFORMATION)
        # dlg.SetFont(wx.Font(8, wx.NORMAL, wx.NORMAL, wx.NORMAL, False, "Verdana"))
        # dlg.ShowModal()
        # dlg.Destroy()

        dlg = wx.adv.AboutDialogInfo()
        dlg.SetName("PYME Visualise")
        dlg.SetVersion(version)
        dlg.SetDescription("Visualisation of localisation microscopy data.")
        dlg.SetCopyright("(C)2009-2021")
        dlg.SetIcon(wx.Icon(getIconPath('pymeLogo.png')))
        #dlg.SetLicense("GPLv3") # I think we need to either expand or omit
        # TODO: should this be the issues page or the website
        dlg.SetWebSite(
            "https://github.com/python-microscopy/python-microscopy/issues",
            desc="Report an issue")
        #dlg.AddDeveloper("David Baddeley") #should probably be all or none here, punting full list for now

        wx.adv.AboutBox(dlg)
示例#5
0
    cherrypy.config.update({
        'server.socket_port': 8979,
        'server.socket_host': '127.0.0.1',
        #'log.screen': False,
        'log.access_file': '',
        'log.error_file': '',
        'server.thread_pool': 50,
        #'tools.staticdir.on': True,'tools.staticdir.root': static_dir
    })

    conf = {  #'/':{
        #'tools.staticdir.on': True,'tools.staticdir.root': static_dir
        #},
        '/static': {
            'tools.staticdir.on': True,
            'tools.staticdir.dir': static_dir
        },
        '/favicon.ico': {
            'tools.staticfile.on': True,
            'tools.staticfile.filename': resources.getIconPath('pymeLogo.png')
        }
    }

    #logging.getLogger('cherrypy.access').setLevel(logging.ERROR)

    #externalAddr = socket.gethostbyname(socket.gethostname())

    #app = cherrypy.tree.mount(tile_server, '/')
    #app.log.access_log.setLevel(logging.ERROR)

    cherrypy.quickstart(tile_server, '/', conf)
    def __init__(self, parent, glCanvas, visFr):
        wx.Panel.__init__(self, parent, -1)

        self.glCanvas = glCanvas
        self.visFr = visFr

        self.scaleBarLengths = OrderedDict([('<None>', None), ('50nm', 50),
                                            ('200nm', 200), ('500nm', 500),
                                            ('1um', 1000), ('5um', 5000)])

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        self.r3DMode = wx.RadioBox(self, choices=['2D', '3D'])
        self.r3DMode.Bind(wx.EVT_RADIOBOX, self.OnChange3D)
        hsizer.Add(self.r3DMode, 0,
                   wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 2)

        hsizer.AddSpacer(10)

        bTop = wx.BitmapButton(self,
                               -1,
                               wx.Bitmap(getIconPath('view-top.png')),
                               style=wx.NO_BORDER | wx.BU_AUTODRAW,
                               name='Top')
        bTop.Bind(wx.EVT_BUTTON, self.OnViewTop)
        hsizer.Add(bTop, 0, wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        bFront = wx.BitmapButton(self,
                                 -1,
                                 wx.Bitmap(getIconPath('view-front.png')),
                                 style=wx.NO_BORDER | wx.BU_AUTODRAW,
                                 name='Front')
        bFront.Bind(wx.EVT_BUTTON, self.OnViewFront)
        hsizer.Add(bFront, 0, wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        bRight = wx.BitmapButton(self,
                                 -1,
                                 wx.Bitmap(getIconPath('view-right.png')),
                                 style=wx.NO_BORDER | wx.BU_AUTODRAW,
                                 name='Right')
        bRight.Bind(wx.EVT_BUTTON, self.OnViewRight)
        hsizer.Add(bRight, 0, wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)

        hsizer.AddSpacer(10)

        cbLUTDraw = wx.ToggleButton(self, -1, 'LUT', style=wx.BU_EXACTFIT)
        #cbLUTDraw.SetBitmap(wx.Bitmap(getIconPath('LUT.png')))
        #cbLUTDraw = wx.BitmapToggleButton(self, -1, wx.Bitmap(getIconPath('LUT.png')))
        cbLUTDraw.SetValue(self.glCanvas.LUTDraw)

        #cbLUTDraw.Bind(wx.EVT_CHECKBOX, self.OnLUTDrawCB)
        cbLUTDraw.Bind(wx.EVT_TOGGLEBUTTON, self.OnLUTDrawCB)

        hsizer.Add(cbLUTDraw, 0, wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                   2)

        hsizer.AddSpacer(10)

        #Scale Bar

        hsizer.Add(wx.StaticText(self, -1, 'Scale Bar: '), 0,
                   wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)

        chInd = list(self.scaleBarLengths.values()).index(
            self.glCanvas.scaleBarLength)

        chScaleBar = wx.Choice(self,
                               -1,
                               choices=list(self.scaleBarLengths.keys()))
        chScaleBar.SetSelection(chInd)
        hsizer.Add(chScaleBar, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)

        hsizer.AddSpacer(10)

        #Background colour

        hsizer.Add(wx.StaticText(self, -1, 'BG Colour: '), 0,
                   wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)

        colour_ctrl = wx.ColourPickerCtrl(self)
        colour_ctrl.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnColourChanged)
        hsizer.Add(colour_ctrl, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)

        self.SetSizerAndFit(hsizer)

        #self._pnl.AddFoldPanelWindow(self, pan, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10)

        chScaleBar.Bind(wx.EVT_CHOICE, self.OnChangeScaleBar)