some corrections

This commit is contained in:
DYefremov
2021-08-18 00:24:51 +03:00
parent c55645e5db
commit 6e459f80bd
6 changed files with 90 additions and 47 deletions

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
<!-- Generated with glade 3.22.2
The MIT License (MIT)
Copyright (c) 2018-2020 Dmitriy Yefremov
Copyright (c) 2018-2021 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
@@ -1359,11 +1359,21 @@ Author: Dmitriy Yefremov
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage" id="screenshot_image">
<object class="GtkViewport" id="screenshot_view_port">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="stock">gtk-missing-image</property>
<property name="icon_size">6</property>
<child>
<object class="GtkImage" id="screenshot_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="stock">gtk-missing-image</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
@@ -1498,6 +1508,7 @@ Author: Dmitriy Yefremov
</child>
<child>
<object class="GtkFrame" id="control_frame">
<property name="width_request">300</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>

View File

@@ -1,3 +1,31 @@
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2018-2021 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
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# Author: Dmitriy Yefremov
#
""" Receiver control module via HTTP API. """
import os
from datetime import datetime
@@ -361,8 +389,9 @@ class ControlBox(Gtk.HBox):
if data:
from gi.repository import GdkPixbuf
allocation = self._screenshot_image.get_parent().get_allocation()
loader = GdkPixbuf.PixbufLoader.new_with_type("jpeg")
loader.set_size(280, 165)
loader.set_size(allocation.width, allocation.height)
try:
loader.write(data)
pix = loader.get_pixbuf()

View File

@@ -3454,13 +3454,12 @@ class Application(Gtk.Application):
return 5 if self._settings.v5_support else 4
def show_error_message(self, message):
show_dialog(DialogType.ERROR, self._main_window, message)
self.show_info_message(message, Gtk.MessageType.ERROR)
@run_idle
def show_info_message(self, text, message_type):
self._info_bar.set_visible(False)
self._info_label.set_text(get_message(text))
# self._message_label.set_text(get_message(text))
self._info_bar.set_message_type(message_type)
self._info_bar.set_visible(True)

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
<!-- Generated with glade 3.22.2
The MIT License (MIT)
@@ -227,7 +227,6 @@ Author: Dmitriy Yefremov
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
@@ -237,7 +236,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">False</property>
<property name="margin_left">15</property>
<property name="margin_right">15</property>
<property name="margin_top">10</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="spacing">5</property>
<child>
@@ -480,7 +479,6 @@ Author: Dmitriy Yefremov
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="notify::visible-child" handler="on_visible_page" swapped="no"/>
<child>
@@ -495,6 +493,7 @@ Author: Dmitriy Yefremov
<property name="tooltip_text" translatable="yes">Filter services in the main list.</property>
<property name="halign">end</property>
<property name="valign">end</property>
<property name="margin_right">5</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="filter_services_label">
@@ -532,32 +531,9 @@ Author: Dmitriy Yefremov
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkSearchBar" id="search_bar">
<property name="can_focus">False</property>
<property name="margin_top">1</property>
<property name="margin_bottom">1</property>
<child>
<object class="GtkSearchEntry" id="picons_search_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSearchBar" id="filter_bar">
<property name="can_focus">False</property>
<property name="margin_top">1</property>
<property name="margin_bottom">1</property>
<child>
<object class="GtkSearchEntry" id="picons_filter_entry">
<property name="visible">True</property>
@@ -579,6 +555,7 @@ Author: Dmitriy Yefremov
<object class="GtkFrame" id="explorer_paths_frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="label_xalign">0.5</property>
<property name="shadow_type">in</property>
<child>
@@ -589,6 +566,7 @@ Author: Dmitriy Yefremov
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<property name="wide_handle">True</property>
<child>
<object class="GtkBox" id="src_picons_box">
@@ -1731,7 +1709,6 @@ Author: Dmitriy Yefremov
<object class="GtkExpander" id="expander">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="resize_toplevel">True</property>
<child>
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="height_request">150</property>
@@ -1742,7 +1719,7 @@ Author: Dmitriy Yefremov
<child>
<object class="GtkTextView" id="text_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="editable">False</property>
<property name="wrap_mode">word-char</property>
<property name="left_margin">5</property>

View File

@@ -598,7 +598,6 @@ class PiconManager(Gtk.Box):
self._satellite_label.show()
def on_satellite_selection(self, view, path, column):
self.on_info_bar_close()
model = self._providers_view.get_model()
model.clear()
self._satellite_label.set_visible(False)
@@ -635,13 +634,13 @@ class PiconManager(Gtk.Box):
def on_receive(self, item):
if self._is_downloading:
self.show_dialog("The task is already running!", DialogType.ERROR)
self._app.show_error_message("The task is already running!")
return
providers = self.get_selected_providers()
if self._download_src is self.DownloadSource.PICON_CZ and len(providers) > 1:
self.show_dialog("Please, select only one item!", DialogType.ERROR)
self._app.show_error_message("Please, select only one item!")
return
self._cancel_button.show()
@@ -730,7 +729,7 @@ class PiconManager(Gtk.Box):
model, paths = self._app.bouquets_view.get_selection().get_selected_rows()
if len(paths) > 1:
self.show_dialog("Please, select only one bouquet!", DialogType.ERROR)
self._app.show_error_message("Please, select only one bouquet!")
return
fav_bouquet = self._app.current_bouquets[bq_selected]
@@ -949,7 +948,7 @@ class PiconManager(Gtk.Box):
picons_path = self._enigma2_path_button.get_filename()
save_path = self._save_to_button.get_filename()
if not picons_path or not save_path:
show_dialog(DialogType.ERROR, transient=self._app_window, text="Select paths!")
self._app.show_error_message("Select paths!")
return
self._expander.set_expanded(True)

View File

@@ -1,3 +1,31 @@
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2018-2021 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
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# Author: Dmitriy Yefremov
#
import concurrent.futures
import re
import time
@@ -63,7 +91,7 @@ class SatellitesTool(Gtk.Box):
return
if not str(response).endswith("satellites.xml"):
show_dialog(DialogType.ERROR, self._window, text="No satellites.xml file is selected!")
self._app.show_error_message("No satellites.xml file is selected!")
return
self._data_path = response
@@ -111,8 +139,8 @@ class SatellitesTool(Gtk.Box):
satellites = get_satellites(self._data_path)
yield True
except FileNotFoundError as e:
show_dialog(DialogType.ERROR, self._window, getattr(e, "message", str(e)) +
"\n\nPlease, download files from receiver or setup your path for read data!")
msg = get_message("Please, download files from receiver or setup your path for read data!")
self._app.show_error_message("{}\n{}".format(e, msg))
return
else:
model.clear()
@@ -168,7 +196,7 @@ class SatellitesTool(Gtk.Box):
if paths is None:
return
elif len(paths) == 0:
show_dialog(DialogType.ERROR, self._window, "No satellite is selected!")
self._app.show_error_message("No satellite is selected!")
return
dialog = TransponderDialog(self._app.get_active_window(), transponder)
@@ -222,7 +250,7 @@ class SatellitesTool(Gtk.Box):
"""
model, paths = view.get_selection().get_selected_rows()
if len(paths) > 1:
show_dialog(DialogType.ERROR, self._window, message)
self._app.show_error_message(message)
return
return paths