Esempio n. 1
0
 def __init__(self, engine):
     self._engine = engine
     wx.Frame.__init__(self, parent=None, title="J_PROJECT Duel Mode", size=(962,768), style=wx.SIMPLE_BORDER)
     self.SetIcon(wx.IconFromLocation(wx.IconLocation(os.path.join(self._engine.BaseDirectory,'mooseduel16x16.ico'))))
     self.CenterOnScreen()
     self.Game = GamePanel(self, self._engine)
     self.Bind(wx.EVT_CLOSE, self.OnExit)
Esempio n. 2
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 title=wx.EmptyString,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.DEFAULT_FRAME_STYLE,
                 name='frame'):
        wx.Frame.__init__(self, parent, id, title, pos, size, style, name)

        log = printLog()

        wxVER = 'wxPython %s' % wx.version()
        pyVER = 'python %d.%d.%d.%s' % sys.version_info[0:4]
        versionInfos = '%s %s' % (wxVER, pyVER)
        self.CreateStatusBar().SetStatusText(versionInfos)

        panel = TestPanel(self, log)
        self.Bind(wx.EVT_CLOSE, self.OnDestroy)

        try:
            iconLoc = wx.IconLocation(sys.executable)
            icon = wx.IconFromLocation(iconLoc)
            self.SetIcon(icon)
        except Exception as exc:
            pass
Esempio n. 3
0
 def updateIconPath():
     if iconOpt_ctrl.GetValue() == self.ICON_CUSTOM:
         iconPath_ctrl.Show()
         icon = wx.IconFromLocation(wx.IconLocation(*_traytip_iconFile))
         iconPath_ctrl.SetBitmap(wx.BitmapFromIcon(icon))
     else:
         iconPath_ctrl.Hide()
Esempio n. 4
0
    def run(self):
        self.frame = FrameLogin(None)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.capturarEventos()
        self.frame.ShowModal()
    def run(self):
        self.frame = FrameClientes(self.parent.frame)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.frame.tc_dato_busqueda.SetFocus()
        self.capturarEventos()
        self.frame.Show()
    def run(self):
        self.frame = FrameHistorialClientes(self.parent)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.capturarEventos()
        self.cargarValidadores()
        self.frame.Show()
    def run(self):
        self.frame = FrameClientes(self.parent)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.capturarEventos()
        self.deshabilitarBTNS()
        self.frame.Show()
    def run(self):
        self.frame = Frame(self.parent)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.cargarDatos()
        self.capturarEventos()
        self.frame.Show()
    def run(self):
        self.frame = FrameCajaIngresosVarios(self.parent)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.frame.tc_monto.SetValidator(Monto())
        rta = self.frame.ShowModal()
        if rta == wx.ID_OK:
            self.Aceptar()
	def run(self):
		self.frame = FrameUsuarios(self.parent)

		loc = wx.IconLocation(r'icono.ico')
		self.frame.SetIcon(wx.IconFromLocation(loc))
		
		self.capturarEventos()
		self.cargarGrilla(self.listadoUsuarios)
		self.deshabilitarBTNS()
		self.frame.Show()
    def run(self):
        self.frame = FrameIniciarCaja(self.parent)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.cargarDatos()
        resp = self.frame.ShowModal()
        if resp == wx.ID_OK:
            self.IniciarCaja()
    def run(self):
        self.frame = FrameCampanias(self.parent)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.capturarEventos()
        self.configurarGrilla(len(self.listadoCampanias))
        self.cargarGrilla(self.listadoCampanias)
        self.deshabilitaBTNS()
        self.frame.Show()
    def run(self):
        self.frame = Frame(self.parent)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.capturarEventos()

        rta = self.frame.ShowModal()
        if rta == wx.ID_OK:
            self.frame.Destroy()
Esempio n. 14
0
    def run(self):
        self.frame = FrameResultadoCampania(self.parent)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.frame.btn_volver.SetFocus()
        self.configurarGrilla()
        self.cargarGrilla()
        self.cargarDatos()
        self.capturarEventos()
        self.frame.Show()
Esempio n. 15
0
	def run(self):
		self.frame = FrameModificarMovimiento(self.parent)

		loc = wx.IconLocation(r'icono.ico')
		self.frame.SetIcon(wx.IconFromLocation(loc))
		
		self.frame.btn_cancelar.SetFocus()
		self.cargarDatos()
		self.capturarEventos()
		self.cargarValidadores()
		rta = self.frame.ShowModal()
		if rta == wx.ID_OK:
			self.Aceptar()
Esempio n. 16
0
    def __init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString,
                 pos=wx.DefaultPosition, size=wx.DefaultSize,
                 style=wx.DEFAULT_FRAME_STYLE, name='frame'):
        wx.Frame.__init__(self, parent, id, title, pos, size, style, name)

        log = printLog()

        panel = TestPanel(self, log)
        self.Bind(wx.EVT_CLOSE, self.OnDestroy)

        try:
            self.SetIcon(wx.IconFromLocation(wx.IconLocation(sys.executable)))
        except Exception as exc:
            raise exc
Esempio n. 17
0
    def run(self):
        self.frame = FrameCajaInfoCliente(self.parent)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.frame.btn_aceptar.SetFocus()
        self.frame.tc_boleta.Enable(False)
        self.frame.tc_oficina.Enable(False)
        self.cargarDatos()
        self.carpturarEventos()
        rta = self.frame.ShowModal()
        if rta == wx.ID_OK:
            self.Aceptar()
Esempio n. 18
0
    def run(self):
        self.frame = FrameLogin(self.parent)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.cargarValidadores()
        resp = self.frame.ShowModal()
        if resp == wx.ID_OK:
            usu = {
                'nom': self.frame.tc_usuario.GetValue(),
                'cla': self.frame.tc_clave.GetValue()
            }
            return usu
        else:
            return {}
Esempio n. 19
0
 def OnInit(self):
     str=urllib2.unquote((sys.argv[1].split('/',2))[2])
     temp=str
     fid=(temp.split('&'))[0].split('=')[1]
     name=(str.split('&'))[1].split('=')[1]
     tid=(str.split('&'))[2].split('=')[1]
     title=(str.split('&'))[3].split('=')[1]
     uid=(str.split('&'))[4].split('=')[1]
     ulink=(str.split('&'))[5].split('=')[1]
     
     self.m_frame = MainFrame(None)
     self.m_frame.SetIcon(wx.IconFromLocation(wx.IconLocation(r'scanner.ico',0)))
     self.m_frame.setParams(fid,name,tid,title,uid,ulink)
     self.m_frame.Show()
     self.SetTopWindow(self.m_frame)
     return True
Esempio n. 20
0
    def run(self):
        self.frame = FramePrincipal(None)

        loc = wx.IconLocation(r'icono.ico')
        self.frame.SetIcon(wx.IconFromLocation(loc))

        self.panelUno = PanelUno(self.frame.notebook)
        self.panelDos = PanelDos(self.frame.notebook)

        self.capturarEventos()

        self.frame.notebook.AddPage(self.panelUno, u"Campaña actual", False)
        self.frame.notebook.AddPage(self.panelDos, u"Menú", False)

        self.cargarDatos()

        self.frame.Show()
	def run(self):
		self.frame = FramePrincipal(self.parent)

		loc = wx.IconLocation(r'icono.ico')
		self.frame.SetIcon(wx.IconFromLocation(loc))
		
		log = ControladorLogin(self.frame, False)
		self.usuario = log.run()
		if self.usuario != {}:
			self.panelUno = PanelUno(self.frame.notebook)
			self.panelDos = PanelDos(self.frame.notebook)

			self.frame.notebook.AddPage(self.panelUno, u"Clientes atendidos", False)
			self.frame.notebook.AddPage(self.panelDos, u"Ingresos/Egresos Varios", False)

			self.capturarEventos()
			self.cargarDatos()
			self.frame.Show()
    def __init__(self, parent, title):
        super(Quant, self).__init__(parent, title=title, size=(300, 250))

        BMP = wx.Image("images/bull_n_bear1.jpg").ConvertToBitmap()
        dc = wx.MemoryDC()
        dc.SelectObject(BMP)
        self.splash = GaugeSplash(BMP)
        self.splash.CenterOnScreen()
        self.splash.Show()
        wx.Yield()
        self.loc = wx.IconLocation('images/program_icon.ico', 0)
        self.SetIcon(wx.IconFromLocation(self.loc))
        self.InitUI()
        self.anim = animation.FuncAnimation(self.figure1,
                                            self.animate,
                                            interval=60003)  # Intervals: 10min
        self.CenterOnScreen()
        self.Fit()
        self.SQL()
        self.Show()
 def __init__(self, engine):
     self._engine = engine
     wx.Frame.__init__(self,
                       parent=None,
                       title="CRAY ONLINE",
                       size=(1024, 768),
                       style=wx.MINIMIZE_BOX | wx.CAPTION | wx.CLOSE_BOX
                       | wx.SYSTEM_MENU)
     self.SetIcon(
         wx.IconFromLocation(
             wx.IconLocation(
                 os.path.join(self._engine.BaseDirectory,
                              'mooseduel16x16.ico'))))
     self.CenterOnScreen()
     self.Game = GamePanel(self, self._engine)
     self.Bind(wx.EVT_CLOSE, self.OnExit)
     if self.GetSetting('ShowFaceUpCardName') == 'Yes':
         self.ShowFullScreen(True,
                             style=wx.FULLSCREEN_NOCAPTION
                             | wx.FULLSCREEN_NOBORDER
                             | wx.FULLSCREEN_NOSTATUSBAR)
     if wx.DisplaySize()[0] == 1024 and wx.DisplaySize(
     )[1] == 768 or wx.DisplaySize()[1] == 720:
         if wx.MessageDialog(
                 None,
                 'Your screen resolution is low. Would you like to run in Full Screen Mode?',
                 '', wx.YES_NO | wx.ICON_QUESTION
                 | wx.YES_DEFAULT).ShowModal() == wx.ID_YES:
             self.ShowFullScreen(True,
                                 style=wx.FULLSCREEN_NOCAPTION
                                 | wx.FULLSCREEN_NOBORDER
                                 | wx.FULLSCREEN_NOSTATUSBAR)
     if wx.DisplaySize()[0] < 1024 and wx.DisplaySize()[1] < 768:
         wx.MessageDialog(
             None,
             'Your Screen Resolution is too low. Change Your Screen Resolution to at least 1024x720.',
             '', wx.OK | wx.ICON_INFORMATION).ShowModal()
Esempio n. 24
0
	def __init__(self):
		wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title=u"Проекции", size=(1024, 768), pos=(150,100))
		self.SetIcon(wx.IconFromLocation(wx.IconLocation(r'ico/p1.ico')))

		# 4 razmera vidim oblst
		self.cenx = 0
		self.ceny = 0
		self.cenz = 0
		self.cens = 1
		# 3 + 3 solu oblst
		self.scenx = 0
		self.sceny = 0
		self.scenz = 0
		self.ssizex = 100
		self.ssizey = 100
		self.ssizez = 100
		self.soluType = 3			#2d/3d
		#self.soluMethod = 0       #int/mcnp/roma
		self.blocks = []
		self.sources = []
		self.blockTypes = []
		self.bestPoints = []
		self.combo = []#subThread.getCombo(len(self.parent.blocks))
		#self.bestPoints.append(entity.BestPoints(10,10,10))
		#self.bestPoints.append(entity.BestPoints(12,12,12))
		#self.bestPoints.append(entity.BestPoints(30,30,30))
		#self.bestPoints.append(entity.BestPoints(40,40,40))
		self.readTypes()
		self.curType=1
		self.fileName = ""
		self.worked = True
		self.nx = 20
		self.ny = 20
		self.nz = 20
		self.mnx = 20	#dlya writemesh
		self.mny = 20
		self.mnz = 20
		self.curBestPoint = -1
		self.kvantil = -1
		self.fon = -1
		self.vremya = -1

		# blocks.append(entity.Block(self))
		# blocks.append(entity.Block(self))
		# blocks[0].name = "ccc1"
		# blocks[1].name = "ccc2"
		# print blocks[0].name, blocks[1].name

		sizerMain = wx.BoxSizer( wx.VERTICAL )           #sozdali glavnyi sizer v kotoryi vlojili tool bar i vse ostalnoe
		self.tBar = toolBar.CreateToolBar(self)          #sozdali toolbar
		sizerContent = wx.GridSizer( 0, 2, 0, 0 )        #sozdali sizer dlya content
		sizerSetPanels = wx.BoxSizer( wx.VERTICAL )      #sozdali sizer dlya panelei na set paneli
		self.panelXZ = panels.PanelGraph(self, myid=0)   #sozdali panel
		self.panelYZ = panels.PanelGraph(self, myid=1)
		self.panelXY = panels.PanelGraph(self, myid=2)
		self.panelSet = panels.PanelSet(self)           #panel set na kotoroi budut knopki pereklucheniya na druguy panel
		self.curPanel = 0
		self.panelBlocks = panels.PanelBlocks(self)     #panel nastroiki blokov
		self.panelBlocks.Hide()
		self.panelSources = panels.PanelSources(self)   #panel nastroiki istochnikov
		self.panelSources.Hide()
		self.panelArea = panels.PanelArea(self)         #panel nastroiki oblasti
		self.panelArea.Hide()
		self.panelSolution = panels.PanelSolution(self) #panel nastroiki vychisleni
		self.panelSolution.Hide()

		sizerSetPanels.Add( self.panelSet, 1, wx.EXPAND )
		sizerSetPanels.Add( self.panelBlocks, 1, wx.EXPAND )
		sizerSetPanels.Add( self.panelSources, 1, wx.EXPAND )
		sizerSetPanels.Add( self.panelArea, 1, wx.EXPAND )
		sizerSetPanels.Add( self.panelSolution, 1, wx.EXPAND )

		sizerContent.Add( self.panelXZ, 1, wx.EXPAND |wx.BOTTOM|wx.LEFT, 1 )     #polojili paneli v contentsizer
		sizerContent.Add( self.panelYZ, 1, wx.EXPAND |wx.BOTTOM|wx.LEFT, 1 )
		sizerContent.Add( self.panelXY, 1, wx.EXPAND |wx.BOTTOM|wx.LEFT, 1 )
		sizerContent.Add( sizerSetPanels, 1, wx.EXPAND |wx.BOTTOM|wx.LEFT, 1 )

		#self.SetBackgroundColour("yellow")     #++++++++++++++++++++++++++UBRAT

		#sizerMain.Add( self.tBar, 0, wx.EXPAND|wx.BOTTOM, 4 )             #polojili toolbar v mainsizer
		sizerMain.Add( sizerContent, 1, wx.EXPAND, 5 )                    #polojili contentsizer v mainsizer
		self.SetSizer( sizerMain )
		self.Layout()

		self.statusbar = ESB.EnhancedStatusBar(self, -1)
		self.statusbar.SetSize((-1, 23))
		self.statusbar.SetFieldsCount(1)
		self.SetStatusBar(self.statusbar)
		self.gauge = wx.Gauge(self.statusbar, -1, 100, pos=(0,2))
		#self.gauge.Hide()
		bmpBuf = wx.ArtProvider_GetBitmap(wx.ART_ERROR,
										wx.ART_TOOLBAR, (16,16))

		self.btnThreadCancel = wx.StaticBitmap(self.statusbar, -1, bmpBuf, pos=(190,2))
		self.btnThreadCancel.Bind(wx.EVT_LEFT_UP, self.abortThread)
		self.gauge.Hide()
		self.btnThreadCancel.Hide()
		self.statictext = wx.StaticText(self.statusbar, -1, "", pos=(350,2))

		#self.Bind(wx.EVT_IDLE, self.IdleHandler)
		# Set up event handler for any worker thread results
		subThread.EVT_RESULT(self, self.checkThread)

		self.Bind(wx.EVT_SIZE, self.OnSize)
    def __init__(self, parent, fileName):

        self.parent = parent
        self.fileName = fileName

        self.normalFont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
        self.normalFont.SetPointSize(self.normalFont.GetPointSize() + 1)
        self.smallerFont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)

        self.greyColour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)

        if os.path.isdir(fileName):
            self.text = fileName
            bitmap = wx.Bitmap(os.path.join(bitmapDir, "folder.png"),
                               wx.BITMAP_TYPE_PNG)
            self.icon = wx.IconFromBitmap(bitmap)
            self.description = ""
            return

        self.text = os.path.split(fileName)[1]
        extension = os.path.splitext(fileName)[1]

        if not extension:
            self.text = fileName
            bitmap = wx.Bitmap(os.path.join(bitmapDir, "empty_icon.png"),
                               wx.BITMAP_TYPE_PNG)
            self.icon = wx.IconFromBitmap(bitmap)
            self.description = "File"
            return

        fileType = wx.TheMimeTypesManager.GetFileTypeFromExtension(extension)

        bmp = wx.Bitmap(os.path.join(bitmapDir, "empty_icon.png"),
                        wx.BITMAP_TYPE_PNG)
        bmp = wx.IconFromBitmap(bmp)

        if not fileType:
            icon = wx.IconFromLocation(wx.IconLocation(fileName))
            if not icon.IsOk():
                self.icon = bmp
            else:
                self.icon = icon

            self.description = "%s File" % extension[1:].upper()
            return

        #------- Icon info
        info = fileType.GetIconInfo()
        icon = None

        if info is not None:
            icon, file, idx = info
            if icon.IsOk():
                bmp = icon
            else:
                icon = None

        if icon is None:
            icon = wx.IconFromLocation(wx.IconLocation(fileName))
            if icon.IsOk():
                bmp = icon
            else:
                command = fileType.GetOpenCommand(fileName)
                command = " ".join(command.split()[0:-1])
                command = command.replace('"', "")
                if " -" in command:
                    command = command[0:command.index(" -")]

                icon = wx.IconFromLocation(wx.IconLocation(command))
                if icon.IsOk():
                    bmp = icon

        self.icon = bmp
        self.description = convert(fileType.GetDescription())

        if not self.description:
            self.description = "%s File" % extension[1:].upper()
Esempio n. 26
0
    def __init__(self, url=None, popup=False, params=None):
        if popup:
            title = os.path.basename(url)
        else:
            title = "Kam1n0"
        wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title=title)
        size = (800, 500)

        # icon
        #setup icon object
        #icon = wx.Icon(GetApplicationPath("www/img/favicon.ico"), wx.BITMAP_TYPE_ICO)

        #setup taskbar icon
        #tbicon = wx.TaskBarIcon()
        #tbicon.SetIcon(icon, "McGill Icon")
        loc = wx.IconLocation(GetApplicationPath("www/img/favicon.ico"), 0)
        self.SetIcon(wx.IconFromLocation(loc))

        # This is an optional code to enable High DPI support.
        if "auto_zooming" in g_applicationSettings \
                and g_applicationSettings["auto_zooming"] == "system_dpi":
            # This utility function will adjust width/height using
            # OS DPI settings. For 800/600 with Win7 DPI settings
            # being set to "Larger 150%" will return 1200/900.
            size = cefpython.DpiAware.CalculateWindowSize(size[0], size[1])

        self.SetSize(size)

        global gdata
        if gdata is None:
            gdata = GetData()

        gdp = json.loads(gdata)

        if not url:
            url = gdp['url']
            # Test hash in url.
            # url += "#test-hash"

        # self.CreateMenu()

        if TEST_EMBEDDING_IN_PANEL:
            print("Embedding in a wx.Panel!")
            # You also have to set the wx.WANTS_CHARS style for
            # all parent panels/controls, if it's deeply embedded.
            self.mainPanel = wx.Panel(self, style=wx.WANTS_CHARS)

        # Global client callbacks must be set before browser is created.
        self.clientHandler = ClientHandler()
        cefpython.SetGlobalClientCallback(
            "OnCertificateError", self.clientHandler._OnCertificateError)
        cefpython.SetGlobalClientCallback(
            "OnBeforePluginLoad", self.clientHandler._OnBeforePluginLoad)
        cefpython.SetGlobalClientCallback("OnAfterCreated",
                                          self.clientHandler._OnAfterCreated)

        windowInfo = cefpython.WindowInfo()
        windowInfo.SetAsChild(self.GetHandleForBrowser())
        self.browser = cefpython.CreateBrowserSync(
            windowInfo, browserSettings=g_browserSettings, navigateUrl=url)

        self.clientHandler.mainBrowser = self.browser
        self.browser.SetClientHandler(self.clientHandler)

        jsBindings = cefpython.JavascriptBindings(bindToFrames=False,
                                                  bindToPopups=True)

        self.javascriptExternal = JavascriptExternal(self.browser, gdata)
        jsBindings.SetObject("external", self.javascriptExternal)
        jsBindings.SetProperty("GData", gdata)
        if not params is None:
            jsBindings.SetProperty("params", params)
        self.browser.SetJavascriptBindings(jsBindings)

        if self.mainPanel:
            self.mainPanel.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
            self.mainPanel.Bind(wx.EVT_SIZE, self.OnSize)
        else:
            self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
            self.Bind(wx.EVT_SIZE, self.OnSize)

        self.Bind(wx.EVT_CLOSE, self.OnClose)
        if USE_EVT_IDLE and not popup:
            # Bind EVT_IDLE only for the main application frame.
            print("Using EVT_IDLE to execute the CEF message loop work")
            self.Bind(wx.EVT_IDLE, self.OnIdle)
Esempio n. 27
0
    def init_frame(self):
        self.inputEvaluated = False

        self.frame = self.res.LoadFrame(None, 'MakeTarget')
        # Load panel separately (no idea how to make it a child of frame in wxformbuilder)
        # Using a panel fixes the dark grey background in windows
        self.panel = self.res.LoadPanel(self.frame, "MakeTargetPanel")

        # Do this explicitly to fix layout in windows
        topSizer = wx.BoxSizer(wx.VERTICAL)
        self.frame.SetSizer(topSizer)

        topSizer.Add(self.panel, 1, wx.EXPAND)

        # Force this here as it does not work specifying it in xrc
        self.frame.SetMinSize((500, 520))

        # Fix layout after adding panel to frame (this is needed on windows)
        self.panel.Layout()
        self.frame.Layout()
        self.panel.Layout()

        # Set title bar icon
        if os.path.isfile("resources/makehuman.ico"):
            loc = wx.IconLocation(r'resources/makehuman.ico', 0)
            self.frame.SetIcon(wx.IconFromLocation(loc))

        if DEBUG:
            self.frame.SetTitle("MakeTarget (v%s) (DEBUG mode)" %
                                str(maketarget.VERSION))
        else:
            self.frame.SetTitle("MakeTarget (v%s)" % str(maketarget.VERSION))

        self.status = xrc.XRCCTRL(self.panel, 'status_label')

        self.inputTypeRadio = xrc.XRCCTRL(self.panel, 'input_type')
        self.frame.Bind(wx.EVT_RADIOBOX, self.inputTypeChanged,
                        self.inputTypeRadio)

        self.infolderTypeRadio = xrc.XRCCTRL(self.panel, 'infolder_type')

        self.inputField = xrc.XRCCTRL(self.panel, 'input_ctrl')
        self.frame.Bind(wx.EVT_TEXT, self.validateInput, self.inputField)

        self.inputBrowseBtn = xrc.XRCCTRL(self.panel, 'input_browse_btn')
        self.frame.Bind(wx.EVT_BUTTON, self.browseInputFile,
                        self.inputBrowseBtn)

        self.inputClrBtn = xrc.XRCCTRL(self.panel, 'input_clear_btn')
        self.frame.Bind(wx.EVT_BUTTON, self.clearInput, self.inputClrBtn)

        self.targetsToAddList = xrc.XRCCTRL(self.panel, 'addTarget_list')

        self.addTarget_addBtn = xrc.XRCCTRL(self.panel, 'addTarget_list_add')
        self.frame.Bind(wx.EVT_BUTTON, self.addTargetToAdd,
                        self.addTarget_addBtn)

        self.addTarget_remBtn = xrc.XRCCTRL(self.panel, 'addTarget_list_rem')
        self.frame.Bind(wx.EVT_BUTTON, self.remTargetToAdd,
                        self.addTarget_remBtn)

        self.targetsToSubList = xrc.XRCCTRL(self.panel, 'subTarget_list')

        self.subTarget_addBtn = xrc.XRCCTRL(self.panel, 'subTarget_list_add')
        self.frame.Bind(wx.EVT_BUTTON, self.addTargetToSub,
                        self.subTarget_addBtn)

        self.subTarget_remBtn = xrc.XRCCTRL(self.panel, 'subTarget_list_rem')
        self.frame.Bind(wx.EVT_BUTTON, self.remTargetToSub,
                        self.subTarget_remBtn)

        self.outputField = xrc.XRCCTRL(self.panel, 'output_path_ctrl')
        self.frame.Bind(wx.EVT_TEXT, self.validateInput, self.outputField)

        self.outputTypeRadio = xrc.XRCCTRL(self.panel, 'output_type_options')
        self.frame.Bind(wx.EVT_RADIOBOX, self.outputTypeChanged,
                        self.outputTypeRadio)

        self.outputBrowseBtn = xrc.XRCCTRL(self.panel, 'output_browse_btn')
        self.frame.Bind(wx.EVT_BUTTON, self.browseOutputFile,
                        self.outputBrowseBtn)

        self.makeBtn = xrc.XRCCTRL(self.panel, 'make_btn')
        self.frame.Bind(wx.EVT_BUTTON, self.makeTarget, self.makeBtn)

        self.inputTypeChanged(None)
        self.outputTypeChanged(None)

        self.frame.Show()
Esempio n. 28
0
    def __init__(self, parent, title, xSize, ySize, panelWidth):
        wx.Frame.__init__(self,
                          parent,
                          panelWidth,
                          title=title,
                          size=(xSize, ySize))

        loc = wx.IconLocation('OFSI.ico', 0)
        self.SetIcon(wx.IconFromLocation(loc))

        #timer used for data-acquisition
        self.stepTimer = wx.Timer(self)

        #setting up variable with default values
        self.userInput = [
            'grblPort', 'step', 'travel', 'AI-', 'duration', 'propPort'
        ]
        self.grblPort = dataInput[0]
        self.step = dataInput[1]
        self.travel = dataInput[2]
        self.analogIn = dataInput[3]
        self.duration = dataInput[4]
        self.propPort = dataInput[5]

        print "default values: ", self.grblPort, self.step, self.travel,\
                        self.analogIn, self.duration, self.propPort

        #setting up a vertically-split window
        self.splitter = wx.SplitterWindow(self, -1, style=wx.SP_LIVE_UPDATE)
        font = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                       wx.FONTWEIGHT_NORMAL, False)

        self.grblPanel = wx.Panel(self.splitter, -1)
        self.graphPanel = wx.Panel(self.splitter, -1)
        self.graphPanel.SetBackgroundColour(wx.WHITE)

        self.splitter.SplitVertically(self.grblPanel, self.graphPanel,
                                      panelWidth)

        self.grblLabel = wx.StaticText(self.grblPanel, -1, 'XY Stage Controls')
        self.grblLabel.SetFont(font)
        self.controlLabel = wx.StaticText(self.grblPanel, -1, 'Data Controls')
        self.controlLabel.SetFont(font)

        # add plot
        self.plotSizer = wx.BoxSizer(wx.VERTICAL)
        self.plot = wx.lib.plot.PlotCanvas(self.graphPanel,
                                           size=wx.Size(500, 500),
                                           style=wx.EXPAND)
        self.plot.SetShowScrollbars(False)

        #defining event handlers
        def getComPort(event):
            self.grblPort = self.comPort.GetValue()
            print "selected port: ", self.grblPort
            dataInput[0] = self.grblPort
            return self.grblPort

        def getStep(event):
            self.step = float(self.stepSize.GetValue())
            print "step: ", self.step
            dataInput[1] = self.step
            return self.step

        def getTravel(event):
            self.travel = float(self.totalTravel.GetValue())
            print "travel: ", self.travel
            dataInput[2] = self.travel
            return self.travel

        def getPropPort(event):
            self.propPort = self.propComPort.GetValue()
            print "selected prop port: ", self.propPort
            dataInput[5] = self.propPort
            return self.propPort

        def getChanIn(event):
            self.analogIn = self.chanIn.GetValue()
            print "selected AI-", self.analogIn
            dataInput[3] = self.analogIn
            updateGraph(self.plot)
            return self.analogIn

        def getDuration(event):
            self.duration = float(self.durAcq.GetValue())
            print "duration: ", self.duration
            dataInput[4] = self.duration
            return self.duration

        def getBillboard(event):
            #time.sleep(1)
            billboard = BillboardDisplay(self, dataInput)
            billboard.Show()

        def moveLeft(event):
            global s
            grblPort = dataInput[0]
            step = dataInput[1]
            try:
                if s is None:
                    startArduino(grblPort)
                else:
                    if not s.isOpen():
                        s.open()
            except:
                startArduino(grblPort)
            gcode = 'G01 X-' + str(step)
            sendCode(gcode)

        def moveRight(event):
            global s
            grblPort = dataInput[0]
            step = dataInput[1]
            try:
                if s is None:
                    startArduino(grblPort)
                else:
                    if not s.isOpen():
                        s.open()
            except:
                startArduino(grblPort)
            gcode = 'G01 X' + str(step)
            sendCode(gcode)

        def moveDown(event):
            global s
            grblPort = dataInput[0]
            step = dataInput[1]
            try:
                if s is None:
                    startArduino(grblPort)
                else:
                    if not s.isOpen():
                        s.open()
            except:
                startArduino(grblPort)
            gcode = 'G01 Y-' + str(step)
            sendCode(gcode)

        def moveUp(event):
            global s
            grblPort = dataInput[0]
            step = dataInput[1]
            try:
                if s is None:
                    startArduino(grblPort)
                else:
                    if not s.isOpen():
                        s.open()
            except:
                startArduino(grblPort)
            gcode = 'G01 Y' + str(step)
            sendCode(gcode)

        def getStart(event):
            self.value = self.pulseBtn.GetValue()
            if self.value:
                if len(data) != 0:
                    del data[0:len(data)]
                self.btnLabel.SetLabel('STOP')
                imgData = startScan(self, self.plot)
                #print "RETURNING - COMPLETE"
                #print imgData
            else:
                self.btnLabel.SetLabel('START')

        def getSave(event):
            print "saving data..."
            header = "Data from AutoScan2D V03"
            saveData(self, header)

        # grbl-COM-Port combobox Control
        self.portList = [
            'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8', 'COM9', 'COM10',
            'COM11', 'COM12', 'COM13'
        ]
        self.portLabel = wx.StaticText(self.grblPanel, label="Grbl Port")
        self.comPort = wx.ComboBox(self.grblPanel,
                                   choices=self.portList,
                                   value=self.grblPort,
                                   style=wx.CB_READONLY)
        self.Bind(wx.EVT_COMBOBOX, getComPort, self.comPort)
        s1 = wx.BoxSizer(wx.HORIZONTAL)
        s1.Add(self.portLabel, 0, wx.ALL, 5)
        s1.Add(self.comPort, 0, wx.ALL, 5)

        #step size entry box
        self.stepLabel = wx.StaticText(self.grblPanel, wx.ID_ANY, 'Step Size')
        self.stepSize = wx.TextCtrl(self.grblPanel,
                                    wx.ID_ANY,
                                    str(self.step),
                                    style=wx.TE_PROCESS_ENTER)
        self.stepSize.Bind(wx.EVT_TEXT_ENTER, getStep)
        s2 = wx.BoxSizer(wx.HORIZONTAL)
        s2.Add(self.stepLabel, 0, wx.ALL, 5)
        s2.Add(self.stepSize, 0, wx.ALL, 5)

        #total travel entry box
        self.travelLabel = wx.StaticText(self.grblPanel, wx.ID_ANY,
                                         'Total Travel')
        self.totalTravel = wx.TextCtrl(self.grblPanel,
                                       wx.ID_ANY,
                                       str(self.travel),
                                       style=wx.TE_PROCESS_ENTER)
        self.totalTravel.Bind(wx.EVT_TEXT_ENTER, getTravel)
        s3 = wx.BoxSizer(wx.HORIZONTAL)
        s3.Add(self.travelLabel, 0, wx.ALL, 5)
        s3.Add(self.totalTravel, 0, wx.ALL, 5)

        # CH-IN combobox Control
        self.chanList = ['0', '1', '2', '3']
        self.chanLabel = wx.StaticText(self.grblPanel, label="Analog Input")
        self.chanIn = wx.ComboBox(self.grblPanel,
                                  choices=self.chanList,
                                  value=self.analogIn,
                                  style=wx.CB_READONLY)
        self.Bind(wx.EVT_COMBOBOX, getChanIn, self.chanIn)
        s21 = wx.BoxSizer(wx.HORIZONTAL)
        s21.Add(self.chanLabel, 0, wx.ALL, 5)
        s21.Add(self.chanIn, 0, wx.ALL, 5)

        #acquisition duration entry box
        self.durationLabel = wx.StaticText(self.grblPanel, wx.ID_ANY,
                                           'Duration')
        self.durAcq = wx.TextCtrl(self.grblPanel,
                                  wx.ID_ANY,
                                  str(self.duration),
                                  style=wx.TE_PROCESS_ENTER)
        self.durAcq.Bind(wx.EVT_TEXT_ENTER, getDuration)
        s22 = wx.BoxSizer(wx.HORIZONTAL)
        s22.Add(self.durationLabel, 0, wx.ALL, 5)
        s22.Add(self.durAcq, 0, wx.ALL, 5)

        # Prop COM-Port combobox Control
        self.propPortLabel = wx.StaticText(self.grblPanel, label="Prop Port")
        self.propComPort = wx.ComboBox(self.grblPanel,
                                       choices=self.portList,
                                       value=self.propPort,
                                       style=wx.CB_READONLY)
        self.Bind(wx.EVT_COMBOBOX, getPropPort, self.propComPort)
        s23 = wx.BoxSizer(wx.HORIZONTAL)
        s23.Add(self.propPortLabel, 0, wx.ALL, 5)
        s23.Add(self.propComPort, 0, wx.ALL, 5)

        #setting up "billboard" button
        self.billboardBox = wx.StaticBox(self.grblPanel, -1,
                                         'Display Live Data')
        self.billboardBox.SetFont(font)
        s24 = wx.StaticBoxSizer(self.billboardBox, wx.VERTICAL)
        self.billboardBtn = wx.Button(self.grblPanel,
                                      id=wx.ID_ANY,
                                      label=" - BILLBOARD - ",
                                      size=(140, -1))
        self.billboardBtn.Bind(wx.EVT_BUTTON, getBillboard)
        s24.Add(self.billboardBtn, 0, wx.EXPAND, 0)

        #setting up manual movement of stage
        self.moveStageBox = wx.StaticBox(self.grblPanel, -1, 'Move Stage')
        self.moveStageBox.SetFont(font)
        s25 = wx.StaticBoxSizer(self.moveStageBox, wx.VERTICAL)
        self.stageNote = wx.StaticText(self.grblPanel,
                                       label='(increments of Step Size)')
        stageNoteSizer = wx.BoxSizer(wx.VERTICAL)
        stageNoteSizer.Add(self.stageNote, 0, wx.ALIGN_CENTER)
        stageNoteSizer.AddSpacer(10)
        s25.Add(stageNoteSizer, 0, wx.ALIGN_LEFT, 0)

        #Added labels X and Y, and buttons Dwon and Up - FD 31may18

        self.horizontalNote = wx.StaticText(self.grblPanel,
                                            label="Horizontal X")
        horizontalNoteSizer = wx.BoxSizer(wx.VERTICAL)
        horizontalNoteSizer.Add(self.horizontalNote, 0, wx.ALIGN_CENTER)
        s25.Add(horizontalNoteSizer, 0, wx.ALIGN_CENTER, 0)

        self.moveLeftBtn = wx.Button(self.grblPanel,
                                     id=wx.ID_ANY,
                                     label=" <<< ",
                                     size=(70, -1))
        self.moveRightBtn = wx.Button(self.grblPanel,
                                      id=wx.ID_ANY,
                                      label=" >>> ",
                                      size=(70, -1))
        self.moveLeftBtn.Bind(wx.EVT_BUTTON, moveLeft)
        self.moveRightBtn.Bind(wx.EVT_BUTTON, moveRight)
        moveBtnSizer = wx.BoxSizer(wx.HORIZONTAL)
        moveBtnSizer.Add(self.moveLeftBtn, 0, wx.CENTER)
        moveBtnSizer.Add(self.moveRightBtn, 0, wx.CENTER)
        s25.Add(moveBtnSizer, 0, wx.EXPAND, 0)

        self.verticalNote = wx.StaticText(self.grblPanel, label="Vertical Y")
        verticalNoteSizer = wx.BoxSizer(wx.VERTICAL)
        verticalNoteSizer.Add(self.verticalNote, 0, wx.ALIGN_CENTER)
        s25.Add(verticalNoteSizer, 0, wx.ALIGN_CENTER, 0)

        self.moveDownBtn = wx.Button(self.grblPanel,
                                     id=wx.ID_ANY,
                                     label="\/ \/",
                                     size=(70, -1))
        self.moveUpBtn = wx.Button(self.grblPanel,
                                   id=wx.ID_ANY,
                                   label=" /\ /\ ",
                                   size=(70, -1))
        self.moveDownBtn.Bind(wx.EVT_BUTTON, moveDown)
        self.moveUpBtn.Bind(wx.EVT_BUTTON, moveUp)
        moveYBtnSizer = wx.BoxSizer(wx.HORIZONTAL)
        moveYBtnSizer.Add(self.moveDownBtn, 0, wx.CENTER)
        moveYBtnSizer.Add(self.moveUpBtn, 0, wx.CENTER)
        s25.Add(moveYBtnSizer, 0, wx.EXPAND, 0)

        #setting up START toggle button with custom bitmap
        self.pulseOn = scale_bitmap(wx.Bitmap("record-button-on.png"), btnSize,
                                    btnSize)
        self.pulseOff = scale_bitmap(wx.Bitmap("record-button-off.png"),
                                     btnSize, btnSize)

        self.btnLabel = wx.StaticText(self.grblPanel, label="START")
        self.pulseBtn = buttons.GenBitmapToggleButton(self.grblPanel,
                                                      id=wx.ID_ANY,
                                                      bitmap=self.pulseOff)
        self.pulseBtn.SetBitmapSelected(self.pulseOn)
        self.pulseBtn.Bind(wx.EVT_BUTTON, getStart)

        s31 = wx.BoxSizer(wx.VERTICAL)
        s31.Add(self.btnLabel, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
        s31.Add(self.pulseBtn, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)

        #setting up "SAVE" button
        self.saveBtn = wx.Button(self.grblPanel, id=wx.ID_ANY, label="SAVE")
        self.saveBtn.Bind(wx.EVT_BUTTON, getSave)
        s31.Add(self.saveBtn, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)

        #setting up the sizers for grblPanel
        grblPnlLblSizr = wx.BoxSizer(wx.HORIZONTAL)
        grblPnlLblSizr.Add(self.grblLabel, wx.ALL, 10)

        controlLblSizr = wx.BoxSizer(wx.HORIZONTAL)
        controlLblSizr.Add(self.controlLabel, wx.ALL, 10)

        grblPnlSizr = wx.BoxSizer(wx.VERTICAL)
        grblPnlSizr.Add(grblPnlLblSizr, 0, wx.CENTER)
        grblPnlSizr.Add(wx.StaticLine(self.grblPanel, ), 0, wx.ALL | wx.EXPAND,
                        5)
        grblPnlSizr.Add(s1, 0, wx.CENTER)
        grblPnlSizr.Add(s2, 0, wx.CENTER)
        grblPnlSizr.Add(s3, 0, wx.CENTER)
        grblPnlSizr.Add(s25, 0, wx.CENTER)
        grblPnlSizr.AddSpacer(8)
        grblPnlSizr.Add(controlLblSizr, 0, wx.CENTER)
        grblPnlSizr.Add(wx.StaticLine(self.grblPanel, ), 0, wx.ALL | wx.EXPAND,
                        5)
        grblPnlSizr.Add(s21, 0, wx.CENTER)
        grblPnlSizr.Add(s22, 0, wx.CENTER)
        grblPnlSizr.Add(s23, 0, wx.CENTER)
        grblPnlSizr.AddSpacer(8)
        grblPnlSizr.Add(s24, 0, wx.CENTER)
        grblPnlSizr.AddSpacer(15)
        grblPnlSizr.Add(s31, 0, wx.CENTER)

        self.grblPanel.SetSizer(grblPnlSizr)

        #updating data graphing
        updateGraph(self.plot)

        #setting up sizers for graphPanel
        self.plotSizer.Add(self.plot, 1, wx.EXPAND, 0)

        graphPnlSizr = wx.BoxSizer(wx.VERTICAL)
        graphPnlSizr.Add(self.plotSizer, 1, wx.EXPAND, 0)

        self.graphPanel.SetSizer(graphPnlSizr)
        self.Layout()

        self.Bind(wx.EVT_CLOSE, self.OnClose)
Esempio n. 29
0
 def __init__(self, parent, title, size=None):
     super(MainWindow,
           self).__init__(parent,
                          title=title,
                          style=wx.MINIMIZE_BOX | wx.CAPTION | wx.CLOSE_BOX)
     self.Centre()
     self.SetMinSize((550, 250))
     self.SetMaxSize((551, 251))
     wsize = self.GetSize()[1]
     ID_ANOTHER = 0
     ico = wx.IconLocation(r'/usr/share/icons/tasks.png')
     default_font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
     self.SetIcon(wx.IconFromLocation(ico))
     menubar = wx.MenuBar()
     filemenu = wx.Menu()
     create_menu = filemenu.Append(ID_ANOTHER, 'Criar\tCTRL+C',
                                   'Criar uma nova tarefa')
     exit_menu = filemenu.Append(wx.ID_EXIT, 'Sair', 'Sair da aplicação')
     helpmenu = wx.Menu()
     credits_menu = helpmenu.Append(ID_ANOTHER + 1, 'Créditos',
                                    'Ver créditos')
     menubar.Append(filemenu, '&Arquivo')
     menubar.Append(helpmenu, '&Ajuda')
     self.SetMenuBar(menubar)
     self.Bind(wx.EVT_MENU, self.on_quit, exit_menu)
     self.Bind(wx.EVT_MENU, self.create_task, create_menu)
     self.Bind(wx.EVT_MENU, self.show_credits, credits_menu)
     self.current_crons = self.current_cron()
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer_one = wx.BoxSizer(wx.VERTICAL)
     sizer_two = wx.BoxSizer(wx.HORIZONTAL)
     sizer.AddSizer(sizer_one)
     sizer.AddSizer(sizer_two)
     if self.current_crons > 0:
         msg = "\t\t\t\t\tVocê tem tarefa(s) já feita(s)\n"
         self.txt = wx.StaticText(self, label="%s" % (msg))
         self.txt.SetFont(default_font)
         sizer_one.Add(self.txt, 0, wx.ALIGN_CENTER, 0)
     else:
         msg = "\t\t\tVocê ainda não tem tarefa(s). Faça alguma!\n"
         self.txt = wx.StaticText(self, label="%s" % (msg))
         self.txt.SetFont(default_font)
         sizer_one.Add(self.txt, 0, wx.ALIGN_CENTER, 0)
     h = wx.StaticText(self, label="Hora")
     self.hora_escolha = wx.SpinCtrl(self, value='0', min=0, max=24)
     sizer_two.Add(h, 0, wx.CENTER, 1)
     sizer_two.Add(self.hora_escolha, 0, wx.CENTER, 2)
     m = wx.StaticText(self, label="Minuto")
     self.min_escolha = wx.SpinCtrl(self, value='0', min=0, max=60)
     sizer_two.Add(m, 0, wx.CENTER, 2)
     sizer_two.Add(self.min_escolha, 0, wx.CENTER, 2)
     d = wx.StaticText(self, label="Dia")
     self.dia_escolha = wx.SpinCtrl(self, value='1', min=1, max=31)
     sizer_two.Add(d, 0, wx.CENTER, 3)
     sizer_two.Add(self.dia_escolha, 0, wx.CENTER, 3)
     mes = wx.StaticText(self, label="Mês")
     self.mes_escolha = wx.SpinCtrl(self, value='1', min=1, max=12)
     sizer_two.Add(mes, 0, wx.CENTER, 3)
     sizer_two.Add(self.mes_escolha, 0, wx.CENTER, 3)
     dia_semana = wx.StaticText(self, label="Dia da semana")
     self.dia_semana_escolha = wx.SpinCtrl(self, value='1', min=1, max=7)
     sizer.Add(dia_semana, 0, wx.CENTER, 4)
     sizer.Add(self.dia_semana_escolha, 0, wx.CENTER, 4)
     scp = wx.StaticText(self, label="Script/comando")
     self.scp_cmd = wx.TextCtrl(self, size=(wsize - 25, 30))
     sizer.Add(scp, 0, wx.CENTER, 4)
     sizer.Add(self.scp_cmd, 0, wx.CENTER, 4)
     self.tornar = wx.CheckBox(self, label="Tornar executável")
     sizer.Add(self.tornar, 0, wx.CENTER, 5)
     btn = wx.Button(self, label="Criar tarefa")
     self.Bind(wx.EVT_BUTTON, self.make_executable, btn)
     self.Bind(wx.EVT_BUTTON, self.create_task, btn)
     sizer.Add(btn, 0, wx.CENTER, 5)
     self.SetSizer(sizer)
     self.Show()