Esempio n. 1
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 __init__( self, questionTool, log = None):
        '''
        Create ui components and register as observers to the
        shared question tool model.
        '''
        wx.App.__init__(self, False)
        self.log = log
        self.questionTool = questionTool
        self.mainSizer = None
        self.frame = wx.Frame(None, -1, "Shared Question Tool",
                             size = wx.Size(500, 500))
        self.frame.SetIcon(icons.getAGIconIcon())
        self.SetTopWindow(self.frame)
        self.topPanel = wx.Notebook(self.frame, -1)



        self.audienceView = AudienceView(self.topPanel, self.questionTool, 
					 self)
        self.moderatorView = ModeratorView(self.topPanel, self.questionTool, 
					   self)
	
	self.topPanel.AddPage(self.audienceView, "Audience View")


	self.topPanel.AddPage(self.moderatorView, "Moderator View")
       
        # Register observers
        self.questionTool.RegisterObserver(self.audienceView)
        self.questionTool.RegisterObserver(self.moderatorView)

        self.frame.Show(1)
def SetIcon(app):
    icon = None
    if IsWindows() or IsLinux() or IsFreeBSD():
        icon = icons.getAGIconIcon()
        app.SetIcon(icon)
    elif IsOSX():
        icon = icons.getAGIcon128Icon()
        t = wx.TaskBarIcon()
        t.SetIcon(icon, "VenueClient")
Esempio n. 4
0
def SetIcon(app):
        icon = None
        if IsWindows()or IsLinux() or IsFreeBSD():
            icon = icons.getAGIconIcon()
            app.SetIcon(icon)
        elif IsOSX():
             icon = icons.getAGIcon128Icon()
             t = wx.TaskBarIcon()
             t.SetIcon(icon,"VenueClient")
Esempio n. 5
0
    def __init__(self, parent, log, beacon, **args):
        wx.Frame.__init__(self, parent, -1, "RTP Beacon View", size=(400,300), **args)
        self.log = log
        self.beacon = beacon
        
        self.SetIcon(icons.getAGIconIcon())
        self.running = 1
        self.updateThread = None

        self.panel = wx.Panel(self, -1)
        
        # Build up the user interface
        self.SetLabel("Multicast Connectivity")

        # - sizer for pulldowns
        self.topsizer = wx.BoxSizer(wx.HORIZONTAL)
        
        # - pulldown for group to monitor (currently only beacon group, later audio/video)
        choices = ['Beacon']
        self.groupBox = wx.Choice(self.panel,-1,choices = choices)
        self.groupBox.SetSelection(0)
        
        # - pulldown for data to display (currently only fract.loss, later delay/jitter/cum.loss)
        choices = ['Fractional Loss']
        self.dataTypeBox = wx.Choice(self.panel,-1,choices = choices)
        self.dataTypeBox.SetSelection(0)

        self.label = wx.StaticText(self.panel, -1, "")
        
        self.topsizer.Add(self.groupBox,0, wx.ALL, 2)
        self.topsizer.Add(self.dataTypeBox,0, wx.ALL, 2)
        self.topsizer.Add(self.label,1, wx.EXPAND|wx.ALL, 2)
        
        # Create the beacon grid
        self.grid = wx.grid.Grid(self.panel,-1)
        self.grid.SetToolTip(wx.ToolTip("test"))
        self.grid.EnableEditing(False)
        self.grid.SetColLabelSize(0)
        self.grid.SetRowLabelAlignment(wx.LEFT,wx.BOTTOM)
        self.grid.DisableDragRowSize()
        self.grid.DisableDragColSize()
        self.grid.SetRowLabelSize(150)
        self.grid.SetDefaultColSize(40)
        self.grid.EnableScrolling(1,1)
        self.grid.CreateGrid(1,1)
        
        # Register event handlers
        wx.EVT_CLOSE(self, self.OnExit)
        wx.grid.EVT_GRID_CELL_LEFT_CLICK(self.grid, self.OnLeftClick) 
        
        # Layout
        self.__Layout()

        # Start update thread
        self.updateThread = threading.Thread(target=self.ChangeValuesThread)
        self.updateThread.start()
Esempio n. 6
0
    def __init__(self, appUrl, name, size=None):
        '''
        Creates the shared application client, used for
        application service interaction, and opens a web browser
        for UI display.
        '''
        wx.App.__init__(self, False)

        reactor.interleave(wx.CallAfter)
        # Create shared application client
        self.sharedAppClient = SharedAppClient(name)
        self.log = self.sharedAppClient.InitLogging()

        # Get client profile
        try:
            clientProfileFile = os.path.join(
                UserConfig.instance().GetConfigDir(), "profile")
            clientProfile = ClientProfile(clientProfileFile)
        except:
            self.log.info(
                "SharedAppClient.Connect: Could not load client profile, set clientProfile = None"
            )
            clientProfile = None

        # Join the application session.
        self.sharedAppClient.Join(appUrl, clientProfile)

        # Register browse event callback
        self.sharedAppClient.RegisterEventCallback("browse",
                                                   self.BrowseCallback)

        # Create Browser Window
        self.frame = wx.Frame(None, -1, "SharedBrowser", size=size)
        if sys.platform != Platform.WIN:
            self.frame.CreateStatusBar()
        self.browser = WebBrowser(self.frame, -1, self.log, self.frame)

        # Add callback for local browsing
        self.browser.add_navigation_callback(self.IBrowsedCallback)

        # Browse to the current url, if exists
        currentUrl = self.sharedAppClient.GetData("url")

        if currentUrl and len(currentUrl) > 0:
            self.browser.navigate(currentUrl)
            try:
                self.sharedAppClient.SetParticipantStatus(currentUrl)
            except:
                self.log.exception(
                    "SharedBrowser:__init__: Failed to set participant status")

        self.frame.SetIcon(icons.getAGIconIcon())
        self.frame.Show(1)
        self.SetTopWindow(self.frame)
Esempio n. 7
0
    def __init__(self, appUrl, name, size=None):
        """
        Creates the shared application client, used for
        application service interaction, and opens a web browser
        for UI display.
        """
        wx.App.__init__(self, False)

        reactor.interleave(wx.CallAfter)
        # Create shared application client
        self.sharedAppClient = SharedAppClient(name)
        self.log = self.sharedAppClient.InitLogging()

        # Get client profile
        try:
            clientProfileFile = os.path.join(UserConfig.instance().GetConfigDir(), "profile")
            clientProfile = ClientProfile(clientProfileFile)
        except:
            self.log.info("SharedAppClient.Connect: Could not load client profile, set clientProfile = None")
            clientProfile = None

        # Join the application session.
        self.sharedAppClient.Join(appUrl, clientProfile)

        # Register browse event callback
        self.sharedAppClient.RegisterEventCallback("browse", self.BrowseCallback)

        # Create Browser Window
        self.frame = wx.Frame(None, -1, "SharedBrowser", size=size)
        if sys.platform != Platform.WIN:
            self.frame.CreateStatusBar()
        self.browser = WebBrowser(self.frame, -1, self.log, self.frame)

        # Add callback for local browsing
        self.browser.add_navigation_callback(self.IBrowsedCallback)

        # Browse to the current url, if exists
        currentUrl = self.sharedAppClient.GetData("url")

        if currentUrl and len(currentUrl) > 0:
            self.browser.navigate(currentUrl)
            try:
                self.sharedAppClient.SetParticipantStatus(currentUrl)
            except:
                self.log.exception("SharedBrowser:__init__: Failed to set participant status")

        self.frame.SetIcon(icons.getAGIconIcon())
        self.frame.Show(1)
        self.SetTopWindow(self.frame)
Esempio n. 8
0
    def __init__(self, parent, voyagerModel, log):
        """ 
        Create ui components. 
        """
        wxFrame.__init__(self, NULL, -1, "Personal AG Recorder", size=wxSize(420, 500))
        Observer.__init__(self)

        self.log = log
        self.voyagerModel = voyagerModel
        self.intToGuid = {}

        self.SetIcon(icons.getAGIconIcon())
        self.panel = wxPanel(self, -1)
        self.stopButton = wxButton(self.panel, wxNewId(), "Stop", size=wxSize(50, 40))
        self.playButton = wxButton(self.panel, wxNewId(), "Play", size=wxSize(50, 40))
        self.recordButton = wxButton(self.panel, wxNewId(), "Record", size=wxSize(50, 40))
        self.statusField = wxTextCtrl(
            self.panel,
            wxNewId(),
            "Use the buttons to record from a venue or play a recording from the list below.",
            style=wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH,
            size=wxSize(-1, 32),
        )

        # Recordings are displayed in a list. They are keyed on the
        # unique id returned from recording.GetId()
        self.recordingList = wxListCtrl(self.panel, wxNewId(), size=wxSize(150, 150), style=wxLC_REPORT)
        self.recordingList.InsertColumn(0, "Name")
        self.recordingList.InsertColumn(1, "Date")
        self.recordingList.SetColumnWidth(0, 80)
        self.recordingList.SetColumnWidth(1, 220)

        self.playButton.SetToolTipString("Play a recording")
        self.recordButton.SetToolTipString("Record from an AG venue")

        self.recordingMenu = wxMenu()
        self.recordingMenu.Append(self.RECORDING_MENU_REMOVE, "Remove", "Remove this recording.")
        self.recordingMenu.AppendSeparator()
        self.recordingMenu.Append(self.RECORDING_MENU_IMPORT, "Import", "Load recordings")
        self.recordingMenu.Append(self.RECORDING_MENU_EXPORT, "Export", "Save this recording to file")
        self.recordingMenu.AppendSeparator()
        self.recordingMenu.Append(self.RECORDING_MENU_PROPERTIES, "Properties", "View recording details.")

        self.__Layout()
        self.__SetEvents()
        self.Update()
Esempio n. 9
0
    def __init__(self, model):
        """The constructor."""
        wx.Frame.__init__(self, None, -1, "SharedPaint", wx.DefaultPosition,
                          wx.Size(800, 600))

        # Model instance
        self.__model = model

        # List containing the participants' IDs
        self.__participants = []

        # Main sizer
        workspaceSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.SetSizer(workspaceSizer)

        # Center panel
        centerPanel = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
        centerPanel.SetBackgroundColour("#BBBBBB")
        sizer = wx.BoxSizer(wx.VERTICAL)
        centerPanel.SetSizer(sizer)
        self.doodle = DoodleWindow(centerPanel, self.__model)
        sizer.Add(self.doodle, 1, wx.EXPAND | wx.ALL, 1)
        workspaceSizer.Add(centerPanel, 1, wx.EXPAND | wx.ALL, 1)

        # Imagelist containing penColor images
        il = wx.ImageList(24, 24, True)
        pen = wx.Bitmap("pen.png", wx.BITMAP_TYPE_PNG).ConvertToImage()
        for color in menuColors:
            r = int(color[1:3], 16)
            g = int(color[3:5], 16)
            b = int(color[5:7], 16)
            penImage = pen.Copy()
            penImage.Replace(204, 0, 204, r, g, b)
            il.Add(penImage.ConvertToBitmap())

        # Right panel
        rightPanel = wx.Panel(self, -1, size=(200, 0))
        rightPanelSizer = wx.BoxSizer(wx.VERTICAL)
        rightPanel.SetSizer(rightPanelSizer)
        # List of participants
        staticBox = wx.StaticBox(rightPanel, -1, "Participants")
        sizer = wx.StaticBoxSizer(staticBox, wx.VERTICAL)
        self.__list = wx.ListView(rightPanel,
                                  -1,
                                  size=(200, 0),
                                  style=wx.LC_SMALL_ICON)
        self.__list.SetBackgroundColour(wx.WHITE)
        self.__list.AssignImageList(il, wx.IMAGE_LIST_SMALL)
        sizer.Add(self.__list, 1, wx.EXPAND | wx.ALL, 1)
        rightPanelSizer.Add(sizer, 1, wx.EXPAND | wx.ALL, 1)
        # Control panel
        staticBox = wx.StaticBox(rightPanel, -1, "Pen settings")
        sizer = wx.StaticBoxSizer(staticBox, wx.VERTICAL)
        self.ctrlPanel = ControlPanel(rightPanel, self.__model.PenColor,
                                      self.__model.PenThickness)
        sizer.Add(self.ctrlPanel, 1, wx.EXPAND | wx.ALL, 1)
        rightPanelSizer.Add(sizer, 1, wx.EXPAND | wx.ALL, 1)
        workspaceSizer.Add(rightPanel, 0, wx.EXPAND | wx.ALL, 1)

        # Application icon
        self.SetIcon(icons.getAGIconIcon())

        # Menu
        menuBar = wx.MenuBar()

        session = wx.Menu()
        #session.Append(101, "&Join", "Join to the SharedPaint drawing session")
        session.Append(102, "&Take snapshot",
                       "Save the current session status: snapshot")
        session.Append(103, "&Load snapshot...", "Load a saved snapshot")
        session.Append(104, "&Quit", "Quit the application")
        menuBar.Append(session, "&Session")

        imageMenu = wx.Menu()
        imageMenu.Append(201, "&Load from server",
                         "Load an image from the Venue Server as background")
        imageMenu.Append(202, "Clear", "Quit the current background image")
        menuBar.Append(imageMenu, "&Image")

        drawing = wx.Menu()
        drawing.Append(301, "&Clear", "Remove all the annotations")
        drawing.Append(302, "&Undo",
                       "Remove the last annotation made by the participant")
        menuBar.Append(drawing, "&Annotations")

        help = wx.Menu()
        #help.Append(401, "User Manual", "Open the SharedPaint user manual")
        help.Append(402, "About", "About SharedPaint")
        menuBar.Append(help, "&Help")

        self.SetMenuBar(menuBar)

        # Status bar
        self.__statusbar = self.CreateStatusBar()

        toolbar = self.CreateToolBar()
        toolbar.SetToolBitmapSize((24, 24))
        toolbar.AddLabelTool(
            102,
            "",
            wx.Bitmap("session_snapshot.gif"),
            longHelp="Save the current session status: snapshot")
        toolbar.AddLabelTool(103,
                             "",
                             wx.Bitmap("session_load.gif"),
                             longHelp="Load a saved snapshot")
        toolbar.AddLabelTool(
            201,
            "",
            wx.Bitmap("image_load.gif"),
            longHelp="Load an image from the Venue Server as background")
        toolbar.AddLabelTool(202,
                             "",
                             wx.Bitmap("image_clear.gif"),
                             longHelp="Quit the current background image")
        toolbar.AddLabelTool(301,
                             "",
                             wx.Bitmap("annotations_clear.gif"),
                             longHelp="Remove all the annotations")
        toolbar.Realize()
    def __init__(self, parent, ID, title,size=wx.Size(450,300),callback=None):
        wx.Frame.__init__(self, parent, ID, title,
                         wx.DefaultPosition, size=size)
                         
        self.callback = callback
        self.Center()
        self.SetTitle(title)
        self.SetIcon(icons.getAGIconIcon())
        self.serviceManagers = []
        self.nodeServiceHandle = None

        self.app = Toolkit.Application.instance()

        menuBar = wx.MenuBar()

        ## FILE menu
        self.fileMenu = wx.Menu()
        self.fileMenu.Append(ID_FILE_ATTACH, "Connect to Node...", 
                             "Connect to a NodeService")
        self.fileMenu.AppendSeparator()
        self.fileMenu.Append(ID_FILE_LOAD_CONFIG, "Load Configuration...", 
                             "Load a NodeService Configuration")
        self.fileMenu.Append(ID_FILE_STORE_CONFIG, "Store Configuration...", 
                             "Store a NodeService Configuration")
        self.fileMenu.AppendSeparator()
        self.fileMenu.Append(ID_FILE_EXIT, "E&xit", "Terminate the program")
        menuBar.Append(self.fileMenu, "&File");

        ## SERVICE MANAGERS menu
        self.serviceManagersMenu = BuildServiceManagerMenu()
        menuBar.Append(self.serviceManagersMenu, "&ServiceManager");
        
        ## SERVICE menu

        self.serviceMenu = BuildServiceMenu()
        menuBar.Append(self.serviceMenu, "&Service");
        
        ## HELP menu
        self.helpMenu = wx.Menu()
        self.helpMenu.Append(ID_HELP_ABOUT, "&About",
                    "More information about this program")
        menuBar.Append(self.helpMenu, "&Help");

        self.SetMenuBar(menuBar)

        self.tree = TreeListCtrl(self,-1,
                                   style = wx.TR_MULTIPLE|wx.TR_HIDE_ROOT|wx.TR_TWIST_BUTTONS)
        self.tree.AddColumn("Name")
        self.tree.AddColumn("Resource")
        self.tree.AddColumn("Status")
        self.tree.SetMainColumn(0)
        
        self.tree.SetColumnWidth(0,175)
        self.tree.SetColumnWidth(1,175)
        self.tree.SetColumnWidth(2,90)
        
        
        wx.EVT_TREE_ITEM_RIGHT_CLICK(self, self.tree.GetId(), self.PopupThatMenu)
        wx.EVT_TREE_ITEM_ACTIVATED(self, self.tree.GetId(), self.DoubleClickCB )

        wx.InitAllImageHandlers()

        imageSize = 22
        imageList = wx.ImageList(imageSize,imageSize)

        bm = icons.getComputerBitmap()
        self.smImage = imageList.Add(bm)

        bm = icons.getDefaultServiceBitmap()
        self.svcImage = imageList.Add(bm)
        
        self.tree.SetImageList(imageList)
        self.imageList = imageList
                

        # Create the status bar
        self.CreateStatusBar(2)
        self.SetStatusText("Not Connected",1)

        # Associate menu items with callbacks
        wx.EVT_MENU(self, ID_FILE_ATTACH            ,  self.Attach )
        wx.EVT_MENU(self, ID_FILE_EXIT              ,  self.TimeToQuit )
        wx.EVT_MENU(self, ID_FILE_LOAD_CONFIG       ,  self.LoadConfiguration )
        wx.EVT_MENU(self, ID_FILE_STORE_CONFIG      ,  self.StoreConfiguration )
        wx.EVT_MENU(self, ID_HELP_ABOUT             ,  self.OnAbout)
        wx.EVT_MENU(self, ID_HOST_ADD               ,  self.AddHost )
        wx.EVT_MENU(self, ID_HOST_REMOVE            ,  self.RemoveServiceManager )
        wx.EVT_MENU(self, ID_SERVICE_ADD_SERVICE    ,  self.AddService )
        wx.EVT_MENU(self, ID_SERVICE_CONFIGURE      ,  self.ConfigureService )
        wx.EVT_MENU(self, ID_SERVICE_REMOVE         ,  self.RemoveService )
        wx.EVT_MENU(self, ID_SERVICE_ENABLE         ,  self.EnableServices )
        wx.EVT_MENU(self, ID_SERVICE_ENABLE_ONE     ,  self.EnableService )
        wx.EVT_MENU(self, ID_SERVICE_DISABLE        ,  self.DisableServices )
        wx.EVT_MENU(self, ID_SERVICE_DISABLE_ONE    ,  self.DisableService )
        
        wx.EVT_TREE_KEY_DOWN(self.tree, self.tree.GetId(), self.OnKeyDown)
    
        self.menuBar = menuBar
        
        self.EnableMenus(False)
            
        self.recentNodeServiceList = []
        self.recentServiceManagerList = []
    def __init__(self, parent, log, beacon, **args):
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "RTP Beacon View",
                          size=(400, 300),
                          **args)
        self.log = log
        self.beacon = beacon

        self.SetIcon(icons.getAGIconIcon())
        self.running = 1
        self.updateThread = None

        self.panel = wx.Panel(self, -1)

        # Build up the user interface
        self.SetLabel("Multicast Connectivity")

        # - sizer for pulldowns
        self.topsizer = wx.BoxSizer(wx.HORIZONTAL)

        # - pulldown for group to monitor (currently only beacon group, later audio/video)
        choices = ['Beacon']
        self.groupBox = wx.Choice(self.panel, -1, choices=choices)
        self.groupBox.SetSelection(0)

        # - pulldown for data to display (currently only fract.loss, later delay/jitter/cum.loss)
        choices = ['Fractional Loss']
        self.dataTypeBox = wx.Choice(self.panel, -1, choices=choices)
        self.dataTypeBox.SetSelection(0)

        self.label = wx.StaticText(self.panel, -1, "")

        self.topsizer.Add(self.groupBox, 0, wx.ALL, 2)
        self.topsizer.Add(self.dataTypeBox, 0, wx.ALL, 2)
        self.topsizer.Add(self.label, 1, wx.EXPAND | wx.ALL, 2)

        # Create the beacon grid
        self.grid = wx.grid.Grid(self.panel, -1)
        self.grid.SetToolTip(wx.ToolTip("test"))
        self.grid.EnableEditing(False)
        self.grid.SetColLabelSize(0)
        self.grid.SetRowLabelAlignment(wx.LEFT, wx.BOTTOM)
        self.grid.DisableDragRowSize()
        self.grid.DisableDragColSize()
        self.grid.SetRowLabelSize(150)
        self.grid.SetDefaultColSize(40)
        self.grid.EnableScrolling(1, 1)
        self.grid.CreateGrid(1, 1)

        # Register event handlers
        wx.EVT_CLOSE(self, self.OnExit)
        wx.grid.EVT_GRID_CELL_LEFT_CLICK(self.grid, self.OnLeftClick)

        # Layout
        self.__Layout()

        # Start update thread
        self.updateThread = threading.Thread(target=self.ChangeValuesThread)
        self.updateThread.start()
Esempio n. 12
0
                                          "application/x-ag-shared-pdf")
        
        appUrl = appDesc.uri

    if not appUrl:
        Usage()
        sys.exit(0)
        
    if not appUrl or not venueUrl:
        Usage()
        sys.exit(0)

    if wxPlatform == '__WXMSW__':
        # Create the UI
        mainFrame = wx.Frame(None, -1, name, size = wx.Size(600, 600))
        mainFrame.SetIcon(icons.getAGIconIcon())
        viewer = PdfViewer(mainFrame, name, appUrl, venueUrl, conId)

        # Start the UI main loop
        mainFrame.Show()
        wx.EndBusyCursor()
           
        wxapp.MainLoop()

    else:
        wx.EndBusyCursor()
        dlg = wx.MessageDialog(frame, 'This application only works on MSW.',
                              'Sorry', wx.OK | wx.ICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()