diff --git a/app/ui/dialogs.glade b/app/ui/dialogs.glade
index df7d4672..baf6a734 100644
--- a/app/ui/dialogs.glade
+++ b/app/ui/dialogs.glade
@@ -1234,7 +1234,7 @@ dmitry.v.yefremov@gmail.com
True
/data/picons
folder-open-symbolic
- False
+
False
diff --git a/app/ui/download_dialog.py b/app/ui/download_dialog.py
index 3d07e7c3..0574a4bd 100644
--- a/app/ui/download_dialog.py
+++ b/app/ui/download_dialog.py
@@ -60,7 +60,7 @@ class DownloadDialog:
def destroy(self):
self._dialog.destroy()
- def on_info_bar_close(self, *args):
+ def on_info_bar_close(self, bar=None, resp=None):
self._info_bar.set_visible(False)
@run_idle
diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py
index 7d3f277e..56bcdfb2 100644
--- a/app/ui/main_app_window.py
+++ b/app/ui/main_app_window.py
@@ -450,7 +450,7 @@ class MainAppWindow:
def on_data_open(self, model):
response = show_dialog(DialogType.CHOOSER, self.__main_window, options=self.__options.get(self.__profile))
- if response == Gtk.ResponseType.CANCEL:
+ if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT):
return
self.open_data(response)
diff --git a/app/ui/main_helper.py b/app/ui/main_helper.py
index f3ec9085..dde44011 100644
--- a/app/ui/main_helper.py
+++ b/app/ui/main_helper.py
@@ -272,5 +272,16 @@ def scroll_to(index, view, paths=None):
selection.select_path(index)
+# ***************** Others *********************#
+
+def update_entry_data(entry, dialog, options):
+ """ Updates value in text entry from chooser dialog """
+ response = show_dialog(dialog_type=DialogType.CHOOSER, transient=dialog, options=options)
+ if response not in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT):
+ entry.set_text(response)
+ return response
+ return False
+
+
if __name__ == "__main__":
pass
diff --git a/app/ui/picons_dialog.glade b/app/ui/picons_dialog.glade
index 329867fe..018eda67 100644
--- a/app/ui/picons_dialog.glade
+++ b/app/ui/picons_dialog.glade
@@ -3,6 +3,7 @@
True
diff --git a/app/ui/picons_dialog.py b/app/ui/picons_dialog.py
index b57ec99a..e4885117 100644
--- a/app/ui/picons_dialog.py
+++ b/app/ui/picons_dialog.py
@@ -1,10 +1,10 @@
-import subprocess
import time
from gi.repository import GLib
from app.commons import run_idle, run_task
from . import Gtk, UI_RESOURCES_PATH
+from .main_helper import update_entry_data
class PiconsDialog:
@@ -15,7 +15,9 @@ class PiconsDialog:
handlers = {"on_receive": self.on_receive,
"on_cancel": self.on_cancel,
"on_close": self.on_close,
- "on_send": self.on_send}
+ "on_send": self.on_send,
+ "on_info_bar_close": self.on_info_bar_close,
+ "on_picons_dir_open": self.on_picons_dir_open}
builder = Gtk.Builder()
builder.add_objects_from_file(UI_RESOURCES_PATH + "picons_dialog.glade", ("picons_dialog", "receive_image"))
@@ -29,6 +31,9 @@ class PiconsDialog:
self._picons_entry = builder.get_object("picons_entry")
self._url_entry = builder.get_object("url_entry")
self._picons_dir_entry = builder.get_object("picons_dir_entry")
+ self._info_bar = builder.get_object("info_bar")
+ self._info_bar = builder.get_object("info_bar")
+ self._message_label = builder.get_object("info_bar_message_label")
self._ip_entry.set_text(options.get("host", ""))
self._picons_entry.set_text(options.get("picons_path", ""))
@@ -38,19 +43,34 @@ class PiconsDialog:
self._dialog.run()
self._dialog.destroy()
+ @run_idle
def on_receive(self, item):
- self._current_process = subprocess.Popen("ls", stdout=subprocess.PIPE)
- GLib.io_add_watch(self._current_process.stdout, GLib.IO_IN, self.write_to_buffer)
+ self.start_download()
+ def start_download(self):
+ self._expander.set_expanded(True)
+ self.show_info_message("Please, wait...", Gtk.MessageType.INFO)
+ # self._current_process = subprocess.Popen("ls",
+ # stdout=subprocess.PIPE,
+ # stderr=subprocess.PIPE,
+ # universal_newlines=True)
+ # GLib.io_add_watch(self._current_process.stderr, GLib.IO_IN, self.write_to_buffer)
+
+ @run_idle
def write_to_buffer(self, fd, condition):
if condition == GLib.IO_IN:
char = fd.read(1)
buf = self._text_view.get_buffer()
- buf.insert_at_cursor(str(char))
+ buf.insert_at_cursor(char)
+ self.scroll_to_end(buf)
return True
else:
return False
+ def scroll_to_end(self, buf):
+ insert = buf.get_insert()
+ self._text_view.scroll_to_mark(insert, 0.0, True, 0.0, 1.0)
+
@run_task
def on_cancel(self, item):
if self._current_process:
@@ -65,6 +85,18 @@ class PiconsDialog:
def on_send(self, item):
pass
+ def on_info_bar_close(self, bar=None, resp=None):
+ self._info_bar.set_visible(False)
+
+ @run_idle
+ def show_info_message(self, text, message_type):
+ self._info_bar.set_visible(True)
+ self._info_bar.set_message_type(message_type)
+ self._message_label.set_text(text)
+
+ def on_picons_dir_open(self, entry, icon, event_button):
+ update_entry_data(entry, self._dialog, options={"data_dir_path": self._picons_path})
+
if __name__ == "__main__":
pass
diff --git a/app/ui/settings_dialog.py b/app/ui/settings_dialog.py
index 8bf43db3..2ba33f99 100644
--- a/app/ui/settings_dialog.py
+++ b/app/ui/settings_dialog.py
@@ -1,6 +1,6 @@
from app.properties import write_config, Profile, get_default_settings
-from app.ui.dialogs import show_dialog, DialogType
from . import Gtk, UI_RESOURCES_PATH
+from .main_helper import update_entry_data
def show_settings_dialog(transient, options):
@@ -10,6 +10,7 @@ def show_settings_dialog(transient, options):
class SettingsDialog:
def __init__(self, transient, options):
handlers = {"on_data_dir_field_icon_press": self.on_data_dir_field_icon_press,
+ "on_picons_dir_field_icon_press": self.on_picons_dir_field_icon_press,
"on_profile_changed": self.on_profile_changed,
"on_reset": self.on_reset,
"apply_settings": self.apply_settings}
@@ -53,10 +54,10 @@ class SettingsDialog:
return response
def on_data_dir_field_icon_press(self, entry, icon, event_button):
- response = show_dialog(dialog_type=DialogType.CHOOSER,
- transient=self._dialog, options=self._options.get(self._options.get("profile")))
- if response != Gtk.ResponseType.CANCEL:
- entry.set_text(response)
+ update_entry_data(entry, self._dialog, self._options.get(self._options.get("profile")))
+
+ def on_picons_dir_field_icon_press(self, entry, icon, event_button):
+ update_entry_data(entry, self._dialog, self._options.get(self._options.get("profile")))
def on_profile_changed(self, item):
self.set_profile(Profile.ENIGMA_2 if self._enigma_radio_button.get_active() else Profile.NEUTRINO_MP)
diff --git a/build-deb.sh b/build-deb.sh
index 5aa8295b..452c07f4 100644
--- a/build-deb.sh
+++ b/build-deb.sh
@@ -1,5 +1,5 @@
#!/bin/env bash
-VER="0.2.0_Pre-alpha"
+VER="0.2.1_Pre-alpha"
B_PATH="dist/DemonEditor"
DEB_PATH="$B_PATH/usr/share/demoneditor"