Exemple #1
0
    def setSession(self,
                   session_id,
                   prop_code=None,
                   prop_number=None,
                   prop_id=None,
                   expiration=None,
                   orig_prop_code=None,
                   is_inhouse=None):
        self.externalUserInfoDialog.clearUserInfo()

        if prop_code is not None and prop_number is not None and prop_code != '' and prop_number != '':
            if self.instanceServer is not None:
                try:
                    proposal_dict={ "code":orig_prop_code,\
                        "alias": prop_code,\
                        "number":prop_number,\
                        "session":int(session_id),\
                        "inhouse":is_inhouse }
                except:
                    logging.getLogger().exception(
                        "InstanceListBrick: problem setting session")
                    return
                else:
                    self.myProposal = proposal_dict
                    self.instanceServer.setProposal(proposal_dict)

            if is_inhouse:
                BlissWidget.setInstanceUserId(
                    BlissWidget.INSTANCE_USERID_INHOUSE)
                self.askForControlButton.hide()
                self.takeControlButton.show()
                self.takeControlButton.setEnabled(
                    BlissWidget.isInstanceRoleServer(
                    ))  #BlissWidget.isInstanceModeMaster())
                if self.hutchtrigger is not None and not BlissWidget.isInstanceModeMaster(
                ):
                    hutch_opened = self.hutchtrigger.hutchIsOpened()
                    #hutch_opened = 1-int(self.hutchtrigger.getChannelObject("status").getValue())
                    logging.getLogger().info(
                        "%s: hutch is %s, %s 'Take control' button",
                        self.name(), hutch_opened and "opened" or "close",
                        hutch_opened and "disabling" or "enabling")
                    self.takeControlButton.setEnabled(1 - hutch_opened)
            else:
                BlissWidget.setInstanceUserId(
                    BlissWidget.INSTANCE_USERID_LOGGED)
                self.takeControlButton.hide()
                self.askForControlButton.show()
                self.askForControlButton.setEnabled(
                    not BlissWidget.isInstanceModeMaster())
        else:
            if self.instanceServer is not None:
                self.myProposal = None
                self.instanceServer.setProposal(None)

            BlissWidget.setInstanceUserId(BlissWidget.INSTANCE_USERID_UNKNOWN)
            self.takeControlButton.hide()
            self.askForControlButton.show()
            #self.askForControlButton.setEnabled(BlissWidget.isInstanceRoleServer() and not BlissWidget.isInstanceModeMaster())
            self.askForControlButton.setEnabled(False)
 def giveControlTo(self,item):
     if item is None:
         return
     #print "GIVE CONTROL",item.text(),BlissWidget.isInstanceModeMaster(),self.giveControl.isChecked(),self.connections
     if BlissWidget.isInstanceModeMaster() and self.giveControl.isChecked():
         for user_id in self.connections:
             if self.connections[user_id][0]==item:
                 self.instanceServer.giveControl((user_id,self.connections[user_id][1]))
                 break
    def setSession(self,session_id,prop_code=None,prop_number=None,prop_id=None,expiration=None,orig_prop_code=None,is_inhouse=None):
        self.externalUserInfoDialog.clearUserInfo()

        if prop_code is not None and prop_number is not None and prop_code!='' and prop_number!='':
            if self.instanceServer is not None:
                try:
                    proposal_dict={ "code":orig_prop_code,\
                        "alias": prop_code,\
                        "number":prop_number,\
                        "session":int(session_id),\
                        "inhouse":is_inhouse }
                except:
                    logging.getLogger().exception("InstanceListBrick: problem setting session")
                    return
                else:
                    self.myProposal=proposal_dict
                    self.instanceServer.setProposal(proposal_dict)

            if is_inhouse:
                BlissWidget.setInstanceUserId(BlissWidget.INSTANCE_USERID_INHOUSE)
                self.askForControlButton.hide()
                self.takeControlButton.show()
                self.takeControlButton.setEnabled(BlissWidget.isInstanceRoleServer()) #BlissWidget.isInstanceModeMaster())
                if self.hutchtrigger is not None and not BlissWidget.isInstanceModeMaster():
                    hutch_opened = self.hutchtrigger.hutchIsOpened()
                    #hutch_opened = 1-int(self.hutchtrigger.getChannelObject("status").getValue())
                    logging.getLogger().info("%s: hutch is %s, %s 'Take control' button", self.name(), hutch_opened and "opened" or "close", hutch_opened and "disabling" or "enabling")
                    self.takeControlButton.setEnabled(1-hutch_opened)
            else:
                BlissWidget.setInstanceUserId(BlissWidget.INSTANCE_USERID_LOGGED)
                self.takeControlButton.hide()
                self.askForControlButton.show()
                self.askForControlButton.setEnabled(not BlissWidget.isInstanceModeMaster())
        else:
            if self.instanceServer is not None:
                self.myProposal=None
                self.instanceServer.setProposal(None)

            BlissWidget.setInstanceUserId(BlissWidget.INSTANCE_USERID_UNKNOWN)
            self.takeControlButton.hide()
            self.askForControlButton.show()
            #self.askForControlButton.setEnabled(BlissWidget.isInstanceRoleServer() and not BlissWidget.isInstanceModeMaster())
            self.askForControlButton.setEnabled(False)
Exemple #4
0
 def giveControlTo(self, item):
     if item is None:
         return
     #print "GIVE CONTROL",item.text(),BlissWidget.isInstanceModeMaster(),self.giveControl.isChecked(),self.connections
     if BlissWidget.isInstanceModeMaster() and self.giveControl.isChecked():
         for user_id in self.connections:
             if self.connections[user_id][0] == item:
                 self.instanceServer.giveControl(
                     (user_id, self.connections[user_id][1]))
                 break
 def wantsControl(self,client_id):
     #print "INSTANCE LIST BRICK WANTS CONTROL",client_id
     if BlissWidget.isInstanceModeMaster() and self.giveControlDialog is None and self.allowTimeoutControl.isChecked():
         self.timeoutLeft=self['giveControlTimeout']
         client_print=self.instanceServer.idPrettyPrint(client_id)
         self.giveControlDialog=QMessageBox("Pass control",\
             "The user %s wants to have control of the application!" % client_print,\
             QMessageBox.Question,QMessageBox.Yes,QMessageBox.No,\
             QMessageBox.NoButton,self)
         custom_event=WantsControlEvent(client_id)
         qApp.postEvent(self,custom_event)
Exemple #6
0
 def wantsControl(self, client_id):
     #print "INSTANCE LIST BRICK WANTS CONTROL",client_id
     if BlissWidget.isInstanceModeMaster(
     ) and self.giveControlDialog is None and self.allowTimeoutControl.isChecked(
     ):
         self.timeoutLeft = self['giveControlTimeout']
         client_print = self.instanceServer.idPrettyPrint(client_id)
         self.giveControlDialog=QMessageBox("Pass control",\
             "The user %s wants to have control of the application!" % client_print,\
             QMessageBox.Question,QMessageBox.Yes,QMessageBox.No,\
             QMessageBox.NoButton,self)
         custom_event = WantsControlEvent(client_id)
         qApp.postEvent(self, custom_event)
Exemple #7
0
 def instanceModeChanged(self, mode):
     self.mainMenu.setItemEnabled(self.instrumentationMenuId,
                                  BlissWidget.isInstanceModeMaster())
 def instanceModeChanged(self, mode):
     self.mainMenu.setItemEnabled(self.instrumentationMenuId, BlissWidget.isInstanceModeMaster())