def __init__(self): # Init the toolkit with the standard environment. self.app = WXGUIApplication() # Try to initialize args = self.app.Initialize("VenueClient", sys.argv[:1]) # Handle command line options self.__buildOptions() if not self.port: self.port = 8000 if not self.url: self.url = 'https://localhost:8000/Venues/default' # Create venue client components self.vc = VenueClient(pnode=self.pnode, port=self.port) self.vcc = VenueClientController() self.vcc.gui = Gui() self.vcc.SetVenueClient(self.vc) self.observer = Observer() self.vc.AddObserver(self.observer) # Start tests self.__StartTests() # Exit self.vc.Shutdown() sys.exit(0)
def OnInit(self): wx.InitAllImageHandlers() # Create the AG application app = WXGUIApplication() name = "SharedPaint" # Add command line options app.AddCmdLineOption(self.appurlOption) app.AddCmdLineOption(self.venueUrlOption) app.AddCmdLineOption(self.idOption) # Initialize the AG application app.Initialize(name) # Create the group panel appUrl = app.GetOption("appUrl") venueUrl = app.GetOption("venueUrl") connectionId = app.GetOption('id') frame = FrameExtended(None, -1, 'SharedPaint', appUrl, venueUrl, connectionId) frame.SetIcon(icons.getAGIconIcon()) frame.MakeMenu() frame.LoadConsole() frame.Show() frame.Centre() self.frame = frame return True
def main(): pyapp = wx.PySimpleApp() app = WXGUIApplication() try: app.Initialize("CertificateManager") except MissingDependencyError, e: if e.args[0] == 'SSL': msg = "The installed version of Python has no SSL support. Check that you\n"\ "have installed Python from python.org, or ensure SSL support by\n"\ "some other means." else: msg = "The following dependency software is required, but not available:\n\t%s\n"\ "Please satisfy this dependency and restart the software" msg = msg % e.args[0] MessageDialog(None, msg, "Initialization Error", style=wx.ICON_ERROR) sys.exit(-1)
def main(): import wx log = None signal.signal(signal.SIGINT, SignalHandler) signal.signal(signal.SIGTERM, SignalHandler) m2threading.init() # Init the toolkit with the standard environment. app = WXGUIApplication() # build options for this application portOption = Option("-p", "--port", type="int", dest="port", default=0, metavar="PORT", help="Set the port the venueclient control interface\ should listen on.") app.AddCmdLineOption(portOption) pnodeOption = Option( "--personalNode", type="int", dest="pnode", default=None, help="Run NodeService and ServiceManager with the client.") app.AddCmdLineOption(pnodeOption) urlOption = Option("--url", type="string", dest="url", default="", metavar="URL", help="URL of venue to enter on startup.") app.AddCmdLineOption(urlOption) # Try to initialize try: args = app.Initialize("VenueClient") except MissingDependencyError, e: if e.args[0] == 'SSL': msg = "The installed version of Python has no SSL support. Check that you\n"\ "have installed Python from python.org, or ensure SSL support by\n"\ "some other means." else: msg = "The following dependency software is required, but not available:\n\t%s\n"\ "Please satisfy this dependency and restart the software" msg = msg % e.args[0] MessageDialog(None, msg, "Initialization Error", style=wx.ICON_ERROR) sys.exit(-1)
if self.vbridge.is_active() or self.abridge.is_active(): return 1 else: return 0 if __name__ == "__main__": # Start broadcaster # We need the simple wx app for when the # app.HaveValidProxy() call opens a # passphrase dialog. wxapp = wxPySimpleApp() # Initialize AG environment app = WXGUIApplication() log = app.GetLog() app.AddCmdLineOption(Option("-v", "--venueUrl", dest="venueUrl", help="Connect to venue located at this url.")) app.AddCmdLineOption(Option("--videoHost", dest="videoHost", help="Host address for video source")) app.AddCmdLineOption(Option("--videoPort", dest="videoPort", help="Port for video source")) app.AddCmdLineOption(Option("--audioHost", dest="audioHost", help="Host address for audio source"))
How to use the program. """ print "%s:" % sys.argv[0] print " -a|--applicationURL : <url to application in venue>" print " -v|--venueURL : <url to venue>" print " -h|--help : print usage" print " -d|--debug : print debugging output" if __name__ == '__main__': # Create the wx python application wxapp = wx.PySimpleApp() wx.BeginBusyCursor() # Inizialize AG application app = WXGUIApplication() appurlOption = Option("-a", "--applicationURL", dest="appUrl", default=None, help="Specify an application url on the command line") venueurlOption = Option("-v", "--venueURL", dest="venueUrl", default=None, help="Specify a venue url on the command line") testOption = Option("-t", "--testMode", dest="test", action="store_true", default=None, help="Automatically create application session in venue") connectionIdOption = Option("-i", "--connectionId", dest="connectionId", default=None, help="Add connection id") app.AddCmdLineOption(connectionIdOption) app.AddCmdLineOption(appurlOption) app.AddCmdLineOption(venueurlOption) app.AddCmdLineOption(testOption) name = "SharedPDF" app.Initialize(name)
"--appURL", dest="appURL", type="string", default=None, help="Please provide an application URL in the command line") connectionIDOption = Option( "-i", "--connectionID", dest="connectionID", type="string", default=None, help="Please provide a connection ID in the command line") wx.InitAllImageHandlers() # Create the AG application app = WXGUIApplication() name = "SharedPaint 3.0" # Add command line options app.AddCmdLineOption(appURLOption) app.AddCmdLineOption(connectionIDOption) # Initialize the AG application app.Initialize(name) appURL = app.GetOption("appURL") connectionID = app.GetOption("connectionID") spApp = SharedPaintApp(appURL, connectionID) # Start the window application processing
except getopt.GetoptError: self.Usage() sys.exit(2) for o, a in opts: if o in ("-a", "--applicationURL"): self.arguments["applicationUrl"] = a elif o in ("-d", "--debug"): self.arguments["debug"] = 1 elif o in ("-h", "--help"): self.Usage() sys.exit(0) if __name__ == "__main__": app = WXGUIApplication() name = "SharedBrowser" # Parse command line options am = ArgumentManager() am.ProcessArgs() aDict = am.GetArguments() appUrl = aDict['applicationUrl'] debugMode = aDict['debug'] init_args = [] if "--debug" in sys.argv or "-d" in sys.argv: init_args.append("--debug")
class SystemTest: def __init__(self): # Init the toolkit with the standard environment. self.app = WXGUIApplication() # Try to initialize args = self.app.Initialize("VenueClient", sys.argv[:1]) # Handle command line options self.__buildOptions() if not self.port: self.port = 8000 if not self.url: self.url = 'https://localhost:8000/Venues/default' # Create venue client components self.vc = VenueClient(pnode=self.pnode, port=self.port) self.vcc = VenueClientController() self.vcc.gui = Gui() self.vcc.SetVenueClient(self.vc) self.observer = Observer() self.vc.AddObserver(self.observer) # Start tests self.__StartTests() # Exit self.vc.Shutdown() sys.exit(0) def __StartTests(self): # ------------------------------------- # EnterVenue # ------------------------------------- self.__testMethod(self.vc.EnterVenue, "EnterVenue", args = [self.url]) # ------------------------------------- # Services # ------------------------------------- # AddService service = ServiceDescription("test", "test", "test", "test") service.SetId(5) self.__testMethod(self.vc.AddService, "AddService", args = [service]) s = self.observer.lastService if not s.id == service.id: print 'Add Service FAILED; service does not exist' # UpdateService service.SetName("Updated Service") self.__testMethod(self.vc.UpdateService, "UpdateService", args = [service]) # RemoveService self.__testMethod(self.vc.RemoveService, "RemoveService", args = [service]) # ------------------------------------- # Data # ------------------------------------- # AddData file1 = os.path.join(os.getcwd(), 'unittest_all.py') file2 = os.path.join(os.getcwd(), 'unittest_ClientProfile.py') self.__testMethod(self.vcc.UploadVenueFiles, "UploadVenueFiles", args = [[file1,file2]]) time.sleep(20) d = self.observer.lastData d.SetName("Updated Name") # ModifyData self.__testMethod(self.vc.ModifyData, "ModifyData", args = [d]) # RemoveData # ------------------------------------- # Applications # ------------------------------------- # CreateApplication name = 'Test App' self.__testMethod(self.vc.CreateApplication, "CreateApplication", args = ['Test App', "my_desc", 'my_mime']) app = self.observer.lastApplication if not app.name == name: print 'Create Application Failed; app does not exist' # UpdateApplication app.SetName("Updated Application") self.__testMethod(self.vc.UpdateApplication, "UpdateApplication", args = [app]) # DestroyApplication self.__testMethod(self.vc.DestroyApplication, "DestroyApplication", args = [app.id]) # -------------------------------------- # ExitVenue # -------------------------------------- self.__testMethod(self.vc.ExitVenue, 'ExitVenue') def __testMethod(self, method, text, args = None): print '******************************************' try: if args: return apply(method, args) else: return apply(method) print '%s SUCCEEDED'%text except: print '%s FAILED'%text print '******************************************' def __buildOptions(self): # build options for this application portOption = Option("-p", "--port", type="int", dest="port", default=0, metavar="PORT", help="Set the port the venueclient control interface\ should listen on.") self.app.AddCmdLineOption(portOption) pnodeOption = Option("--personalNode", action="store_true", dest="pnode", default=0, help="Run NodeService and ServiceManager with the client.") self.app.AddCmdLineOption(pnodeOption) urlOption = Option("--url", type="string", dest="url", default="", metavar="URL", help="URL of venue to enter on startup.") self.app.AddCmdLineOption(urlOption) self.log = self.app.GetLog() self.pnode = self.app.GetOption("pnode") self.url = self.app.GetOption("url") self.port = self.app.GetOption("port")
# Check to see if this was launched to handle an agpkg file. if ".agpkg" in str(sys.argv).lower(): # also finds agpkg3 files pp = wx.PySimpleApp(); for arg in sys.argv: if ".agpkg" in str(arg).lower(): # also finds agpkg3 files # Register an agpkg pkgFile = arg cmd = sys.executable + " " + os.path.join(basePath, "bin", "agpm3.py") + " --gui --package %s" % str(pkgFile) os.system(cmd) else: #app=MyApp(); #app.MainLoop(); import sys pp = wx.PySimpleApp(); app=WXGUIApplication(); #try: #args = app.Initialize('AGLauncher') #except: #pass frame=LauncherFrame(None,-1,"Access Grid Launcher",sys.argv[1]); frame.Show(); pp.SetTopWindow(frame); pp.MainLoop();