kuuko pushed a commit to branch master.

http://git.enlightenment.org/apps/epour.git/commit/?id=fa3366552fac653d80ddfb48384b8c77cc3e0de0

commit fa3366552fac653d80ddfb48384b8c77cc3e0de0
Author: Kai Huuhko <kai.huu...@gmail.com>
Date:   Fri Aug 26 22:12:05 2016 +0300

    Use DialogWindow instead of StandardWindow for child windows
---
 epour/gui/TorrentProps.py    | 21 +++++++++++----------
 epour/gui/TorrentSelector.py | 17 ++++++-----------
 epour/gui/__init__.py        |  4 ++--
 3 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/epour/gui/TorrentProps.py b/epour/gui/TorrentProps.py
index c1fc757..f62cd6e 100644
--- a/epour/gui/TorrentProps.py
+++ b/epour/gui/TorrentProps.py
@@ -1,7 +1,7 @@
 #
 #  Epour - A bittorrent client using EFL and libtorrent
 #
-#  Copyright 2012-2014 Kai Huuhko <kai.huu...@gmail.com>
+#  Copyright 2012-2016 Kai Huuhko <kai.huu...@gmail.com>
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ from efl import ecore
 from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
 from efl.elementary.genlist import Genlist, GenlistItemClass, \
     ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_TREE, ELM_GENLIST_ITEM_FIELD_TEXT
-from efl.elementary.window import StandardWindow
+from efl.elementary.window import DialogWindow
 from efl.elementary.button import Button
 from efl.elementary.box import Box
 from efl.elementary.check import Check
@@ -117,15 +117,15 @@ def attach(branch, file_entry, n, trunk):
         attach(others, file_entry, n, trunk[node])
 
 
-class TorrentProps(StandardWindow):
+class TorrentProps(DialogWindow):
 
-    def __init__(self, h):
+    def __init__(self, parent_win, h):
         if not h.is_valid():
             Information(self, _("Invalid torrent handle."))
             return
 
-        StandardWindow.__init__(
-            self, "epour", "Epour - %s" % (h.name()),
+        DialogWindow.__init__(
+            self, parent_win, "epour", "Epour - %s" % (h.name()),
             size=(SCALE * 480, SCALE * 320),
             autodel=True
             )
@@ -201,10 +201,11 @@ class TorrentProps(StandardWindow):
         scroller.show()
 
 
-class TorrentFiles(StandardWindow):
-    def __init__(self, h):
-        StandardWindow.__init__(
+class TorrentFiles(DialogWindow):
+    def __init__(self, parent_win, h):
+        DialogWindow.__init__(
             self,
+            parent_win,
             "epour",
             _("Epour - Files for torrent: %s") % (h.name()),
             size=(SCALE * 480, SCALE * 320),
@@ -402,7 +403,7 @@ class TorrentInfo(Box):
 
         fl_btn = Button(self, size_hint_align=ALIGN_LEFT)
         fl_btn.text = "Files ->"
-        fl_btn.callback_clicked_add(lambda x: TorrentFiles(h))
+        fl_btn.callback_clicked_add(lambda x: TorrentFiles(self.top_widget, h))
 
         self.pack_end(table)
         self.pack_end(tpriv)
diff --git a/epour/gui/TorrentSelector.py b/epour/gui/TorrentSelector.py
index 59c1dab..c55c3bf 100644
--- a/epour/gui/TorrentSelector.py
+++ b/epour/gui/TorrentSelector.py
@@ -26,8 +26,7 @@ from libtorrent import add_torrent_params_flags_t
 
 from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
 from efl import elementary as elm
-from efl.elementary import StandardWindow, Window, ELM_WIN_DIALOG_BASIC
-from efl.elementary import Background
+from efl.elementary import DialogWindow
 from efl.elementary import Button
 from efl.elementary import Box
 from efl.elementary import Frame
@@ -55,7 +54,7 @@ scale = elm_conf.scale
 log = logging.getLogger("epour.gui")
 
 
-class TorrentSelector(StandardWindow):
+class TorrentSelector(DialogWindow):
 
     names = {
         1: _("Seed Mode"),
@@ -138,8 +137,8 @@ seed, this flag has no effect.'''
     }
 
     def __init__(self, parent, session, t_uri=None):
-        StandardWindow.__init__(
-            self, "addtorrent", _("Add Torrent"),
+        DialogWindow.__init__(
+            self, parent, "addtorrent", _("Add Torrent"),
             size=(scale * 400, scale * 400), autodel=True
             )
 
@@ -336,18 +335,14 @@ class FsEntry(Fileselector, FileselectorEntry):
         FileselectorEntry.__init__(self, parent, **kwargs)
 
 
-class TorrentFs(Window):
+class TorrentFs(DialogWindow):
 
     def __init__(self, parent, uri_entry):
 
         super(TorrentFs, self).__init__(
-            "torrentselect", ELM_WIN_DIALOG_BASIC, parent, size=(500, 500),
+            parent, "torrentselect", "Select Torrent", size=(500, 500),
             autodel=True)
 
-        bg = Background(self, size_hint_weight=EXPAND_BOTH)
-        self.resize_object_add(bg)
-        bg.show()
-
         fs = Fileselector(
             self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
             expandable=False, is_save=False, path=os.path.expanduser("~")
diff --git a/epour/gui/__init__.py b/epour/gui/__init__.py
index 277d776..2293f3b 100644
--- a/epour/gui/__init__.py
+++ b/epour/gui/__init__.py
@@ -606,7 +606,7 @@ class ItemMenu(Menu):
 
         def files_cb(menu, it, h):
             from .TorrentProps import TorrentFiles
-            TorrentFiles(h)
+            TorrentFiles(self.top_widget, h)
         self.item_add(
             it, "Files", None,
             files_cb, h)
@@ -631,7 +631,7 @@ class ItemMenu(Menu):
     def torrent_props_cb(self, menu, item, h):
         menu.close()
         from .TorrentProps import TorrentProps
-        TorrentProps(h).show()
+        TorrentProps(self.top_widget, h).show()
 
 
 class TorrentTooltip(Table):

-- 


Reply via email to