basic adaptation of the code and gui

This commit is contained in:
DYefremov
2021-02-25 11:45:29 +03:00
parent 51181057b1
commit 33137ee879
24 changed files with 787 additions and 973 deletions

View File

@@ -1,67 +1,48 @@
import os
import datetime
import distutils.util
# -*- mode: python ; coding: utf-8 -*-
EXE_NAME = 'start.py'
DIR_PATH = os.getcwd()
COMPILING_PLATFORM = distutils.util.get_platform()
PATH_EXE = [os.path.join(DIR_PATH, EXE_NAME)]
STRIP = True
BUILD_DATE = datetime.datetime.now().strftime("%Y%m%d")
block_cipher = None
ui_files = [('app/ui/*.glade', 'ui'),
('app/ui/*.css', 'ui'),
('app/ui/*.ui', 'ui'),
('app/ui/lang*', 'share/locale'),
('app/ui/icons*', 'share/icons')
ui_files = [('app\\ui\\*.glade', 'ui'),
('app\\ui\\*.css', 'ui'),
('app\\ui\\*.ui', 'ui'),
('app\\ui\\lang*', 'share\\locale'),
('app\\ui\\icons*', 'share\\icons')
]
a = Analysis([EXE_NAME],
pathex=PATH_EXE,
binaries=None,
binaries=[],
datas=ui_files,
hiddenimports=['fileinput', 'uuid'],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=['youtube_dl', 'tkinter'],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
pyz = PYZ(a.pure,
a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='DemonEditor',
debug=False,
strip=STRIP,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False)
console=False, icon='icon.ico')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=STRIP,
strip=False,
upx=True,
upx_exclude=[],
name='DemonEditor')
app = BUNDLE(coll,
name='DemonEditor.app',
icon='icon.icns',
bundle_identifier=None,
info_plist={
'NSPrincipalClass': 'NSApplication',
'CFBundleName': 'DemonEditor',
'CFBundleDisplayName': 'DemonEditor',
'CFBundleGetInfoString': "Enigma2 channel and satellites editor",
'LSApplicationCategoryType': 'public.app-category.utilities',
'CFBundleShortVersionString': "1.0.4 Beta (Build: {})".format(BUILD_DATE),
'NSHumanReadableCopyright': u"Copyright © 2020, Dmitriy Yefremov",
'NSRequiresAquaSystemAppearance': 'false'
})

View File

@@ -1,8 +1,6 @@
# <img src="app/ui/icons/hicolor/96x96/apps/demon-editor.png" width="32" /> DemonEditor
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) ![platform](https://img.shields.io/badge/platform-macos-lightgrey)
## Enigma2 channel and satellite list editor for macOS (experimental).
![Main app window in macOS Big Sur.](https://user-images.githubusercontent.com/7511379/92320982-9b20c780-f02e-11ea-8a43-fc0c70503573.png)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) ![platform](https://img.shields.io/badge/platform-windows-lightgrey)
## Enigma2 channel and satellite list editor for MS Windows (experimental).
Experimental support of Neutrino-MP or others on the same basis (BPanther, etc).
Focused on the convenience of working in lists from the keyboard. The mouse is also fully supported (Drag and Drop etc).
@@ -22,61 +20,36 @@ Focused on the convenience of working in lists from the keyboard. The mouse is a
* Control panel with the ability to view EPG and manage timers (via HTTP API, experimental).
* Simple FTP client (experimental).
#### Keyboard shortcuts
* **&#8984; + X** - only in bouquet list.
* **&#8984; + C** - only in services list.
Clipboard is **"rubber"**. There is an accumulation before the insertion!
* **&#8984; + E** - edit.
* **&#8984; + R, F2** - rename.
* **&#8984; + S, T** in Satellites edit tool for create satellite or transponder.
* **&#8984; + L** - parental lock.
* **&#8984; + H** - hide/skip.
* **&#8984; + P** - start play IPTV or other stream in the bouquet list.
* **&#8984; + Z** - switch(**zap**) the channel(works when the HTTP API is enabled, Enigma2 only).
* **&#8984; + W** - switch to the channel and watch in the program.
* **&#8984; + Up/Down** - move selected items in the list.
* **&#8984; + O** - (re)load user data from current dir.
* **&#8984; + D** - load data from receiver.
* **&#8984; + U/B** - upload data/bouquets to receiver.
* **&#8984; + F** - show/hide search bar.
* **&#8679; + &#8984; + F** - show/hide filter bar.
* **Left/Right** - remove selection.
#### Keyboard shortcuts
* **Ctrl + X** - only in bouquet list.
* **Ctrl + C** - only in services list.
Clipboard is **"rubber"**. There is an accumulation before the insertion!
* **Ctrl + Insert** - copies the selected channels from the main list to the bouquet
beginning or inserts (creates) a new bouquet.
* **Ctrl + BackSpace** - copies the selected channels from the main list to the bouquet end.
* **Ctrl + E** - edit.
* **Ctrl + R, F2** - rename.
* **Ctrl + S, T** in Satellites edit tool for create satellite or transponder.
* **Ctrl + L** - parental lock.
* **Ctrl + H** - hide/skip.
* **Ctrl + P** - start play IPTV or other stream in the bouquet list.
* **Ctrl + Z** - switch(**zap**) the channel(works when the HTTP API is enabled, Enigma2 only).
* **Ctrl + W** - switch to the channel and watch in the program.
* **Space** - select/deselect.
* **Left/Right** - remove selection.
* **Ctrl + Up, Down, PageUp, PageDown, Home, End**- move selected items in the list.
* **Ctrl + O** - (re)load user data from current dir.
* **Ctrl + D** - load data from receiver.
* **Ctrl + U/B** - upload data/bouquets to receiver.
* **Ctrl + I** - extra info, details.
* **Ctrl + F** - show/hide search bar.
* **Ctrl + Shift + F** - show/hide filter bar.
For **multiple** selection with the mouse, press and hold the **&#8984;** key!
For **multiple** selection with the mouse, press and hold the **Ctrl** key!
## Minimum requirements
*Python >= 3.5.2, GTK+ >= 3.16 with PyGObject bindings, python3-requests.*
*Python >= 3.4.4, GTK+ >= 3.16 with PyGObject bindings, python3-requests.*
## Installation and Launch
To run the program on macOS, you need to install [brew](https://brew.sh/).
Then install the required components via terminal:
```brew install python3 gtk+3 pygobject3 adwaita-icon-theme```
```pip3 install requests```
#### Optional:
```brew install wget```
```pip3 install pillow, pyobjc```
To start the program, just download the [archive](https://github.com/DYefremov/DemonEditor/archive/experimental-mac.zip), unpack and run it from the terminal
with the command: ```./start.py```
## Standalone package
You can also download the ready-made package as a ***.dmg** file from the [releases](https://github.com/DYefremov/DemonEditor/releases) page.
Recommended copy the package to the **Application** directory.
Perhaps in the security settings it will be necessary to allow the launch of this application!
**The package may not contain all the latest changes. Not all features can be supported and tested!**
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY.
AUTHOR IS NOT LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY CONNECTION WITH THIS SOFTWARE.
The package may contain components distributed under the GPL [v3](http://www.gnu.org/licenses/gpl-3.0.html) or lower license.
By downloading and using this package you agree to the terms of this [license](http://www.gnu.org/licenses/gpl-3.0.html) and the possible inconvenience associated with this!
#### Building your own package
Install [PyInstaller](https://www.pyinstaller.org/) with the command from the terminal:
```pip3 install pyinstaller```
and in the root dir run command:
```pyinstaller DemonEditor.spec```
## Important
**This version is not fully tested and has experimental status!**
@@ -88,6 +61,7 @@ When using the multiple import feature, from *lamedb* will be taken data **only
If you need full set of the data, including *[satellites, terrestrial, cables].xml* (current files will be overwritten),
just load your data via *"File/Open"* and press *"Save"*. When importing separate bouquet files, only those services
(excluding IPTV) that are in the **current open lamedb** (main list of services) will be imported.
#### Command line arguments:
* **-l** - write logs to file.
* **-d on/off** - turn on/off debug mode. Allows to display more information in the logs.

View File

@@ -274,7 +274,7 @@ class LameDbWriter:
def write(self):
if self._fmt == 4:
# Writing lamedb file ver.4
with open(self._path + _FILE_NAME, "w") as file:
with open(self._path + _FILE_NAME, "w", encoding="utf-8") as file:
file.writelines(LameDbReader.get_services_lines(self._services))
elif self._fmt == 5:
self.write_to_lamedb5()

View File

@@ -5,14 +5,14 @@ import os
import sys
from enum import Enum, IntEnum
from functools import lru_cache
from pathlib import Path
from pprint import pformat
from textwrap import dedent
SEP = os.sep
HOME_PATH = os.path.expanduser("~")
CONFIG_PATH = HOME_PATH + "/.config/demon-editor/"
CONFIG_PATH = HOME_PATH + "{}.config{}demon-editor{}".format(SEP, SEP, SEP)
CONFIG_FILE = CONFIG_PATH + "config.json"
DATA_PATH = HOME_PATH + "/DemonEditor/data/"
DATA_PATH = HOME_PATH + "{}DemonEditor{}data{}".format(SEP, SEP, SEP)
IS_DARWIN = sys.platform == "darwin"
IS_WIN = sys.platform == "win32"
@@ -34,9 +34,9 @@ class Defaults(Enum):
FAV_CLICK_MODE = 0
PLAY_STREAMS_MODE = 1 if IS_DARWIN else 0
PROFILE_FOLDER_DEFAULT = False
RECORDS_PATH = DATA_PATH + "records/"
RECORDS_PATH = DATA_PATH + "records{}".format(SEP)
ACTIVATE_TRANSCODING = False
ACTIVE_TRANSCODING_PRESET = "720p TV/device"
ACTIVE_TRANSCODING_PRESET = "720p TV{}device".format(SEP)
def get_settings():
@@ -82,13 +82,13 @@ def write_settings(config):
def set_local_paths(settings, profile_name, data_path=DATA_PATH, use_profile_folder=False):
settings["data_local_path"] = "{}{}/".format(data_path, profile_name)
settings["data_local_path"] = "{}{}{}".format(data_path, profile_name, SEP)
if use_profile_folder:
settings["picons_local_path"] = "{}{}/{}/".format(data_path, profile_name, "picons")
settings["backup_local_path"] = "{}{}/{}/".format(data_path, profile_name, "backup")
settings["picons_local_path"] = "{}{}{}{}{}".format(data_path, profile_name, SEP, "picons", SEP)
settings["backup_local_path"] = "{}{}{}{}{}".format(data_path, profile_name, SEP, "backup", SEP)
else:
settings["picons_local_path"] = "{}{}/{}/".format(data_path, "picons", profile_name)
settings["backup_local_path"] = "{}{}/{}/".format(data_path, "backup", profile_name)
settings["picons_local_path"] = "{}{}{}{}{}".format(data_path, "picons", SEP, profile_name, SEP)
settings["backup_local_path"] = "{}{}{}{}{}".format(data_path, "backup", SEP, profile_name, SEP)
class SettingsType(IntEnum):
@@ -98,29 +98,29 @@ class SettingsType(IntEnum):
def get_default_settings(self):
""" Returns default settings for current type """
print(self.value)
if self.value == 0:
if self is SettingsType.ENIGMA_2:
return {"setting_type": self.value,
"host": "127.0.0.1", "port": "21", "timeout": 5,
"user": "root", "password": "root",
"http_port": "80", "http_timeout": 5, "http_use_ssl": False,
"telnet_port": "23", "telnet_timeout": 5,
"services_path": "/etc/enigma2/", "user_bouquet_path": "/etc/enigma2/",
"satellites_xml_path": "/etc/tuxbox/", "data_local_path": DATA_PATH + "enigma2/",
"satellites_xml_path": "/etc/tuxbox/", "data_local_path": "{}enigma2{}".format(DATA_PATH, SEP),
"picons_path": "/usr/share/enigma2/picon/",
"picons_local_path": DATA_PATH + "enigma2/picons/",
"backup_local_path": DATA_PATH + "enigma2/backup/"}
elif self.value == 1:
"picons_local_path": "{}enigma2{}picons{}".format(DATA_PATH, SEP, SEP),
"backup_local_path": "{}enigma2{}backup{}".format(DATA_PATH, SEP, SEP)}
elif self is SettingsType.NEUTRINO_MP:
return {"setting_type": self,
"host": "127.0.0.1", "port": "21", "timeout": 5,
"user": "root", "password": "root",
"http_port": "80", "http_timeout": 2, "http_use_ssl": False,
"telnet_port": "23", "telnet_timeout": 1,
"services_path": "/var/tuxbox/config/zapit/", "user_bouquet_path": "/var/tuxbox/config/zapit/",
"satellites_xml_path": "/var/tuxbox/config/", "data_local_path": DATA_PATH + "neutrino/",
"satellites_xml_path": "/var/tuxbox/config/",
"data_local_path": "{}neutrino{}".format(DATA_PATH, SEP),
"picons_path": "/usr/share/tuxbox/neutrino/icons/logo/",
"picons_local_path": DATA_PATH + "neutrino/picons/",
"backup_local_path": DATA_PATH + "neutrino/backup/"}
"picons_local_path": "{}neutrino{}picons{}".format(DATA_PATH, SEP, SEP),
"backup_local_path": "{}neutrino{}backup{}".format(DATA_PATH, SEP, SEP)}
class SettingsException(Exception):
@@ -182,7 +182,7 @@ class Settings:
self._cp_settings[k] = v
def_path = self.default_data_path
def_path += "enigma2/" if self.setting_type is SettingsType.ENIGMA_2 else "neutrino/"
def_path += "enigma2{}".format(SEP) if self.setting_type is SettingsType.ENIGMA_2 else "neutrino{}".format(SEP)
set_local_paths(self._cp_settings, self._current_profile, def_path, self.profile_folder_is_default)
if force_write:

View File

@@ -1,25 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="app-menu">
<section>
<item>
<attribute name="label" translatable="yes">About</attribute>
<attribute name="action">app.on_about_app</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Settings</attribute>
<attribute name="action">app.on_settings</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Exit</attribute>
<attribute name="action">app.on_close_app</attribute>
</item>
</section>
</menu>
<menu id="menu_bar">
<submenu>
<attribute name="label" translatable="yes">File</attribute>
@@ -66,19 +46,31 @@
<attribute name="action">app.on_download</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Settings</attribute>
<attribute name="action">app.on_settings</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Exit</attribute>
<attribute name="action">app.on_close_app</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">Edit</attribute>
<section>
<item>
<attribute name="label" translatable="yes">Lock</attribute>
<attribute name="action">app.on_locked</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Hide</attribute>
<attribute name="action">app.on_hide</attribute>
</item>
</section>
<item>
<attribute name="label" translatable="yes">Lock</attribute>
<attribute name="action">app.on_locked</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Hide</attribute>
<attribute name="action">app.on_hide</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">View</attribute>
@@ -111,39 +103,50 @@
</section>
<section id="telnet_section">
</section>
<section>
<submenu>
<attribute name="label" translatable="yes">IPTV</attribute>
<item>
<attribute name="label" translatable="yes">Add IPTV or stream service</attribute>
<attribute name="action">app.on_iptv</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Import YouTube playlist</attribute>
<attribute name="action">app.on_import_yt_list</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Import m3u</attribute>
<attribute name="action">app.on_import_m3u</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Export to m3u</attribute>
<attribute name="action">app.on_export_to_m3u</attribute>
</item>
<section>
<item>
<attribute name="label" translatable="yes">EPG configuration</attribute>
<attribute name="action">app.on_epg_list_configuration</attribute>
</item>
<item>
<attribute name="label" translatable="yes">List configuration</attribute>
<attribute name="action">app.on_iptv_list_configuration</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Remove all unavailable</attribute>
<attribute name="action">app.on_remove_all_unavailable</attribute>
</item>
</section>
</submenu>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">IPTV</attribute>
<item>
<attribute name="label" translatable="yes">Add IPTV or stream service</attribute>
<attribute name="action">app.on_iptv</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Import YouTube playlist</attribute>
<attribute name="action">app.on_import_yt_list</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Import m3u</attribute>
<attribute name="action">app.on_import_m3u</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Export to m3u</attribute>
<attribute name="action">app.on_export_to_m3u</attribute>
</item>
<attribute name="label" translatable="yes">Help</attribute>
<section>
<item>
<attribute name="label" translatable="yes">EPG configuration</attribute>
<attribute name="action">app.on_epg_list_configuration</attribute>
</item>
<item>
<attribute name="label" translatable="yes">List configuration</attribute>
<attribute name="action">app.on_iptv_list_configuration</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Remove all unavailable</attribute>
<attribute name="action">app.on_remove_all_unavailable</attribute>
<attribute name="label" translatable="yes">About</attribute>
<attribute name="action">app.on_about_app</attribute>
</item>
</section>
</submenu>

View File

@@ -57,7 +57,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_restore_bouquets" swapped="no"/>
<accelerator key="r" signal="activate" modifiers="Primary"/>
<accelerator key="r" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
@@ -67,7 +67,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_restore_all" swapped="no"/>
<accelerator key="e" signal="activate" modifiers="Primary"/>
<accelerator key="e" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
@@ -297,7 +297,7 @@ Author: Dmitriy Yefremov
<property name="always_show_image">True</property>
<property name="draw_indicator">False</property>
<signal name="toggled" handler="on_info_button_toggled" swapped="no"/>
<accelerator key="i" signal="clicked" modifiers="Primary"/>
<accelerator key="i" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>

View File

@@ -1176,7 +1176,7 @@ audio-volume-medium-symbolic</property>
<object class="GtkEntry" id="timer_service_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -1187,7 +1187,7 @@ audio-volume-medium-symbolic</property>
<object class="GtkEntry" id="timer_desc_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -1198,7 +1198,7 @@ audio-volume-medium-symbolic</property>
<object class="GtkEntry" id="timer_name_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -1485,7 +1485,7 @@ audio-volume-medium-symbolic</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
</child>
<style>
@@ -1556,7 +1556,7 @@ audio-volume-medium-symbolic</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
</child>
<style>
@@ -1638,7 +1638,7 @@ audio-volume-medium-symbolic</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="placeholder_text" translatable="yes">Default</property>
</object>
<packing>

View File

@@ -40,16 +40,16 @@ Author: Dmitriy Yefremov
<property name="icon_name">system-help</property>
<property name="type_hint">normal</property>
<property name="program_name">DemonEditor</property>
<property name="version">1.0.5 Beta</property>
<property name="version">1.0.5 Alpha</property>
<property name="copyright">2018-2021 Dmitriy Yefremov
</property>
<property name="comments" translatable="yes">Enigma2 channel and satellite list editor for MacOS.
(Experimental)</property>
<property name="website">https://github.com/DYefremov/DemonEditor/tree/experimental-mac</property>
</property>
<property name="comments" translatable="yes">Enigma2 channel and satellite list editor for MS Windows.
(Experimental)</property>
<property name="website">https://github.com/DYefremov/DemonEditor/tree/experimental-win</property>
<property name="license" translatable="yes">Это приложение распространяется без каких-либо гарантий.
Подробнее в &lt;a href="http://opensource.org/licenses/mit-license.php"&gt;The MIT License (MIT)&lt;/a&gt;.</property>
Подробнее в &lt;a href="http://opensource.org/licenses/mit-license.php"&gt;The MIT License (MIT)&lt;/a&gt;.</property>
<property name="authors">Dmitriy Yefremov
</property>
</property>
<property name="translator_credits" translatable="yes">translator-credits</property>
<property name="artists">Program logo: &lt;a href="http://ihad.tv"&gt;mfgeg&lt;/a&gt;</property>
<property name="logo_icon_name">demon-editor</property>
@@ -126,6 +126,7 @@ Author: Dmitriy Yefremov
<child>
<object class="GtkButton" id="input_dialog_ok_button">
<property name="label" translatable="yes">OK</property>
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -153,7 +154,7 @@ Author: Dmitriy Yefremov
<property name="margin_right">2</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="secondary_icon_sensitive">False</property>
@@ -182,9 +183,6 @@ Author: Dmitriy Yefremov
<property name="skip_pager_hint">True</property>
<property name="decorated">False</property>
<property name="gravity">center</property>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkBox" id="wait_dialog_box">
<property name="width_request">100</property>
@@ -222,7 +220,7 @@ Author: Dmitriy Yefremov
</packing>
</child>
</object>
</child>
</child> <!-- NOP -->
<style>
<class name="app-notification"/>
</style>

View File

@@ -5,6 +5,7 @@ from functools import lru_cache
from pathlib import Path
from app.commons import run_idle
from app.settings import SEP
from .uicommons import Gtk, UI_RESOURCES_PATH, TEXT_DOMAIN, IS_GNOME_SESSION
@@ -17,7 +18,7 @@ class Dialog(Enum):
<property name="use-header-bar">{use_header}</property>
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="default_width">320</property>
<property name="width_request">250</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
@@ -104,10 +105,12 @@ def get_chooser_dialog(transient, settings, name, patterns, title=None):
def get_file_chooser_dialog(transient, text, settings, action_type, file_filter, buttons=None, title=None, dirs=False):
text = get_message(text) if text else ""
action_type = Gtk.FileChooserAction.SELECT_FOLDER if action_type is None else action_type
dialog = Gtk.FileChooserNative.new(get_message(title) if title else "", transient, action_type)
buttons = buttons or (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK)
dialog = Gtk.FileChooserDialog(text, transient, action_type, buttons, use_header_bar=IS_GNOME_SESSION)
dialog.set_title(get_message(title) if title else "")
dialog.set_create_folders(dirs)
dialog.set_modal(True)
if file_filter is not None:
dialog.add_filter(file_filter)
@@ -115,10 +118,10 @@ def get_file_chooser_dialog(transient, text, settings, action_type, file_filter,
dialog.set_current_folder(settings.data_local_path)
response = dialog.run()
if response == Gtk.ResponseType.ACCEPT:
if response not in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT):
path = Path(dialog.get_filename() or dialog.get_current_folder())
if path.is_dir():
response = "{}/".format(path.resolve())
response = "{}{}".format(path.resolve(), SEP)
elif path.is_file():
response = str(path.resolve())
dialog.destroy()

View File

@@ -372,7 +372,6 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Options</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_settings" swapped="no"/>
</object>
<packing>

View File

@@ -87,7 +87,7 @@ Author: Dmitriy Yefremov
<property name="image">copy_image</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_copy_ref" swapped="no"/>
<accelerator key="c" signal="activate" modifiers="Primary"/>
<accelerator key="c" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
</object>
@@ -118,7 +118,7 @@ Author: Dmitriy Yefremov
<property name="image">insert_link_image</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_assign_ref" swapped="no"/>
<accelerator key="v" signal="activate" modifiers="Primary"/>
<accelerator key="v" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
@@ -436,7 +436,7 @@ Author: Dmitriy Yefremov
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">/data/epg/</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="secondary_icon_name">folder-open-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_tooltip_text" translatable="yes">Select</property>
@@ -466,7 +466,7 @@ Author: Dmitriy Yefremov
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">/etc/enigma2/</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="primary_icon_activatable">False</property>
</object>
<packing>

View File

@@ -583,7 +583,7 @@ Author: Dmitriy Yefremov
<property name="image">rename_image</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_ftp_edit" object="ftp_name_column_renderer" swapped="no"/>
<accelerator key="r" signal="activate" modifiers="Primary"/>
<accelerator key="r" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<accelerator key="F2" signal="activate"/>
</object>
</child>
@@ -632,7 +632,7 @@ Author: Dmitriy Yefremov
<property name="image">rename_image_2</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_file_edit" object="file_name_column_renderer" swapped="no"/>
<accelerator key="r" signal="activate" modifiers="Primary"/>
<accelerator key="r" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<accelerator key="F2" signal="activate"/>
</object>
</child>

View File

@@ -458,7 +458,7 @@ Author: Dmitriy Yefremov
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
<property name="text">0</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>
@@ -501,7 +501,7 @@ Author: Dmitriy Yefremov
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
<property name="text">0</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>
@@ -544,7 +544,7 @@ Author: Dmitriy Yefremov
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
<property name="text">0</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>
@@ -587,7 +587,7 @@ Author: Dmitriy Yefremov
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
<property name="text">0</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>
@@ -630,7 +630,7 @@ Author: Dmitriy Yefremov
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
<property name="text">1</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>
@@ -919,7 +919,7 @@ Author: Dmitriy Yefremov
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -942,7 +942,7 @@ Author: Dmitriy Yefremov
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -1042,7 +1042,7 @@ Author: Dmitriy Yefremov
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_bottom">5</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="secondary_icon_tooltip_text" translatable="yes">Link to YouTube resource.</property>
<signal name="changed" handler="on_url_changed" swapped="no"/>
</object>
@@ -1169,7 +1169,7 @@ Author: Dmitriy Yefremov
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
<property name="text">1</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>
@@ -1184,7 +1184,7 @@ Author: Dmitriy Yefremov
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
<property name="text">0</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>
@@ -1199,7 +1199,7 @@ Author: Dmitriy Yefremov
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
<property name="text">0</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>
@@ -1214,7 +1214,7 @@ Author: Dmitriy Yefremov
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
<property name="text">0</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>
@@ -1229,7 +1229,7 @@ Author: Dmitriy Yefremov
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
<property name="text">0</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>

View File

@@ -294,7 +294,6 @@ class Application(Gtk.Application):
self._filter_types_model = builder.get_object("filter_types_list_store")
self._filter_sat_positions_model = builder.get_object("filter_sat_positions_list_store")
self._filter_only_free_button = builder.get_object("filter_only_free_button")
self._filter_bar.bind_property("search-mode-enabled", self._filter_bar, "visible")
# Player
self._player_box = builder.get_object("player_box")
self._player_scale = builder.get_object("player_scale")
@@ -320,7 +319,6 @@ class Application(Gtk.Application):
self._player_frame = builder.get_object("player_frame")
# Search
self._search_bar = builder.get_object("search_bar")
self._search_bar.bind_property("search-mode-enabled", self._search_bar, "visible")
self._search_entry = builder.get_object("search_entry")
self._search_provider = SearchProvider((self._services_view, self._fav_view, self._bouquets_view),
builder.get_object("search_down_button"),
@@ -334,59 +332,6 @@ class Application(Gtk.Application):
style_provider.load_from_path(UI_RESOURCES_PATH + "style.css")
self._status_bar_box.get_style_context().add_provider_for_screen(Gdk.Screen.get_default(), style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_USER)
# Layout
if self._settings.is_darwin and self._settings.alternate_layout:
self._main_paned = builder.get_object("main_data_paned")
self._fav_paned = builder.get_object("fav_bouquets_paned")
self._fav_box = self._fav_paned.get_child1()
self._bouquets_box = self._fav_paned.get_child2()
self._left_ar_bq_button = builder.get_object("left_arrow_bq_button")
self._left_ar_bq_button.bind_property("visible", builder.get_object("right_arrow_bq_button"), "visible", 4)
self._left_ar_bq_button.set_visible(True)
self.init_layout(builder)
def init_layout(self, builder):
""" Initializes an alternate layout, if enabled. """
top_box = builder.get_object("top_box")
top_toolbar = builder.get_object("top_toolbar")
top_toolbar.set_margin_left(0)
top_toolbar.set_margin_right(10)
extra_box = builder.get_object("toolbar_extra_tools_box")
extra_box.set_margin_left(10)
extra_box.set_margin_right(0)
extra_box.reorder_child(self._ftp_button, 0)
extra_box.reorder_child(builder.get_object("add_bouquet_tool_button"), 2)
top_box.set_child_packing(extra_box, False, True, 0, Gtk.PackType.START)
top_box.set_child_packing(top_toolbar, False, True, 0, Gtk.PackType.END)
top_box.reorder_child(extra_box, 0)
top_box.reorder_child(top_toolbar, 1)
center_box = builder.get_object("center_box")
center_box.reorder_child(self._ftp_revealer, 0)
center_box.reorder_child(self._control_revealer, 1)
center_box.reorder_child(builder.get_object("main_box"), 2)
services_box = self._main_paned.get_child1()
self._main_paned.remove(services_box)
self._main_paned.remove(self._fav_paned)
self._main_paned.pack1(self._fav_paned, True, True)
self._main_paned.pack2(services_box, True, True)
self._left_ar_bq_button.set_visible(not self._settings.bq_details_first)
self.init_bq_position()
def init_bq_position(self):
self._fav_paned.remove(self._fav_box)
self._fav_paned.remove(self._bouquets_box)
if self._settings.bq_details_first:
self._fav_paned.pack1(self._fav_box, False, False)
self._fav_paned.pack2(self._bouquets_box, False, False)
else:
self._fav_paned.pack1(self._bouquets_box, False, False)
self._fav_paned.pack2(self._fav_box, False, False)
def do_startup(self):
Gtk.Application.do_startup(self)
@@ -1413,7 +1358,7 @@ class Application(Gtk.Application):
self.delete_selection(self._services_view, self._fav_view)
self.on_view_focus(self._bouquets_view)
menu.popup_at_pointer(None)
menu.popup(None, None, None, None, event.button, event.time)
return True
def on_satellite_editor_show(self, action, value=None):
@@ -2049,7 +1994,6 @@ class Application(Gtk.Application):
self._profile_combo_box.append(p, p)
def on_tree_view_key_press(self, view, event):
""" Handling keystrokes on press """
key_code = event.hardware_keycode
if not KeyboardKey.value_exist(key_code):
return
@@ -2084,7 +2028,6 @@ class Application(Gtk.Application):
self.on_delete(view)
def on_tree_view_key_release(self, view, event):
""" Handling keystrokes on release """
key_code = event.hardware_keycode
if not KeyboardKey.value_exist(key_code):
return
@@ -2953,7 +2896,7 @@ class Application(Gtk.Application):
else:
self.filter_set_default()
self._filter_bar.set_search_mode(value)
self._filter_bar.set_visible(value)
def filter_set_default(self):
""" Setting defaults for filter elements. """
@@ -3045,7 +2988,7 @@ class Application(Gtk.Application):
return True
action.set_state(value)
self._search_bar.set_search_mode(value)
self._search_bar.set_visible(value)
if value:
self._search_entry.grab_focus()
else:

File diff suppressed because it is too large Load Diff

View File

@@ -1609,7 +1609,7 @@ Author: Dmitriy Yefremov
<property name="image">filter_image</property>
<property name="always_show_image">True</property>
<signal name="toggled" handler="on_filter_toggled" swapped="no"/>
<accelerator key="f" signal="clicked" modifiers="GDK_SHIFT_MASK | Primary"/>
<accelerator key="f" signal="clicked" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>
@@ -1625,7 +1625,7 @@ Author: Dmitriy Yefremov
<property name="receives_default">True</property>
<property name="image">info_toggle_button_image</property>
<property name="always_show_image">True</property>
<accelerator key="i" signal="clicked" modifiers="Primary"/>
<accelerator key="i" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">True</property>
@@ -1656,7 +1656,7 @@ Author: Dmitriy Yefremov
<property name="image">cancel_image</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="on_cancel" swapped="no"/>
<accelerator key="z" signal="clicked" modifiers="Primary"/>
<accelerator key="z" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>

View File

@@ -296,7 +296,7 @@ Author: Dmitriy Yefremov
<property name="image">popup_menu_add_image</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_satellite_add" swapped="no"/>
<accelerator key="s" signal="activate" modifiers="Primary"/>
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
@@ -307,7 +307,7 @@ Author: Dmitriy Yefremov
<property name="image">popup_menu_add_image_2</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_transponder_add" swapped="no"/>
<accelerator key="t" signal="activate" modifiers="Primary"/>
<accelerator key="t" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
@@ -324,7 +324,7 @@ Author: Dmitriy Yefremov
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_edit" object="satellites_editor_tree_view" swapped="no"/>
<accelerator key="e" signal="activate" modifiers="Primary"/>
<accelerator key="e" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
@@ -887,7 +887,7 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="sat_name_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="secondary_icon_sensitive">False</property>
@@ -1130,7 +1130,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">12</property>
<property name="max_width_chars">10</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="secondary_icon_sensitive">False</property>
@@ -1149,7 +1149,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">12</property>
<property name="max_width_chars">10</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="placeholder_text" translatable="yes">27500000</property>
<property name="input_purpose">digits</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
@@ -1305,7 +1305,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">5</property>
<property name="max_width_chars">12</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="placeholder_text" translatable="yes">0 - 262142</property>
<property name="input_purpose">digits</property>
@@ -1322,7 +1322,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">5</property>
<property name="max_width_chars">12</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="placeholder_text" translatable="yes">0 - 255</property>
<property name="input_purpose">digits</property>
@@ -1528,7 +1528,7 @@ Author: Dmitriy Yefremov
<property name="image">sat_update_filter_image</property>
<property name="always_show_image">True</property>
<signal name="toggled" handler="on_filter_toggled" swapped="no"/>
<accelerator key="f" signal="clicked" modifiers="GDK_SHIFT_MASK | Primary"/>
<accelerator key="f" signal="clicked" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>
@@ -1546,7 +1546,7 @@ Author: Dmitriy Yefremov
<property name="image">sat_update_search_image</property>
<property name="always_show_image">True</property>
<signal name="toggled" handler="on_find_toggled" swapped="no"/>
<accelerator key="f" signal="clicked" modifiers="Primary"/>
<accelerator key="f" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>

View File

@@ -380,7 +380,6 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="name_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -402,7 +401,7 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="package_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -426,7 +425,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">10</property>
<property name="max_width_chars">10</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_non_empty_entry_changed" swapped="no"/>
<signal name="key-release-event" handler="update_reference" swapped="no"/>
</object>
@@ -471,7 +470,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">7</property>
<property name="max_width_chars">7</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_non_empty_entry_changed" swapped="no"/>
<signal name="changed" handler="update_reference" swapped="no"/>
</object>
@@ -909,7 +908,7 @@ Author: Dmitriy Yefremov
<property name="tooltip_text">C:0000,C:a1b2,etc.</property>
<property name="width_chars">15</property>
<property name="max_width_chars">26</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="placeholder_text" translatable="yes">C:0000,C:a1b2,etc.</property>
<signal name="changed" handler="on_cas_entry_changed" swapped="no"/>
</object>
@@ -1012,7 +1011,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">12</property>
<property name="max_width_chars">12</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_non_empty_entry_changed" swapped="no"/>
</object>
<packing>
@@ -1038,7 +1037,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">12</property>
<property name="max_width_chars">12</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_non_empty_entry_changed" swapped="no"/>
</object>
<packing>
@@ -1117,7 +1116,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">12</property>
<property name="max_width_chars">12</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_non_empty_entry_changed" swapped="no"/>
<signal name="key-release-event" handler="update_reference" swapped="no"/>
</object>
@@ -1155,7 +1154,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">8</property>
<property name="max_width_chars">10</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_non_empty_entry_changed" swapped="no"/>
<signal name="key-release-event" handler="update_reference" swapped="no"/>
</object>
@@ -1182,7 +1181,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">8</property>
<property name="max_width_chars">10</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_non_empty_entry_changed" swapped="no"/>
<signal name="key-release-event" handler="update_reference" swapped="no"/>
</object>
@@ -1391,7 +1390,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">8</property>
<property name="max_width_chars">10</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_digit_entry_changed" swapped="no"/>
</object>
<packing>
@@ -1417,7 +1416,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">8</property>
<property name="max_width_chars">10</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_digit_entry_changed" swapped="no"/>
</object>
<packing>
@@ -1443,7 +1442,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="width_chars">8</property>
<property name="max_width_chars">10</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<signal name="changed" handler="on_digit_entry_changed" swapped="no"/>
</object>
<packing>

View File

@@ -77,7 +77,7 @@ Author: Dmitriy Yefremov
<property name="tooltip_text" translatable="yes">Apply profile settings</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_apply_profile_settings" swapped="no"/>
<accelerator key="s" signal="clicked" modifiers="Primary"/>
<accelerator key="s" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>
@@ -367,7 +367,7 @@ Author: Dmitriy Yefremov
<property name="icon_name">emblem-default</property>
</object>
</child>
<accelerator key="d" signal="clicked" modifiers="Primary"/>
<accelerator key="d" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>
@@ -768,7 +768,7 @@ Author: Dmitriy Yefremov
</child>
<child>
<object class="GtkSpinner" id="test_spinner">
<property name="visible">True</property>
<property name="visible">False</property>
<property name="can_focus">False</property>
</object>
<packing>
@@ -948,7 +948,6 @@ Author: Dmitriy Yefremov
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text">/etc/enigma2/</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -970,7 +969,7 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="user_bouquet_field">
<property name="can_focus">True</property>
<property name="text">/etc/enigma2/</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -994,7 +993,7 @@ Author: Dmitriy Yefremov
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text">/etc/tuxbox/</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -1018,7 +1017,7 @@ Author: Dmitriy Yefremov
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text">/usr/share/enigma2/picon</property>
<property name="primary_icon_name">document-edit-symbolic</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -1073,7 +1072,7 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="picons_dir_field">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="secondary_icon_name">folder-open-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_tooltip_text" translatable="yes">Select</property>
@@ -1102,7 +1101,7 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="data_dir_field">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="secondary_icon_name">folder-open-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_tooltip_text" translatable="yes">Select</property>
@@ -1130,7 +1129,7 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="backup_dir_field">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="secondary_icon_name">folder-open-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_tooltip_text" translatable="yes">Select</property>
@@ -1266,7 +1265,7 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="default_data_dir_field">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="secondary_icon_name">folder-open-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_tooltip_text" translatable="yes">Select</property>
@@ -1328,7 +1327,7 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="record_data_dir_field">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="secondary_icon_name">folder-open-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_tooltip_text" translatable="yes">Select</property>
@@ -1549,7 +1548,7 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="video_bitrate_field">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="input_purpose">number</property>
<signal name="changed" handler="on_digit_entry_changed" swapped="no"/>
</object>
@@ -1575,7 +1574,7 @@ Author: Dmitriy Yefremov
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">
</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="input_purpose">number</property>
<signal name="changed" handler="on_digit_entry_changed" swapped="no"/>
</object>
@@ -1625,7 +1624,7 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="video_height_field">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="input_purpose">number</property>
<signal name="changed" handler="on_digit_entry_changed" swapped="no"/>
</object>
@@ -1685,7 +1684,7 @@ Author: Dmitriy Yefremov
<object class="GtkEntry" id="audio_bitrate_field">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">document-edit-symbolic</property>
<property name="input_purpose">number</property>
<signal name="changed" handler="on_digit_entry_changed" swapped="no"/>
</object>
@@ -2401,7 +2400,6 @@ Author: Dmitriy Yefremov
</child>
<child>
<object class="GtkBox" id="layout_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Enables an alternate layout of the main window elements.</property>
<child>

View File

@@ -3,7 +3,7 @@ import re
from app.commons import run_task, run_idle, log
from app.connections import test_telnet, test_ftp, TestException, test_http, HttpApiException
from app.settings import SettingsType, Settings, PlayStreamsMode
from app.settings import SettingsType, Settings, PlayStreamsMode, IS_WIN
from app.ui.dialogs import show_dialog, DialogType, get_message, get_chooser_dialog
from .main_helper import update_entry_data, scroll_to, get_picon_pixbuf
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, FavClickMode, DEFAULT_ICON
@@ -175,7 +175,7 @@ class SettingsDialog:
self.init_ui_elements(self._s_type)
self.init_profiles()
if self._settings.is_darwin:
if IS_WIN:
# Appearance
self._appearance_box = builder.get_object("appearance_box")
self._appearance_box.set_visible(True)
@@ -338,7 +338,7 @@ class SettingsDialog:
self._ext_settings.activate_transcoding = self._transcoding_switch.get_active()
self._ext_settings.active_preset = self._presets_combo_box.get_active_id()
if self._ext_settings.is_darwin:
if IS_WIN:
self._ext_settings.dark_mode = self._dark_mode_switch.get_active()
self._ext_settings.alternate_layout = self._layout_switch.get_active()
self._ext_settings.is_themes_support = self._themes_support_switch.get_active()

View File

@@ -5,7 +5,7 @@ import gi
from gi.repository import GLib
from app.commons import log
from app.settings import IS_DARWIN
from app.settings import IS_WIN
from app.connections import HttpAPI
from app.tools.yt import YouTube
from app.ui.iptv import get_yt_icon
@@ -48,7 +48,7 @@ class LinksTransmitter:
self._status_passive = None
self._yt = YouTube.get_instance(settings)
if IS_DARWIN:
if IS_WIN:
self._tray = builder.get_object("status_icon")
else:
try:

View File

@@ -1,7 +1,7 @@
import os
from enum import Enum, IntEnum
from functools import lru_cache
from app.settings import Settings, SettingsException, IS_DARWIN, IS_WIN
from app.settings import Settings, SettingsException, IS_WIN
import gi
@@ -10,7 +10,7 @@ gi.require_version("Gdk", "3.0")
from gi.repository import Gtk, Gdk, GLib
# Setting mod mask for keyboard depending on platform
MOD_MASK = Gdk.ModifierType.MOD2_MASK if IS_DARWIN else Gdk.ModifierType.CONTROL_MASK
MOD_MASK = Gdk.ModifierType.CONTROL_MASK
# Path to *.glade files
UI_RESOURCES_PATH = "app/ui/" if os.path.exists("app/ui/") else "ui/"
LANG_PATH = UI_RESOURCES_PATH + "lang"
@@ -27,35 +27,30 @@ except SettingsException:
else:
os.environ["LANGUAGE"] = settings.language
st = Gtk.Settings().get_default()
st.set_property("gtk-theme-name", "MS-Windows")
st.set_property("gtk-application-prefer-dark-theme", settings.dark_mode)
if settings.is_themes_support:
st.set_property("gtk-theme-name", settings.theme)
st.set_property("gtk-icon-theme-name", settings.icon_theme)
if IS_DARWIN or IS_WIN:
if IS_WIN:
import gettext
if GTK_PATH:
LANG_PATH = GTK_PATH + "/share/locale"
gettext.bindtextdomain(TEXT_DOMAIN, LANG_PATH)
# For launching from the bundle.
if os.getcwd() == "/" and GTK_PATH:
os.chdir(GTK_PATH)
else:
import locale
locale.bindtextdomain(TEXT_DOMAIN, LANG_PATH)
# Init notify
if IS_WIN or not IS_DARWIN:
try:
gi.require_version("Notify", "0.7")
from gi.repository import Notify
except ImportError:
pass
else:
NOTIFY_IS_INIT = Notify.init("DemonEditor")
# Init notify
try:
gi.require_version("Notify", "0.7")
from gi.repository import Notify
except ImportError:
pass
else:
NOTIFY_IS_INIT = Notify.init("DemonEditor")
theme = Gtk.IconTheme.get_default()
theme.append_search_path(GTK_PATH + "/share/icons" if GTK_PATH else UI_RESOURCES_PATH + "icons")
@@ -107,10 +102,7 @@ def show_notification(message, timeout=10000, urgency=1):
@param timeout: milliseconds
@param urgency: 0 - low, 1 - normal, 2 - critical
"""
if IS_DARWIN:
# Since NSUserNotification has been deprecated, osascript will be used.
os.system("""osascript -e 'display notification "{}" with title "DemonEditor"'""".format(message))
elif NOTIFY_IS_INIT:
if NOTIFY_IS_INIT:
notify = Notify.Notification.new("DemonEditor", message, "demon-editor")
notify.set_urgency(urgency)
notify.set_timeout(timeout)
@@ -119,35 +111,33 @@ def show_notification(message, timeout=10000, urgency=1):
class KeyboardKey(Enum):
""" The raw(hardware) codes of the keyboard keys. """
F = 3 if IS_DARWIN else 41
E = 14 if IS_DARWIN else 26
R = 15 if IS_DARWIN else 27
T = 17 if IS_DARWIN else 28
P = 35 if IS_DARWIN else 33
S = 1 if IS_DARWIN else 39
H = 4 if IS_DARWIN else 43
L = 37 if IS_DARWIN else 46
X = 7 if IS_DARWIN else 53
C = 8 if IS_DARWIN else 54
V = 9 if IS_DARWIN else 55
W = 13 if IS_DARWIN else 25
Z = 6 if IS_DARWIN else 52
INSERT = -1 if IS_DARWIN else 118
HOME = -1 if IS_DARWIN else 110
END = -1 if IS_DARWIN else 115
UP = 126 if IS_DARWIN else 111
DOWN = 125 if IS_DARWIN else 116
PAGE_UP = -1 if IS_DARWIN else 112
PAGE_DOWN = -1 if IS_DARWIN else 117
LEFT = 123 if IS_DARWIN else 113
RIGHT = 123 if IS_DARWIN else 114
F2 = 120 if IS_DARWIN else 68
F7 = 98 if IS_DARWIN else 73
SPACE = 49 if IS_DARWIN else 65
DELETE = 51 if IS_DARWIN else 119
BACK_SPACE = 76 if IS_DARWIN else 22
CTRL_L = 55 if IS_DARWIN else 37
CTRL_R = 55 if IS_DARWIN else 105
E = 26
R = 27
T = 28
P = 33
S = 39
F = 41
X = 53
C = 54
V = 55
W = 25
Z = 52
INSERT = 118
HOME = 110
END = 115
UP = 111
DOWN = 116
PAGE_UP = 112
PAGE_DOWN = 117
LEFT = 113
RIGHT = 114
F2 = 68
F7 = 73
SPACE = 65
DELETE = 119
BACK_SPACE = 22
CTRL_L = 37
CTRL_R = 105
# Laptop codes
HOME_KP = 79
END_KP = 87

BIN
icon.icns

Binary file not shown.

BIN
icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB