- Timestamp:
- Dec 4, 2013 12:19:48 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/pjsua2/pjsip-apps/src/pygui/chatgui.py
r4671 r4677 74 74 self.columnconfigure(1, weight=0) 75 75 76 self._text = tk.Text(self, font=("Arial", "10"))76 self._text = tk.Text(self, width=50, height=30, font=("Arial", "10")) 77 77 self._text.grid(row=0, column=0, sticky='nswe') 78 78 self._text.config(state=tk.DISABLED) … … 83 83 scrl.grid(row=0, column=1, sticky='nsw') 84 84 85 self._typingBox = tk.Text(self, height=1, font=("Arial", "10"))85 self._typingBox = tk.Text(self, width=50, height=1, font=("Arial", "10")) 86 86 self._typingBox.grid(row=1, columnspan=2, sticky='we', pady=0) 87 87 … … 112 112 113 113 class AudioObserver: 114 def onRetry(self, peer_uri): 115 pass 116 def onKick(self, peer_uri): 114 def onHangup(self, peer_uri): 117 115 pass 118 116 def onHold(self, peer_uri): 117 pass 118 def onUnhold(self, peer_uri): 119 119 pass 120 120 def onRxMute(self, peer_uri, is_muted): … … 135 135 self._rxMute = False 136 136 self._txMute = False 137 138 # internal state: 0:init - 1:established - 2:failure/rejected 3:normal cleared139 137 self._state = AudioState.NULL 140 138 … … 149 147 self._callFrame.pack_forget() 150 148 self._initFrame.pack(fill=tk.BOTH) 151 self._btnRetry.pack_forget()152 149 self._btnCancel.pack(side=tk.TOP) 153 150 self._lblInitState['text'] = 'Intializing..' … … 161 158 if state == AudioState.FAILED: 162 159 self._lblInitState['text'] = 'Failed' 163 self._btnRetry.pack()164 160 else: 165 161 self._lblInitState['text'] = 'Normal cleared' 166 162 self._btnCancel.pack_forget() 163 164 self._btnHold['text'] = 'Hold' 165 self._btnHold.config(state=tk.NORMAL) 167 166 168 167 # save last state 169 168 self._state = state 170 169 171 def _onRetry(self):172 self._btnRetry.pack_forget()173 self._state = 0174 # notify app175 self._observer.onRetry(self.peerUri)176 177 def _onKick(self):178 # notify app179 self._observer.onKick(self.peerUri)180 181 170 def _onHold(self): 182 # notify app 183 self._observer.onHold(self.peerUri) 171 self._btnHold.config(state=tk.DISABLED) 172 # notify app 173 if self._btnHold['text'] == 'Hold': 174 self._observer.onHold(self.peerUri) 175 self._btnHold['text'] = 'Unhold' 176 else: 177 self._observer.onUnhold(self.peerUri) 178 self._btnHold['text'] = 'Hold' 179 self._btnHold.config(state=tk.NORMAL) 184 180 185 181 def _onHangup(self): 186 182 # notify app 187 self._observer.on Kick(self.peerUri)183 self._observer.onHangup(self.peerUri) 188 184 189 185 def _onRxMute(self): … … 210 206 self._lblInitState.pack(side=tk.TOP, fill=tk.X, expand=1) 211 207 212 # Operation: retry, cancel/kick 213 self._btnRetry = ttk.Button(self._initFrame, text = 'Retry', command=self._onRetry) 214 self._btnRetry.pack(side=tk.TOP) 215 self._btnCancel = ttk.Button(self._initFrame, text = 'Cancel', command=self._onKick) 208 # Operation: cancel/kick 209 self._btnCancel = ttk.Button(self._initFrame, text = 'Cancel', command=self._onHangup) 216 210 self._btnCancel.pack(side=tk.TOP) 217 211 … … 383 377 aud_frm.updateState(state) 384 378 break 379 if state >= AudioState.DISCONNECTED and len(self._audioFrames) == 1: 380 self.enableAudio(False) 381 else: 382 self.enableAudio(True) 385 383 386 384 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.