From 20707dd59bc219b6c3a7ffa06daeaea023edd0a0 Mon Sep 17 00:00:00 2001 From: laharah Date: Sat, 19 Jan 2019 12:51:11 -0800 Subject: [PATCH] Implemented Debug info button in preferences --- README.md | 2 +- filebottool/core.py | 13 ++++ filebottool/data/config.glade | 101 ++++++++++++++++++---------- filebottool/gtkui/config_ui.py | 19 +++++- filebottool/gtkui/user_messenger.py | 24 ++++++- setup.py | 2 +- 6 files changed, 121 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 68d547b..3795a3f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # FilebotTool: FileBot Integration for Deluge *requires [Filebot](http://www.filebot.net/)* -**Version 1.2.0** +**Version 1.2.1** ##### [Download Latest Release](https://github.com/Laharah/deluge-FilebotTool/releases/latest) diff --git a/filebottool/core.py b/filebottool/core.py index b043328..2c31630 100755 --- a/filebottool/core.py +++ b/filebottool/core.py @@ -881,3 +881,16 @@ def get_config(self): """Returns the config dictionary""" log.debug("Sending Config") return self.config.config + + @export + @defer.inlineCallbacks + def get_filebot_debug(self): + """Returns the FileBot debug info.""" + log.debug("Received request for FileBot debug info...") + try: + info = yield threads.deferToThread(pyfilebot.debug_info) + except Exception, err: + log.error("FILEBOT ERROR: {0}".format(str(err)), exc_info=True) + defer.returnValue('ERROR COMMUNICATING WITH FILEBOT!\n' + str(err)) + log.debug("FileBot debug info retrieved.") + defer.returnValue(info) diff --git a/filebottool/data/config.glade b/filebottool/data/config.glade index 35cdf2c..de45c87 100755 --- a/filebottool/data/config.glade +++ b/filebottool/data/config.glade @@ -1,26 +1,23 @@ - + - False Hellow World center True - False Edit selected profile queue none True - False + vertical True - False Saved profiles are used in auto-execute rules, and call also be used in the rename dialog. 0 Saved Profiles: @@ -35,17 +32,14 @@ True - False 10 True - False 5 True - False True @@ -56,15 +50,12 @@ - True - True 0 True - False center @@ -73,7 +64,7 @@ True True Add a new profile - + False @@ -87,7 +78,7 @@ True True True - + False @@ -102,7 +93,7 @@ True True Remove selected profile. - + False @@ -121,20 +112,16 @@ - True - True 1 True - False 3 True - False On torrent completion. Executes the first rule that matches. 0 Auto Execute Rules: @@ -149,13 +136,11 @@ True - False False - + True - False On torrent completion. Executes the first rule that matches. 0 <span color="blue"><u>help?</u></span> @@ -179,13 +164,11 @@ True - False 10 5 True - False True @@ -197,15 +180,13 @@ - True - True 0 True - False + vertical True @@ -214,11 +195,10 @@ True True Higher rules will be tried first. - + False - True 0 @@ -229,11 +209,10 @@ True True Add a new rule - + False - True 1 @@ -244,11 +223,10 @@ True True Remove selected rule. - + False - True 2 @@ -259,11 +237,10 @@ True True Lower Rules will be tried if upper rules do not match. - + False - True 3 @@ -276,11 +253,63 @@ - True - True 3 + + + True + start + + + True + True + True + True + Show system and enviornment info from FileBot. + 1 + 0 + + + + True + + + True + gtk-info + + + False + False + 2 + 0 + + + + + True + Debug Info + + + False + False + 1 + + + + + + + False + False + 0 + + + + + 4 + + diff --git a/filebottool/gtkui/config_ui.py b/filebottool/gtkui/config_ui.py index c7a699e..1330d36 100644 --- a/filebottool/gtkui/config_ui.py +++ b/filebottool/gtkui/config_ui.py @@ -5,6 +5,9 @@ import time import webbrowser +from twisted.internet import defer + +from deluge.ui.client import client import deluge.component as component from filebottool.common import get_resource @@ -13,6 +16,8 @@ from filebottool.gtkui.handler_editor import HandlerEditor import filebottool.auto_sort +import user_messenger + SORT_OPERATORS = filebottool.auto_sort.OPERATOR_MAP.keys() VALID_FIELDS = filebottool.auto_sort.VALID_FIELDS @@ -70,6 +75,7 @@ def text_edited(widget, path, text): "on_remove_rule": self.rules_list.remove, "on_add_rule": self.on_add_rule, "on_auto_sort_help_clicked": self.on_auto_sort_help_clicked, + "on_debug_button_clicked": self.on_debug_button_clicked, }) self.gather_time = None if settings: @@ -167,6 +173,17 @@ def on_auto_sort_help_clicked(self, *args): webbrowser.open('https://github.com/Laharah/deluge-FileBotTool/wiki/Auto-Sorting', new=2) + @defer.inlineCallbacks + def on_debug_button_clicked(self, button): + log.debug("Sending request for FileBot debug info...") + button.set_sensitive(False) + info = yield client.filebottool.get_filebot_debug() + log.debug("Displaying debug info") + dialog = user_messenger.UserMessenger() + dialog.display_text("Filebot Debug Info", info) + button.set_sensitive(True) + + ######### # Section: Utilities ######### @@ -187,4 +204,4 @@ def build_combo_cellrenderer(model, cb): renderer.set_property("editable", True) renderer.set_property("text-column", 0) renderer.connect("edited", cb) - return renderer \ No newline at end of file + return renderer diff --git a/filebottool/gtkui/user_messenger.py b/filebottool/gtkui/user_messenger.py index e11ba19..c784c2d 100644 --- a/filebottool/gtkui/user_messenger.py +++ b/filebottool/gtkui/user_messenger.py @@ -100,7 +100,8 @@ def show_new_files(self, files): dialog.run_async() return - def display_errors(self, errors, + def display_errors(self, + errors, title=None, message=None, parent=None, @@ -164,6 +165,27 @@ def _show_details(_): dialog.run_async() return + def display_text(self, title, text, parent=None, modal=False): + dialog = InfoDialog(title, None, parent, modal) + text_view = gtk.TextView() + text_view.get_buffer().set_text(text) + text_view.set_editable(False) + text_view.set_cursor_visible(False) + text_view.show() + sw = gtk.ScrolledWindow() + sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + sw.show() + sw.add(text_view) + detail_view = gtk.Frame() + detail_view.set_shadow_type(gtk.SHADOW_IN) + detail_view.add(sw) + detail_view.set_border_width(6) + dialog.vbox.add(detail_view) + detail_view.show() + text_view.set_size_request(485, 300) + dialog.run_async() + return + def format_errors(errors): """ diff --git a/setup.py b/setup.py index 9daa13e..8dea4fa 100755 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ __plugin_name__ = "FileBotTool" __author__ = "laharah" __author_email__ = "laharah+fbt@gmail.com" -__version__ = "1.2.0" +__version__ = "1.2.1" __url__ = "https://github.com/Laharah/deluge-FileBotTool" __license__ = "GPLv3" __description__ = "Integrates FileBot functionality to Deluge"