Philipp Hörist pushed to branch master at gajim / gajim
Commits:
5 changed files:
- gajim/common/jingle_rtp.py
- gajim/data/gui/call_widget.ui
- gajim/gtk/builder.pyi
- gajim/gtk/call_widget.py
- scripts/dev/generate_ui_types.py
Changes:
| ... | ... | @@ -165,12 +165,13 @@ def _next_dtmf(self, events): |
| 165 | 165 |
else:
|
| 166 | 166 |
self._dtmf_running = False
|
| 167 | 167 |
|
| 168 |
- def start_dtmf(self, event):
|
|
| 169 |
- if event in ('*', '#'):
|
|
| 170 |
- event = {'*': Farstream.DTMFEvent.STAR,
|
|
| 171 |
- '#': Farstream.DTMFEvent.POUND}[event]
|
|
| 168 |
+ def start_dtmf(self, key):
|
|
| 169 |
+ if key == 'star':
|
|
| 170 |
+ event = Farstream.DTMFEvent.STAR
|
|
| 171 |
+ elif key == 'pound':
|
|
| 172 |
+ event = Farstream.DTMFEvent.POUND
|
|
| 172 | 173 |
else:
|
| 173 |
- event = int(event)
|
|
| 174 |
+ event = int(key)
|
|
| 174 | 175 |
self.p2psession.start_telephony_event(event, 2)
|
| 175 | 176 |
|
| 176 | 177 |
def stop_dtmf(self):
|
| ... | ... | @@ -23,13 +23,15 @@ |
| 23 | 23 |
<property name="can-focus">False</property>
|
| 24 | 24 |
<property name="border-width">6</property>
|
| 25 | 25 |
<child>
|
| 26 |
- <object class="GtkButton" id="1_button">
|
|
| 26 |
+ <object class="GtkButton" id="button_1">
|
|
| 27 | 27 |
<property name="visible">True</property>
|
| 28 | 28 |
<property name="can-focus">True</property>
|
| 29 | 29 |
<property name="receives-default">True</property>
|
| 30 | 30 |
<property name="relief">none</property>
|
| 31 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 32 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 31 | 33 |
<child>
|
| 32 |
- <object class="GtkLabel" id="label1">
|
|
| 34 |
+ <object class="GtkLabel">
|
|
| 33 | 35 |
<property name="visible">True</property>
|
| 34 | 36 |
<property name="can-focus">False</property>
|
| 35 | 37 |
<property name="halign">center</property>
|
| ... | ... | @@ -45,13 +47,15 @@ |
| 45 | 47 |
</packing>
|
| 46 | 48 |
</child>
|
| 47 | 49 |
<child>
|
| 48 |
- <object class="GtkButton" id="2_button">
|
|
| 50 |
+ <object class="GtkButton" id="button_2">
|
|
| 49 | 51 |
<property name="visible">True</property>
|
| 50 | 52 |
<property name="can-focus">True</property>
|
| 51 | 53 |
<property name="receives-default">True</property>
|
| 52 | 54 |
<property name="relief">none</property>
|
| 55 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 56 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 53 | 57 |
<child>
|
| 54 |
- <object class="GtkLabel" id="label2">
|
|
| 58 |
+ <object class="GtkLabel">
|
|
| 55 | 59 |
<property name="visible">True</property>
|
| 56 | 60 |
<property name="can-focus">False</property>
|
| 57 | 61 |
<property name="label" translatable="yes"><b>2</b> abc</property>
|
| ... | ... | @@ -65,13 +69,15 @@ |
| 65 | 69 |
</packing>
|
| 66 | 70 |
</child>
|
| 67 | 71 |
<child>
|
| 68 |
- <object class="GtkButton" id="3_button">
|
|
| 72 |
+ <object class="GtkButton" id="button_3">
|
|
| 69 | 73 |
<property name="visible">True</property>
|
| 70 | 74 |
<property name="can-focus">True</property>
|
| 71 | 75 |
<property name="receives-default">True</property>
|
| 72 | 76 |
<property name="relief">none</property>
|
| 77 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 78 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 73 | 79 |
<child>
|
| 74 |
- <object class="GtkLabel" id="label3">
|
|
| 80 |
+ <object class="GtkLabel">
|
|
| 75 | 81 |
<property name="visible">True</property>
|
| 76 | 82 |
<property name="can-focus">False</property>
|
| 77 | 83 |
<property name="label" translatable="yes"><b>3</b> def</property>
|
| ... | ... | @@ -85,13 +91,15 @@ |
| 85 | 91 |
</packing>
|
| 86 | 92 |
</child>
|
| 87 | 93 |
<child>
|
| 88 |
- <object class="GtkButton" id="4_button">
|
|
| 94 |
+ <object class="GtkButton" id="button_4">
|
|
| 89 | 95 |
<property name="visible">True</property>
|
| 90 | 96 |
<property name="can-focus">True</property>
|
| 91 | 97 |
<property name="receives-default">True</property>
|
| 92 | 98 |
<property name="relief">none</property>
|
| 99 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 100 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 93 | 101 |
<child>
|
| 94 |
- <object class="GtkLabel" id="label4">
|
|
| 102 |
+ <object class="GtkLabel">
|
|
| 95 | 103 |
<property name="visible">True</property>
|
| 96 | 104 |
<property name="can-focus">False</property>
|
| 97 | 105 |
<property name="label" translatable="yes"><b>4</b> ghi</property>
|
| ... | ... | @@ -105,13 +113,15 @@ |
| 105 | 113 |
</packing>
|
| 106 | 114 |
</child>
|
| 107 | 115 |
<child>
|
| 108 |
- <object class="GtkButton" id="5_button">
|
|
| 116 |
+ <object class="GtkButton" id="button_5">
|
|
| 109 | 117 |
<property name="visible">True</property>
|
| 110 | 118 |
<property name="can-focus">True</property>
|
| 111 | 119 |
<property name="receives-default">True</property>
|
| 112 | 120 |
<property name="relief">none</property>
|
| 121 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 122 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 113 | 123 |
<child>
|
| 114 |
- <object class="GtkLabel" id="label5">
|
|
| 124 |
+ <object class="GtkLabel">
|
|
| 115 | 125 |
<property name="visible">True</property>
|
| 116 | 126 |
<property name="can-focus">False</property>
|
| 117 | 127 |
<property name="label" translatable="yes"><b>5</b> jkl</property>
|
| ... | ... | @@ -125,13 +135,15 @@ |
| 125 | 135 |
</packing>
|
| 126 | 136 |
</child>
|
| 127 | 137 |
<child>
|
| 128 |
- <object class="GtkButton" id="6_button">
|
|
| 138 |
+ <object class="GtkButton" id="button_6">
|
|
| 129 | 139 |
<property name="visible">True</property>
|
| 130 | 140 |
<property name="can-focus">True</property>
|
| 131 | 141 |
<property name="receives-default">True</property>
|
| 132 | 142 |
<property name="relief">none</property>
|
| 143 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 144 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 133 | 145 |
<child>
|
| 134 |
- <object class="GtkLabel" id="label6">
|
|
| 146 |
+ <object class="GtkLabel">
|
|
| 135 | 147 |
<property name="visible">True</property>
|
| 136 | 148 |
<property name="can-focus">False</property>
|
| 137 | 149 |
<property name="label" translatable="yes"><b>6</b> mno</property>
|
| ... | ... | @@ -145,13 +157,15 @@ |
| 145 | 157 |
</packing>
|
| 146 | 158 |
</child>
|
| 147 | 159 |
<child>
|
| 148 |
- <object class="GtkButton" id="7_button">
|
|
| 160 |
+ <object class="GtkButton" id="button_7">
|
|
| 149 | 161 |
<property name="visible">True</property>
|
| 150 | 162 |
<property name="can-focus">True</property>
|
| 151 | 163 |
<property name="receives-default">True</property>
|
| 152 | 164 |
<property name="relief">none</property>
|
| 165 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 166 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 153 | 167 |
<child>
|
| 154 |
- <object class="GtkLabel" id="label7">
|
|
| 168 |
+ <object class="GtkLabel">
|
|
| 155 | 169 |
<property name="visible">True</property>
|
| 156 | 170 |
<property name="can-focus">False</property>
|
| 157 | 171 |
<property name="label" translatable="yes"><b>7</b> pqrs</property>
|
| ... | ... | @@ -165,13 +179,15 @@ |
| 165 | 179 |
</packing>
|
| 166 | 180 |
</child>
|
| 167 | 181 |
<child>
|
| 168 |
- <object class="GtkButton" id="8_button">
|
|
| 182 |
+ <object class="GtkButton" id="button_8">
|
|
| 169 | 183 |
<property name="visible">True</property>
|
| 170 | 184 |
<property name="can-focus">True</property>
|
| 171 | 185 |
<property name="receives-default">True</property>
|
| 172 | 186 |
<property name="relief">none</property>
|
| 187 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 188 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 173 | 189 |
<child>
|
| 174 |
- <object class="GtkLabel" id="label8">
|
|
| 190 |
+ <object class="GtkLabel">
|
|
| 175 | 191 |
<property name="visible">True</property>
|
| 176 | 192 |
<property name="can-focus">False</property>
|
| 177 | 193 |
<property name="label" translatable="yes"><b>8</b> tuv</property>
|
| ... | ... | @@ -185,13 +201,15 @@ |
| 185 | 201 |
</packing>
|
| 186 | 202 |
</child>
|
| 187 | 203 |
<child>
|
| 188 |
- <object class="GtkButton" id="9_button">
|
|
| 204 |
+ <object class="GtkButton" id="button_9">
|
|
| 189 | 205 |
<property name="visible">True</property>
|
| 190 | 206 |
<property name="can-focus">True</property>
|
| 191 | 207 |
<property name="receives-default">True</property>
|
| 192 | 208 |
<property name="relief">none</property>
|
| 209 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 210 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 193 | 211 |
<child>
|
| 194 |
- <object class="GtkLabel" id="label9">
|
|
| 212 |
+ <object class="GtkLabel">
|
|
| 195 | 213 |
<property name="visible">True</property>
|
| 196 | 214 |
<property name="can-focus">False</property>
|
| 197 | 215 |
<property name="label" translatable="yes"><b>9</b> wxyz</property>
|
| ... | ... | @@ -205,13 +223,15 @@ |
| 205 | 223 |
</packing>
|
| 206 | 224 |
</child>
|
| 207 | 225 |
<child>
|
| 208 |
- <object class="GtkButton" id="*_button">
|
|
| 226 |
+ <object class="GtkButton" id="button_star">
|
|
| 209 | 227 |
<property name="visible">True</property>
|
| 210 | 228 |
<property name="can-focus">True</property>
|
| 211 | 229 |
<property name="receives-default">True</property>
|
| 212 | 230 |
<property name="relief">none</property>
|
| 231 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 232 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 213 | 233 |
<child>
|
| 214 |
- <object class="GtkLabel" id="label10">
|
|
| 234 |
+ <object class="GtkLabel">
|
|
| 215 | 235 |
<property name="visible">True</property>
|
| 216 | 236 |
<property name="can-focus">False</property>
|
| 217 | 237 |
<property name="label" translatable="yes"><b>*</b></property>
|
| ... | ... | @@ -225,13 +245,15 @@ |
| 225 | 245 |
</packing>
|
| 226 | 246 |
</child>
|
| 227 | 247 |
<child>
|
| 228 |
- <object class="GtkButton" id="0_button">
|
|
| 248 |
+ <object class="GtkButton" id="button_0">
|
|
| 229 | 249 |
<property name="visible">True</property>
|
| 230 | 250 |
<property name="can-focus">True</property>
|
| 231 | 251 |
<property name="receives-default">True</property>
|
| 232 | 252 |
<property name="relief">none</property>
|
| 253 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 254 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 233 | 255 |
<child>
|
| 234 |
- <object class="GtkLabel" id="label11">
|
|
| 256 |
+ <object class="GtkLabel">
|
|
| 235 | 257 |
<property name="visible">True</property>
|
| 236 | 258 |
<property name="can-focus">False</property>
|
| 237 | 259 |
<property name="label" translatable="yes"><b>0</b></property>
|
| ... | ... | @@ -245,13 +267,15 @@ |
| 245 | 267 |
</packing>
|
| 246 | 268 |
</child>
|
| 247 | 269 |
<child>
|
| 248 |
- <object class="GtkButton" id="#_button">
|
|
| 270 |
+ <object class="GtkButton" id="button_pound">
|
|
| 249 | 271 |
<property name="visible">True</property>
|
| 250 | 272 |
<property name="can-focus">True</property>
|
| 251 | 273 |
<property name="receives-default">True</property>
|
| 252 | 274 |
<property name="relief">none</property>
|
| 275 |
+ <signal name="pressed" handler="_on_num_button_press" swapped="no"/>
|
|
| 276 |
+ <signal name="released" handler="_on_num_button_release" swapped="no"/>
|
|
| 253 | 277 |
<child>
|
| 254 |
- <object class="GtkLabel" id="label12">
|
|
| 278 |
+ <object class="GtkLabel">
|
|
| 255 | 279 |
<property name="visible">True</property>
|
| 256 | 280 |
<property name="can-focus">False</property>
|
| 257 | 281 |
<property name="label" translatable="yes"><b>#</b></property>
|
| ... | ... | @@ -274,30 +274,18 @@ class CallWidgetBuilder(Builder): |
| 274 | 274 |
adjustment2: Gtk.Adjustment
|
| 275 | 275 |
dtmf_popover: Gtk.Popover
|
| 276 | 276 |
grid1: Gtk.Grid
|
| 277 |
- 1_button: Gtk.Button
|
|
| 278 |
- label1: Gtk.Label
|
|
| 279 |
- 2_button: Gtk.Button
|
|
| 280 |
- label2: Gtk.Label
|
|
| 281 |
- 3_button: Gtk.Button
|
|
| 282 |
- label3: Gtk.Label
|
|
| 283 |
- 4_button: Gtk.Button
|
|
| 284 |
- label4: Gtk.Label
|
|
| 285 |
- 5_button: Gtk.Button
|
|
| 286 |
- label5: Gtk.Label
|
|
| 287 |
- 6_button: Gtk.Button
|
|
| 288 |
- label6: Gtk.Label
|
|
| 289 |
- 7_button: Gtk.Button
|
|
| 290 |
- label7: Gtk.Label
|
|
| 291 |
- 8_button: Gtk.Button
|
|
| 292 |
- label8: Gtk.Label
|
|
| 293 |
- 9_button: Gtk.Button
|
|
| 294 |
- label9: Gtk.Label
|
|
| 295 |
- *_button: Gtk.Button
|
|
| 296 |
- label10: Gtk.Label
|
|
| 297 |
- 0_button: Gtk.Button
|
|
| 298 |
- label11: Gtk.Label
|
|
| 299 |
- #_button: Gtk.Button
|
|
| 300 |
- label12: Gtk.Label
|
|
| 277 |
+ button_1: Gtk.Button
|
|
| 278 |
+ button_2: Gtk.Button
|
|
| 279 |
+ button_3: Gtk.Button
|
|
| 280 |
+ button_4: Gtk.Button
|
|
| 281 |
+ button_5: Gtk.Button
|
|
| 282 |
+ button_6: Gtk.Button
|
|
| 283 |
+ button_7: Gtk.Button
|
|
| 284 |
+ button_8: Gtk.Button
|
|
| 285 |
+ button_9: Gtk.Button
|
|
| 286 |
+ button_star: Gtk.Button
|
|
| 287 |
+ button_0: Gtk.Button
|
|
| 288 |
+ button_pound: Gtk.Button
|
|
| 301 | 289 |
av_box: Gtk.Box
|
| 302 | 290 |
video_box: Gtk.Box
|
| 303 | 291 |
outgoing_viewport: Gtk.Viewport
|
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 |
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
| 14 | 14 |
|
| 15 | 15 |
from __future__ import annotations
|
| 16 |
+ |
|
| 16 | 17 |
from typing import Any
|
| 17 | 18 |
from typing import List
|
| 18 | 19 |
from typing import Optional
|
| ... | ... | @@ -21,7 +22,6 @@ |
| 21 | 22 |
import time
|
| 22 | 23 |
|
| 23 | 24 |
from gi.repository import GObject
|
| 24 |
-from gi.repository import Gdk
|
|
| 25 | 25 |
from gi.repository import Gtk
|
| 26 | 26 |
|
| 27 | 27 |
from nbxmpp.namespaces import Namespace
|
| ... | ... | @@ -68,7 +68,7 @@ def __init__(self, account: str, contact: types.BareContact) -> None: |
| 68 | 68 |
# having to show a new call row
|
| 69 | 69 |
self._incoming_video_event = None
|
| 70 | 70 |
|
| 71 |
- self._jingle: dict(str, JingleObject) = {
|
|
| 71 |
+ self._jingle: dict[str, JingleObject] = {
|
|
| 72 | 72 |
'audio': JingleObject(
|
| 73 | 73 |
JingleState.NULL,
|
| 74 | 74 |
self._update_audio),
|
| ... | ... | @@ -83,14 +83,6 @@ def __init__(self, account: str, contact: types.BareContact) -> None: |
| 83 | 83 |
self.add(self._ui.av_box)
|
| 84 | 84 |
self.connect('destroy', self._on_destroy)
|
| 85 | 85 |
|
| 86 |
- dtmf: list(str) = [
|
|
| 87 |
- '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#']
|
|
| 88 |
- for key in dtmf:
|
|
| 89 |
- button = self._ui.get_object(key + '_button')
|
|
| 90 |
- button.connect(
|
|
| 91 |
- 'button-press-event', self._on_num_button_press, key)
|
|
| 92 |
- button.connect('button-release-event', self._on_num_button_release)
|
|
| 93 |
- |
|
| 94 | 86 |
self._ui.connect_signals(self)
|
| 95 | 87 |
|
| 96 | 88 |
def _on_destroy(self, *args: Any) -> None:
|
| ... | ... | @@ -178,17 +170,12 @@ def _store_outgoing_call(self, sid: str) -> None: |
| 178 | 170 |
KindConstant.CALL_OUTGOING,
|
| 179 | 171 |
additional_data=additional_data)
|
| 180 | 172 |
|
| 181 |
- def _on_num_button_press(self,
|
|
| 182 |
- _button: Gtk.Button,
|
|
| 183 |
- _event: Gdk.EventButton,
|
|
| 184 |
- num: int
|
|
| 185 |
- ) -> None:
|
|
| 186 |
- self._get_audio_content().start_dtmf(num)
|
|
| 173 |
+ def _on_num_button_press(self, button: Gtk.Button) -> None:
|
|
| 174 |
+ button_id = Gtk.Buildable.get_name(button)
|
|
| 175 |
+ key = button_id.split('_')[1]
|
|
| 176 |
+ self._get_audio_content().start_dtmf(key)
|
|
| 187 | 177 |
|
| 188 |
- def _on_num_button_release(self,
|
|
| 189 |
- _button: Gtk.Button,
|
|
| 190 |
- _event: Gdk.EventButton
|
|
| 191 |
- ) -> None:
|
|
| 178 |
+ def _on_num_button_release(self, _button: Gtk.Button) -> None:
|
|
| 192 | 179 |
self._get_audio_content().stop_dtmf()
|
| 193 | 180 |
|
| 194 | 181 |
def _on_mic_volume_changed(self,
|
| ... | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 |
from gi.repository import GtkSource
|
| 34 | 34 |
|
| 35 | 35 |
|
| 36 |
-class Builder: ...
|
|
| 36 |
+class Builder(Gtk.Builder): ...
|
|
| 37 | 37 |
'''
|
| 38 | 38 |
|
| 39 | 39 |
CLASS_DEF = '\nclass %s(Builder):'
|