コード例 #1
0
ファイル: cascaderview.py プロジェクト: dephraser/edcascaders
    def askForHelp(self, cascaderUsername):
        (_, (cascHost, cascSubjects)) = self.model.getCascaderData().findCascader(username=cascaderUsername)

        #ask user topic, brief description
        subject = None
        if getComboBoxText(self.builder.get_object('cbFilterSubject')) != 'All':
            subject = getComboBoxText(self.builder.get_object('cbFilterSubject'))
        helpDialog = AskForHelp(self.window, cascSubjects, subject)

        if helpDialog.isOk():
            debug('Dialog is ok, asking for help')
            helpid = (self.username, util.generateUnqiueId())

            self.setupMessagingWindow(helpid, cascaderUsername, cascHost, False) 

            writeSysMsg = lambda m: self.messageDialog.writeMessage(helpid, 'SYSTEM', m)
            writeSysMsg('Waiting for response...')

            def onNotConnected(reason):
                reason.trap(client.ClientNotConnected)
                writeSysMsg('Error: The client was not connected')

            try:
                d = self.model.askForHelp(helpid,
                                          cascaderUsername,
                                          helpDialog.getSubject(),
                                          helpDialog.getDescription())
                d.addErrback(onNotConnected)
            except client.NotConnected:
                self.onServerLost()
コード例 #2
0
    def onFilterLabChange(self, evt):
        debug("Filter Lab Changed")

        self.updateCascaderLists(self.model.getCascaderData())

        cbLab = self.builder.get_object("cbFilterLab")
        lab = getComboBoxText(cbLab)
        self.updateMap(lab)
コード例 #3
0
    def updateCascaderLists(self, cascaders):
        """
        Cleans the list and updates the list of cascaders avaible. Call
        when filters have been changed
        """

        ls = self.builder.get_object("lsCascList")
        ls.clear()

        cbSubjects = self.builder.get_object("cbFilterSubject")
        filterSub = getComboBoxText(cbSubjects)
        filterSub = [filterSub] if filterSub != "All" else None

        cbLab = self.builder.get_object("cbFilterLab")
        filterLab = getComboBoxText(cbLab)
        filterLab = filterLab if filterLab != "All" else None

        cascaders = list(cascaders.findCascaders(lab=filterLab, subjects=filterSub))
        [ls.append([username]) for username, _ in cascaders]
        debug("Updating cascaders from: %s" % str(cascaders))
コード例 #4
0
ファイル: cascaderview.py プロジェクト: dephraser/edcascaders
    def onFilterLabChange(self, evt):
        '''
        This is called before a lot of the things are created fully
        as it is set to its default value. This has to check that things
        fully exist before calling functions on them
        '''
        debug('Filter Lab Changed')

        self.updateCascaderLists(self.model.getCascaderData())

        cbLab = self.builder.get_object('cbFilterLab')
        lab = getComboBoxText(cbLab)
        self.updateMap(lab)
コード例 #5
0
    def onOk(self, event):
        #need to get these before everything is destroyed
        self.subject = getComboBoxText(self.builder.get_object('cbSubject'))
        self.desc = self.builder.get_object('txDesc').get_text()

        if not len(self.getDescription().strip()):
            errorDialog('There must be a problem description')
            return True
        elif self.getSubject() is None:
            errorDialog('Must have a subject selected')
            return True
        else:
            self.ok = True
            self.window.destroy()
コード例 #6
0
    def updateMap(self, lab):
        cbSubjects = self.builder.get_object("cbFilterSubject")
        filterSub = getComboBoxText(cbSubjects)
        filterSub = [filterSub] if filterSub != "All" else None

        def onHostClick(event, widgit, host):
            """
            Function is passed into the map and called when the user
            clicks on a host
            """
            casc = self.model.getCascaderData().findCascader(host=host, subjects=filterSub)
            if casc is None:
                debug("Clicked on a host (%s) that wasn't " "cascading for the given filter" % host)
                return
            (username, _) = casc
            self.askForHelp(username)

        self.map.applyFilter(lab, myHost=self.hostname, subjects=filterSub, onClick=onHostClick)
コード例 #7
0
ファイル: cascaderview.py プロジェクト: dephraser/edcascaders
    def updateMap(self, lab):
        cbSubjects = self.builder.get_object('cbFilterSubject')
        filterSub = getComboBoxText(cbSubjects)
        filterSub = [filterSub] if filterSub != 'All'  else None

        def onHostClick(event, widgit, host):
            casc = self.cascaders.findCascader(host=host, subjects=filterSub)
            if casc is None:
                debug('Clicked on a host (%s) that wasn\'t '
                      'cascading for the given filter' % host)
                return
            (username, _) = casc
            self.askForHelp(username)

        self.map.applyFilter(lab,
                             myHost=self.hostname,
                             subjects=filterSub,
                             onClick=onHostClick)
コード例 #8
0
 def onAddSubject(self, event):
     cb = self.builder.get_object("cbCascSubjectList")
     self.addSubjects([getComboBoxText(cb)])