示例#1
0
class VideoConverter(wx.App):
    def OnInit(self):
        self.m_frame = MainFrame(None)
        self.m_frame.Center(wx.BOTH)
        self.m_frame.Show()
        self.SetTopWindow(self.m_frame)
        return True
示例#2
0
class Application(wx.App):
    """The application class for Cain."""
    def __init__(self):
        """Construct the base class and redirect the output."""
        if not sys.platform in ('win32', 'win64'):
            wx.App.__init__(self, redirect=True, filename="ErrorLog.txt")
        else:
            # On windows we might not have write permission for the log file.
            wx.App.__init__(self)

    def OnInit(self):
        # Splash screen.
        image = wx.Image(os.path.join(resourcePath, "gui/splash.png"),
                         wx.BITMAP_TYPE_PNG)
        bmp = image.ConvertToBitmap()
        wx.SplashScreen(bmp, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
                        2000, None, -1)
        wx.Yield()
        # Main window.
        self.frame = MainFrame()
        self.frame.Show()
        self.SetTopWindow(self.frame)
        return True

    def readInitialFile(self, inputFileName):
        self.frame.readFile(inputFileName, False)
示例#3
0
文件: Main.py 项目: XPsoud/wxSnippets
    def OnInit(self):
        print('Running wxPython ' + wx.version())
        # Set Current directory to the one containing this file
        os.chdir(os.path.dirname(os.path.abspath(__file__)))

        self.SetAppName('SettingsManager')

        s = SettingsManager()
        s.ReadSettings()
        self._snglInstChecker = wx.SingleInstanceChecker()
        self._snglInstChecker.CreateDefault()
        if self._snglInstChecker.IsAnotherRunning(
        ) and not s.MultipleInstancesAllowed:
            wx.MessageBox(
                'Another instance of this application is already running!',
                'Multiple instances not allowed',
                wx.OK | wx.ICON_EXCLAMATION | wx.CENTER)
            return False

        # Create the main window
        frm = MainFrame()
        self.SetTopWindow(frm)

        frm.Show()
        return True
示例#4
0
def main():
    logger.info('run')
    logger.debug('debug')
    application = wx.App()
    frame = MainFrame()
    frame.Show()
    application.MainLoop()
示例#5
0
class MainController(object):
    def __init__(self, application):
        self.app = application

        self.mainFrame = MainFrame(None)
        self.mainFrame.SetTitle(res.APPLICATION_NAME)

        self.mainFrame.Show()
示例#6
0
class PicasaDownload(wx.App):
    def OnInit(self):
        self.m_frame = MainFrame(None)
        self.m_frame.Center(wx.BOTH)
        self.m_frame.Show()
        self.SetTopWindow(self.m_frame)

        return True
示例#7
0
 def initialize(self):
     if self.is_initialized:
         return
     self.is_initialized = True
     self.create_timer()
     frame = MainFrame()
     frame.Center()
     PublicData.MainFrom = frame
     self.SetTopWindow(frame)
     frame.Show()
示例#8
0
class MainApp(wx.App):
    def __init__(self, parent, mst):
        self.mst = mst
        wx.App.__init__(self, parent)

    def OnInit(self):
        self.mFrame = MainFrame(None, self.mst)
        self.mst.set_window(self.mFrame)
        self.mFrame.Show()
        self.SetTopWindow(self.mFrame)
        return True
示例#9
0
class Vikuraa(wx.App):
    def __init__(self, session, peripherals, parent=None):
        self.session = session
        self.peripherals = peripherals
        wx.App.__init__(self, parent)


    def OnInit(self):
        self.mainFrame = MainFrame(None, self.session, self.peripherals)
        self.mainFrame.Show()
        return True
示例#10
0
class OurApp(wx.App):
    """
    Subclass of wx.App
    Has only one frame which is also a top level frame.
    """
    def OnInit(self):
        self.mainFrame = MainFrame(parent=None,
                                   id=wx.NewId(),
                                   title=u"Reclass")
        self.SetTopWindow(self.mainFrame)
        self.mainFrame.Show()
        return True
示例#11
0
    def OnInit(self):
        print('Running wxPython ' + wx.version())
        # Set Current directory to the one containing this file
        os.chdir(os.path.dirname(os.path.abspath(__file__)))

        self.SetAppName('wxStandardPaths')

        # Create the main window
        frm = MainFrame()
        self.SetTopWindow(frm)

        frm.Show()
        return True
示例#12
0
def start_app(cl_args):
    """Execute GUI application

    :param cl_args: Dict with command-line arguments
    """
    import wx
    from MainFrame import MainFrame

    app = wx.App()
    frame = MainFrame(parent=None,
                      app_creds=(APP_NAME, APP_VERSION),
                      cl_args=cl_args)
    frame.Show()
    app.MainLoop()
示例#13
0
class scannerApp(wx.App):
    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
示例#14
0
    def sign_in(self, event):
        db = sqlite3.connect('Library.db')
        with db:
            cursor = db.cursor()
            hash_pass = hashlib.md5(self.password.Value).hexdigest()
            cursor.execute('SELECT * FROM Пользователи')
            users = cursor.fetchall()
            for each_user in users:
                login, password = each_user
                if self.login.Value == login and hash_pass == password:
                    main_frame = MainFrame()
                    main_frame.Show()
                    self.Close()
                    break

            else:
                wx.MessageBox('Пользователя с такими данными не существует.',
                              'Ошибка!', wx.OK | wx.ICON_ERROR)
示例#15
0
文件: Main.py 项目: XPsoud/wxSnippets
    def OnInit(self):
        print('Running wxPython ' + wx.version())
        # Set Current directory to the one containing this file
        os.chdir(os.path.dirname(os.path.abspath(__file__)))

        self.SetAppName('PwdProtect')

        dlg = DlgLogin(None, 'wxWidgets', 3)
        if dlg.ShowModal() != wx.ID_OK:
            wx.MessageBox('You can not access to this application!', 'Password required', wx.ICON_EXCLAMATION|wx.OK|wx.CENTER)
            return False
        dlg.Destroy()

        # Create the main window
        frm = MainFrame()
        self.SetTopWindow(frm)

        frm.Show()
        return True
示例#16
0
        self.nationalities = ['Russia', 'USA']
        self.threats = [
            'LMG', 'HMG', 'Autocannon', 'Cannon', 'ATGM', 'IR SAM', 'RDR SAM'
        ]
        self.classifications = [
            'Utility', 'Artillery', 'MLRS', 'AAA', 'SAM', 'APC', 'Armor'
        ]

    def Run(self):
        self.wxApp.MainLoop()

    def Exit(self):
        self.wxApp.ExitMainLoop()

    def LoadCachedUnits(self):
        self.units = []
        unitDirs = os.listdir(self.dataDir)

        for dir in unitDirs:
            unitName = os.path.split(dir)[1]
            unitFile = os.path.join(dir, '{0}.dat'.format(unitName))

            if os.path.exists(unitFile):
                pass


app = IdentApplication()
mainFrame = MainFrame(None, app)
mainFrame.Show(True)
app.Run()
示例#17
0
# encoding: utf8
import wx
import os
from MainFrame import MainFrame
if __name__ == '__main__':
    app = wx.App()
    frame = MainFrame()
    frame.Show()
    if not os.path.exists('script18.log'):
        wx.MessageBox('Файл лога не найден. Файл будет создан автоматически.',
                      'Файл лога не найден!',
                      wx.OK | wx.ICON_INFORMATION)
        open('script.log', 'w').close()

    app.MainLoop()
class GameOfLife(wx.App):
    def OnInit(self):
        self.m_frame = MainFrame(None)
        self.m_frame.Show()
        self.SetTopWindow(self.m_frame)
        return True
示例#19
0
class SwapManager(SwapInterface):
    """
    SWAP Management Class
    """
    def swapServerStarted(self):
        """
        SWAP server started successfully
        """
        wx.CallAfter(pub.sendMessage, "server_started", None)

        # Display event
        wx.CallAfter(pub.sendMessage, "add_event", "SWAP server started")

    def swapPacketReceived(self, packet):
        """
        New SWAP packet received
        
        @param packet: SWAP packet received
        """
        wx.CallAfter(pub.sendMessage, "packet_received", packet)

    def swapPacketSent(self, packet):
        """
        SWAP packet transmitted
        
        @param packet: SWAP packet transmitted
        """
        wx.CallAfter(pub.sendMessage, "packet_sent", packet)

    def newMoteDetected(self, mote):
        """
        New mote detected by SWAP server
        
        'mote'  Mote object
        """
        if self.dmtframe is not None:
            # Display event
            evntext = "New mote with address " + str(mote.address) + " : " + mote.definition.product + \
            " (by " + mote.definition.manufacturer + ")"
            wx.CallAfter(pub.sendMessage, "add_event", evntext)

            # Append mote to the browsing tree
            wx.CallAfter(pub.sendMessage, "add_mote", mote)

    def newEndpointDetected(self, endpoint):
        """
        New endpoint detected by SWAP server
        
        'endpoint'  Endpoint object
        """
        if self.dmtframe is not None:
            # Display event
            evntext = "New endpoint with Reg ID = " + str(
                endpoint.getRegId()) + " : " + endpoint.name
            wx.CallAfter(pub.sendMessage, "add_event", evntext)

    def moteStateChanged(self, mote):
        """
        Mote state changed
        
        'mote' Mote object
        """
        if self.dmtframe is not None:
            # Display event
            evntext = "Mote with address " + str(mote.address) + " switched to \"" + \
                SwapState.toString(mote.state) + "\""
            wx.CallAfter(pub.sendMessage, "add_event", evntext)

            # SYNC mode entered?
            if mote.state == SwapState.SYNC:
                wx.CallAfter(pub.sendMessage, "sync_received", mote)

    def moteAddressChanged(self, mote):
        """
        Mote address changed
        
        'mote'  Mote object
        """
        if self.dmtframe is not None:
            # Display event
            evntext = "Mote changed address to " + str(mote.address)
            wx.CallAfter(pub.sendMessage, "add_event", evntext)

            # Update address in tree
            wx.CallAfter(pub.sendMessage, "changed_addr", mote)

    def endpointValueChanged(self, endpoint):
        """
        Endpoint value changed
        
        'endpoint' Endpoint object
        """
        if self.dmtframe is not None:
            # Display event
            evntext = endpoint.name + " in address " + str(
                endpoint.getRegAddress(
                )) + " changed to " + endpoint.getValueInAscii()
            wx.CallAfter(pub.sendMessage, "add_event", evntext)

            # Update value in SWAP dmtframe
            wx.CallAfter(pub.sendMessage, "changed_val", endpoint)

    def parameterValueChanged(self, param):
        """
        Config parameter value changed
        
        'param' Config parameter object
        """
        if self.dmtframe is not None:
            # Display event
            evntext = param.name + " in address " + str(param.getRegAddress(
            )) + " changed to " + param.getValueInAscii()
            wx.CallAfter(pub.sendMessage, "add_event", evntext)

            # Update value in SWAP dmtframe
            wx.CallAfter(pub.sendMessage, "changed_val", param)

    def terminate(self):
        """
        Exit application
        """
        self.app.Exit()
        self.app.ExitMainLoop()

    def __init__(self, settings=None):
        """
        Class constructor
        
        @param settings: path to the main configuration file
        """
        # Callbacks not being used
        self.registerValueChanged = None

        # wxPython app
        self.app = wx.App(False)

        # Start SWAP server
        try:
            # Superclass call
            SwapInterface.__init__(self, settings, False)
            # Clear error file
            SwapException.clear()
        except SwapException as ex:
            ex.display()
            ex.log()

        # Open SWAP Device Management Tool
        self.dmtframe = MainFrame("SWAP Device Management Tool",
                                  self,
                                  server=self.server)
        #self.dmtframe.SetSize(wx.Size(370,500))
        self.app.SetTopWindow(self.dmtframe)
        self.dmtframe.CenterOnScreen()
        self.dmtframe.Show(True)

        self.app.MainLoop()
示例#20
0
文件: PyOCR.py 项目: ayoann12/pyocr
 def OnInit(self):
     wx.InitAllImageHandlers()
     frame_1 = MainFrame(None, -1, "")
     self.SetTopWindow(frame_1) 
     frame_1.Show()
     return 1
示例#21
0
 def OnInit(self):
     wx.InitAllImageHandlers()
     mainFrame = MainFrame(None, -1, "")
     self.SetTopWindow(mainFrame)
     mainFrame.Show()
     return 1
示例#22
0
 def OnInit(self):
     wx.InitAllImageHandlers()
     app = MainFrame(None, -1, "")
     self.SetTopWindow(app)
     app.Show()
     return 1
示例#23
0
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
# generated by wxGlade 0.6.3 on Wed May 13 20:53:38 2009

import wx
from MainFrame import MainFrame

if __name__ == "__main__":
    app = wx.PySimpleApp(0)
    wx.InitAllImageHandlers()
    frame_1 = MainFrame(None, -1, "")
    app.SetTopWindow(frame_1)
    frame_1.Show()
    app.MainLoop()
示例#24
0
 def OnInit(self):
     mainFrame = MainFrame(None, wx.ID_ANY, "")
     self.SetTopWindow(mainFrame)
     mainFrame.Show()
     return True
示例#25
0
import wx
from MainFrame import MainFrame

App = wx.App()

#Main Frame.
MainFrame = MainFrame(None)

# Show it.
MainFrame.Show()

# Start the event loop.
App.MainLoop()