From 38e9a856949d3a06a3fd8fdbf2708c2f2ae3d45d Mon Sep 17 00:00:00 2001 From: DYefremov Date: Thu, 12 Jan 2023 21:46:04 +0300 Subject: [PATCH] remote control improvement --- app/connections.py | 14 +- app/ui/control.glade | 1104 ++++++++++++++++++++++++------------------ app/ui/control.py | 17 +- 3 files changed, 666 insertions(+), 469 deletions(-) diff --git a/app/connections.py b/app/connections.py index d0913667..84fb1aa8 100644 --- a/app/connections.py +++ b/app/connections.py @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2018-2022 Dmitriy Yefremov +# Copyright (c) 2018-2023 Dmitriy Yefremov # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -650,6 +650,16 @@ class HttpAPI: class Remote(str, Enum): """ Args for HttpRequestType [REMOTE] class. """ + ONE = "2" + TWO = "3" + THREE = "4" + FOUR = "5" + FIVE = "6" + SIX = "7" + SEVEN = "8" + EIGHT = "9" + NINE = "10" + ZERO = "11" UP = "103" LEFT = "105" RIGHT = "106" @@ -658,6 +668,7 @@ class HttpAPI: EXIT = "174" OK = "352" INFO = "358" + EPG = "365" TV = "377" RADIO = "385" AUDIO = "392" @@ -668,6 +679,7 @@ class HttpAPI: BLUE = "401" CH_UP = "402" CH_DOWN = "403" + NEXT = "407" BACK = "412" class Power(str, Enum): diff --git a/app/ui/control.glade b/app/ui/control.glade index 5218fac6..fc1e860b 100644 --- a/app/ui/control.glade +++ b/app/ui/control.glade @@ -1,9 +1,9 @@ - - + - + True - False - network-transmit-receive-symbolic + False + network-transmit-receive-symbolic @@ -53,64 +53,63 @@ Author: Dmitriy Yefremov + + True + False + insert-image-symbolic + + + True + False + window-new-symbolic + + + True + False + media-playback-start-symbolic + 100 - 1 - 10 + 1 + 10 True - False - 2 + False + 2 vertical 10 True - False - 20 - 20 - 5 - 5 + False + 20 + 20 + 5 + 5 15 - - - Network - 100 - True - False - True - center - network_image - True - - - - False - True - 0 - - True - False + False + Power center center + 0 - 70 + 70 True - True - True - Standby - app.on_standby + True + True + Standby + app.on_standby True - False - 16 - system-log-out + False + 16 + system-log-out 1 @@ -123,18 +122,18 @@ Author: Dmitriy Yefremov - 70 + 70 True - True - True - Wake Up - app.on_wake_up + True + True + Wake Up + app.on_wake_up True - False - 16 - document-revert + False + 16 + document-revert 1 @@ -147,18 +146,18 @@ Author: Dmitriy Yefremov - 70 + 70 True - True - True - Reboot - app.on_reboot + True + True + Reboot + app.on_reboot True - False - 16 - view-refresh + False + 16 + view-refresh 1 @@ -171,18 +170,18 @@ Author: Dmitriy Yefremov - 70 + 70 True - True - True - Restart GUI - app.on_restart_gui + True + True + Restart GUI + app.on_restart_gui True - False - 16 - window-new + False + 16 + window-new 1 @@ -195,18 +194,18 @@ Author: Dmitriy Yefremov - 70 + 70 True - True - True - Shutdown - app.on_shutdown + True + True + Shutdown + app.on_shutdown True - False - 16 - application-exit + False + 16 + application-exit @@ -223,6 +222,94 @@ Author: Dmitriy Yefremov False True + 3 + + + + + Network + 100 + True + False + True + center + 0 + network_image + True + + + + False + True + 0 + + + + + True + False + Screenshot + center + center + True + expand + + + All + 75 + True + True + True + center + app.on_screenshot_all + screenshot_all_image + True + + + True + True + 0 + + + + + Video + True + True + True + center + app.on_screenshot_video + screenshot_video_image + True + + + True + True + 1 + + + + + OSD + True + True + True + center + app.on_screenshot_osd + screenshot_osd_image + True + + + True + True + 2 + + + + + False + True + end 2 @@ -236,36 +323,36 @@ Author: Dmitriy Yefremov True - False + False 10 - 280 - False - 0.5 - in - + 280 + False + False + 0.5 + in True - False - 5 - 5 - 5 - 5 + False + 5 + 5 + 5 + 5 vertical True - True - in + True + in True - True + True network_model - False - 3 + False + 3 @@ -273,7 +360,7 @@ Author: Dmitriy Yefremov True - 25 + 25 Name True 0.5 @@ -288,14 +375,14 @@ Author: Dmitriy Yefremov True - 25 + 25 IP True 0.5 2 - 0.49 + 0.49000000953674316 1 @@ -306,13 +393,13 @@ Author: Dmitriy Yefremov True - 25 + 25 Power True 0.5 - 0.49 + 0.49000000953674316 end @@ -330,12 +417,6 @@ Author: Dmitriy Yefremov 0 - - - - - - @@ -351,29 +432,29 @@ Author: Dmitriy Yefremov True - False - 0.5 - in + False + 0.5 + in True - False - 5 - 5 - 5 - 5 + False + 5 + 5 + 5 + 5 vertical True - False - 2 - 2 - 2 - 2 + False + 2 + 2 + 2 + 2 - False + False @@ -381,23 +462,23 @@ Author: Dmitriy Yefremov True True - 1 + 0 True - False - 25 - 25 - 10 - 5 + False + 25 + 25 + 10 + 5 vertical 2 True - False + False Signal level @@ -407,115 +488,116 @@ Author: Dmitriy Yefremov + True - False - 5 - 10 - True + False + 5 + 10 + True True - False + False start SNR: - 0 - 0 + 0 + 0 True - False + False end 0 dB - 2 - 0 + 2 + 0 True - False - 100 + False + 100 - 1 - 0 + 1 + 0 True - False + False start AGC: - 0 - 1 + 0 + 1 True - False - 100 + False + 100 - 1 - 1 + 1 + 1 True - False + False end 0 % - 2 - 1 + 2 + 1 True - False + False start BER: - 0 - 2 + 0 + 2 True - False - 100 + False + 100 - 1 - 2 + 1 + 2 True - False + False end 0 - 2 - 2 + 2 + 2 @@ -529,7 +611,7 @@ Author: Dmitriy Yefremov False True - end + end 2 @@ -547,175 +629,344 @@ Author: Dmitriy Yefremov - 300 + 300 True - False - 0.5 - in + False + 0.5 + in True - False + False center - 25 - 25 - 10 - 10 + 25 + 15 + 5 + 5 vertical 5 + True - False + False center center - 5 - 5 - 5 - 5 - 5 - 5 - True - - - OK - True - True - True - app.on_ok - - - 1 - 1 - - - - - True - True - True - app.on_up - - - True - False - gtk-go-up - - - - - 1 - 0 - - - - - True - True - True - app.on_down - - - True - False - gtk-go-down - - - - - 1 - 2 - - - - - True - True - True - app.on_right - True - - - True - False - gtk-go-forward - - - - - 2 - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 + True True - True - True - app.on_left + True + True + app.on_left True - False + False gtk-go-back - 0 - 1 + 0 + 5 - - MENU + True - True - True - app.on_menu + True + True + app.on_down + + + True + False + gtk-go-down + + - 0 - 2 + 1 + 6 - - EXIT + + OK True - True - True - app.on_exit + True + True + app.on_ok - 2 - 2 + 1 + 5 + + + + + True + True + True + app.on_right + True + + + True + False + gtk-go-forward + + + + + 2 + 5 + + + + + True + True + True + app.on_up + + + True + False + gtk-go-up + + + + + 1 + 4 + + + + + 1 + status-bar-button + True + True + True + app.on_one + + + 0 + 0 + + + + + 2 + status-bar-button + True + True + True + app.on_two + + + 1 + 0 + + + + + 3 + status-bar-button + True + True + True + app.on_three + + + 2 + 0 + + + + + 4 + status-bar-button + True + True + True + app.on_four + + + 0 + 1 + + + + + 5 + status-bar-button + True + True + True + app.on_five + + + 1 + 1 + + + + + 6 + status-bar-button + True + True + True + app.on_six + + + 2 + 1 + + + + + 7 + status-bar-button + True + True + True + app.on_seven + + + 0 + 2 + + + + + 8 + status-bar-button + True + True + True + app.on_eight + + + 1 + 2 + + + + + 9 + status-bar-button + True + True + True + app.on_nine + + + 2 + 2 + + + + + 0 + status-bar-button + True + True + True + app.on_zero + + + 1 + 3 - BACK + < + status-bar-button True - True - True - app.on_back + True + True + app.on_back - 0 - 0 + 0 + 3 + + + + + > + status-bar-button + True + True + True + app.on_next + + + 2 + 3 INFO True - True - True - app.on_info + True + True + app.on_info - 2 - 0 + 0 + 4 + + + + + MENU + True + True + True + app.on_menu + + + 0 + 6 + + + + + EXIT + True + True + True + app.on_exit + + + 2 + 6 + + + + + EPG + True + True + True + app.on_epg + + + 2 + 4 @@ -726,59 +977,60 @@ Author: Dmitriy Yefremov + True - False + False center - 5 - 15 + 5 + 15 True - False + False Ch - 1 - 0 + 1 + 0 True - True - True - app.on_ch_up + True + True + app.on_ch_up True - False - up + False + up - 0 - 0 + 0 + 0 True - True - True - app.on_ch_down + True + True + app.on_ch_down True - False - down + False + down - 2 - 0 + 2 + 0 @@ -791,9 +1043,9 @@ Author: Dmitriy Yefremov True - True - False - True + True + False + True vertical volume_adjustment audio-volume-muted-symbolic @@ -803,8 +1055,8 @@ audio-volume-medium-symbolic - True - True + True + True center center none @@ -812,8 +1064,8 @@ audio-volume-medium-symbolic - True - True + True + True center center none @@ -829,7 +1081,7 @@ audio-volume-medium-symbolic True - False + False False @@ -838,162 +1090,163 @@ audio-volume-medium-symbolic + True - False - 5 - 5 - True + False + 5 + 5 + True R status-bar-button - 24 + 24 True - True - True - app.on_red + True + True + app.on_red - 0 - 0 + 0 + 0 status-bar-button True - True - True - app.on_prev_media + True + True + app.on_prev_media True - False - media-skip-backward + False + media-skip-backward - 0 - 1 + 0 + 1 G status-bar-button - 24 + 24 True - True - True - app.on_green + True + True + app.on_green - 1 - 0 + 1 + 0 status-bar-button True - True - True - app.on_play_media + True + True + app.on_play_media True - False - media-playback-start + False + media-playback-start - 1 - 1 + 1 + 1 Y status-bar-button - 24 + 24 True - True - True - app.on_yellow + True + True + app.on_yellow - 2 - 0 + 2 + 0 B status-bar-button - 24 + 24 True - True - True - app.on_blue + True + True + app.on_blue - 3 - 0 + 3 + 0 status-bar-button True - True - True - app.on_stop_media + True + True + app.on_stop_media True - False - media-playback-stop + False + media-playback-stop - 2 - 1 + 2 + 1 status-bar-button True - True - True - app.on_next_media + True + True + app.on_next_media True - False - media-skip-forward + False + media-skip-forward - 3 - 1 + 3 + 1 @@ -1001,13 +1254,13 @@ audio-volume-medium-symbolic TV status-bar-button True - True - True - app.on_tv + True + True + app.on_tv - 1 - 2 + 1 + 2 @@ -1015,13 +1268,13 @@ audio-volume-medium-symbolic Radio status-bar-button True - True - True - app.on_radio + True + True + app.on_radio - 2 - 2 + 2 + 2 @@ -1029,13 +1282,13 @@ audio-volume-medium-symbolic Audio status-bar-button True - True - True - app.on_audio + True + True + app.on_audio - 0 - 2 + 0 + 2 @@ -1043,13 +1296,13 @@ audio-volume-medium-symbolic FAV status-bar-button True - True - True - app.on_fav + True + True + app.on_fav - 3 - 2 + 3 + 2 @@ -1063,12 +1316,11 @@ audio-volume-medium-symbolic Grab screenshot True - True - False + True + False center - 10 - 10 - False + 5 + False False @@ -1076,88 +1328,6 @@ audio-volume-medium-symbolic 5 - - - True - False - center - 0.5 - none - - - True - False - center - center - 5 - 5 - 5 - 5 - True - expand - - - All - 75 - True - True - True - center - app.on_screenshot_all - - - True - True - 0 - - - - - Video - True - True - True - center - app.on_screenshot_video - - - True - True - 1 - - - - - OSD - True - True - True - center - app.on_screenshot_osd - - - True - True - 2 - - - - - - - True - False - Screenshot - - - - - False - True - end - 7 - - diff --git a/app/ui/control.py b/app/ui/control.py index 3488650e..12241321 100644 --- a/app/ui/control.py +++ b/app/ui/control.py @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2018-2022 Dmitriy Yefremov +# Copyright (c) 2018-2023 Dmitriy Yefremov # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -70,6 +70,7 @@ class ControlTool(Gtk.Box): self._agc_level_bar = builder.get_object("agc_level_bar") self._volume_button = builder.get_object("volume_button") self._header_box = builder.get_object("control_header_box") + self._screenshot_button_box = builder.get_object("screenshot_button_box") # Network. self._network_button = builder.get_object("control_network_button") self._network_model = builder.get_object("network_model") @@ -83,15 +84,27 @@ class ControlTool(Gtk.Box): def init_actions(self, app): # Remote controller actions. + app.set_action("on_one", lambda a, v: self.on_remote_action(HttpAPI.Remote.ONE)) + app.set_action("on_two", lambda a, v: self.on_remote_action(HttpAPI.Remote.TWO)) + app.set_action("on_three", lambda a, v: self.on_remote_action(HttpAPI.Remote.THREE)) + app.set_action("on_four", lambda a, v: self.on_remote_action(HttpAPI.Remote.FOUR)) + app.set_action("on_five", lambda a, v: self.on_remote_action(HttpAPI.Remote.FIVE)) + app.set_action("on_six", lambda a, v: self.on_remote_action(HttpAPI.Remote.SIX)) + app.set_action("on_seven", lambda a, v: self.on_remote_action(HttpAPI.Remote.SEVEN)) + app.set_action("on_eight", lambda a, v: self.on_remote_action(HttpAPI.Remote.EIGHT)) + app.set_action("on_nine", lambda a, v: self.on_remote_action(HttpAPI.Remote.NINE)) + app.set_action("on_zero", lambda a, v: self.on_remote_action(HttpAPI.Remote.ZERO)) app.set_action("on_up", lambda a, v: self.on_remote_action(HttpAPI.Remote.UP)) app.set_action("on_down", lambda a, v: self.on_remote_action(HttpAPI.Remote.DOWN)) app.set_action("on_left", lambda a, v: self.on_remote_action(HttpAPI.Remote.LEFT)) app.set_action("on_right", lambda a, v: self.on_remote_action(HttpAPI.Remote.RIGHT)) + app.set_action("on_next", lambda a, v: self.on_remote_action(HttpAPI.Remote.NEXT)) app.set_action("on_back", lambda a, v: self.on_remote_action(HttpAPI.Remote.BACK)) app.set_action("on_info", lambda a, v: self.on_remote_action(HttpAPI.Remote.INFO)) app.set_action("on_ok", lambda a, v: self.on_remote_action(HttpAPI.Remote.OK)) app.set_action("on_menu", lambda a, v: self.on_remote_action(HttpAPI.Remote.MENU)) app.set_action("on_exit", lambda a, v: self.on_remote_action(HttpAPI.Remote.EXIT)) + app.set_action("on_epg", lambda a, v: self.on_remote_action(HttpAPI.Remote.EPG)) app.set_action("on_ch_up", lambda a, v: self.on_remote_action(HttpAPI.Remote.CH_UP)) app.set_action("on_ch_down", lambda a, v: self.on_remote_action(HttpAPI.Remote.CH_DOWN)) app.set_action("on_red", lambda a, v: self.on_remote_action(HttpAPI.Remote.RED)) @@ -124,6 +137,8 @@ class ControlTool(Gtk.Box): self._remote_box.reorder_child(children[-1], 0) pack_type = Gtk.PackType.END if alt_layout else Gtk.PackType.START self._header_box.set_child_packing(self._network_button, False, False, 0, pack_type) + pack_type = Gtk.PackType.START if alt_layout else Gtk.PackType.END + self._header_box.set_child_packing(self._screenshot_button_box, False, False, 0, pack_type) # ***************** Remote controller ********************* #