Changeset 4690


Ignore:
Timestamp:
Dec 13, 2013 1:28:16 AM (10 years ago)
Author:
nanang
Message:

Re #1708: Cleanup few chat stuffs in Python GUI.

Location:
pjproject/branches/projects/pjsua2/pjsip-apps/src/pygui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/pygui/account.py

    r4686 r4690  
    5252                self.deleting = False 
    5353 
    54         """ 
    55         def findBuddy2(self, uri): 
    56                 # TODO: proper URI comparison 
    57                 for bud in self.buddyList: 
    58                         if bud.cfg.uri in uri or uri in bud.cfg.uri: 
    59                                 return bud 
    60                 return None 
    61         """ 
    62          
    63         def findChat(self, uri_str, call_inst = None): 
     54        def findChat(self, uri_str): 
    6455                uri = ch.ParseSipUri(uri_str) 
    6556                if not uri: return None 
    6657                         
    6758                for chat in self.chatList: 
    68                         if chat.isUriParticipant(uri): 
    69                                 if call_inst and chat.isCallRegistered(call_inst): 
    70                                         return chat 
    71                                 elif not call_inst and chat.isPrivate(): 
    72                                         return chat 
     59                        if chat.isUriParticipant(uri) and chat.isPrivate(): 
     60                                return chat 
    7361                return None 
    7462         
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/pygui/chat.py

    r4687 r4690  
    182182                return uri in self._participantList 
    183183                 
    184         def isCallRegistered(self, call_inst): 
    185                 return call_inst in self._callList 
    186                  
    187184        def registerCall(self, uri_str, call_inst): 
    188185                uri = ParseSipUri(uri_str) 
     
    200197                if show_text_chat: 
    201198                        self._gui.textShowHide(True) 
    202  
    203         # helper 
    204         def dumpParticipantList(self): 
    205                 print "Number of participants: %d" % (len(self._participantList)) 
    206                 for b in self._participantList: 
    207                         print b.cfg.uri 
    208199                 
    209200        def addParticipant(self, uri, call_inst=None): 
     
    264255                         
    265256        def setTypingIndication(self, from_uri_str, is_typing): 
    266                         # notify GUI 
    267                         self._gui.textSetTypingIndication(from_uri_str, is_typing) 
    268                         # now relay to all participants 
    269                         self._sendTypingIndication(is_typing, from_uri_str) 
     257                # notify GUI 
     258                self._gui.textSetTypingIndication(from_uri_str, is_typing) 
     259                # now relay to all participants 
     260                self._sendTypingIndication(is_typing, from_uri_str) 
    270261                 
    271262        def startCall(self): 
     
    274265                call_param.opt.audioCount = 1 
    275266                call_param.opt.videoCount = 0 
     267                fails = [] 
    276268                for idx, p in enumerate(self._participantList): 
    277269                        # just skip if call is instantiated 
    278                         if len(self._callList)>=idx+1 and self._callList[idx]: 
     270                        if self._callList[idx]: 
    279271                                continue 
    280272                         
     
    288280                        except: 
    289281                                self._callList[idx] = None 
    290                                 self._gui.audioUpdateState(bud.cfg.uri, gui.AudioState.FAILED) 
     282                                self._gui.audioUpdateState(uri_str, gui.AudioState.FAILED) 
     283                                fails.append(p) 
    291284                                 
    292                                 # kick the disconnected participant, but the last (avoid zombie chat) 
    293                                 if not self.isPrivate(): 
    294                                         self.kickParticipant(p) 
     285                for p in fails: 
     286                        # kick participants with call failure, but spare the last (avoid zombie chat) 
     287                        if not self.isPrivate(): 
     288                                self.kickParticipant(p) 
    295289                         
    296290        def stopCall(self): 
     
    301295                                c.hangup(pj.CallOpParam()) 
    302296 
    303                         if not self.isPrivate(): 
    304                                 self.kickParticipant(p) 
    305                  
    306297        def updateCallState(self, thecall, info = None): 
    307298                # info is optional here, just to avoid calling getInfo() twice (in the caller and here) 
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/pygui/chatgui.py

    r4686 r4690  
    246246                self.btnRxMute = ttk.Button(self.rxVolFrm, width=8, text='Mute', command=self._onRxMute) 
    247247                self.btnRxMute.pack(side=tk.LEFT) 
    248                 self.rxVol = tk.Scale(self.rxVolFrm, orient=tk.HORIZONTAL, from_=0.0, to=10.0, showvalue=0) #, tickinterval=10.0, showvalue=1) 
     248                self.rxVol = tk.Scale(self.rxVolFrm, orient=tk.HORIZONTAL, from_=0.0, to=10.0, showvalue=1) #, tickinterval=10.0, showvalue=1) 
    249249                self.rxVol.set(5.0) 
    250250                self.rxVol.bind("<ButtonRelease-1>", self._onRxVol) 
Note: See TracChangeset for help on using the changeset viewer.