From d7bc225df3b95503bcaf62f7937d5d11de60bb69 Mon Sep 17 00:00:00 2001 From: luxick Date: Thu, 19 Oct 2017 13:27:16 +0200 Subject: [PATCH] Disable Deck View option and json export. --- cardvault/application.py | 1 - cardvault/gui/dialogs.glade | 144 ++++++++++++++++++++++++++++----- cardvault/gui/mainwindow.glade | 20 +---- cardvault/handlers.py | 41 +++++++++- cardvault/search.py | 7 +- 5 files changed, 171 insertions(+), 42 deletions(-) diff --git a/cardvault/application.py b/cardvault/application.py index 9f7b6e7..4989333 100644 --- a/cardvault/application.py +++ b/cardvault/application.py @@ -42,7 +42,6 @@ class Application: self.pages = { "search": self.ui.get_object("searchView"), "library": self.ui.get_object("libraryView"), - "decks": not_found, "wants": self.ui.get_object("wantsView") } diff --git a/cardvault/gui/dialogs.glade b/cardvault/gui/dialogs.glade index 5d3cfa8..ddc6573 100644 --- a/cardvault/gui/dialogs.glade +++ b/cardvault/gui/dialogs.glade @@ -2,6 +2,132 @@ + + + + + + + + + + + + False + Export Data + True + 320 + 260 + dialog + + + False + vertical + 4 + + + False + end + + + gtk-ok + True + True + True + True + + + True + True + 0 + + + + + gtk-cancel + True + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + True + False + start + Choose what to export + + + False + True + 1 + + + + + True + True + export_treestore + False + False + + + + + + 30 + + + + + + 1 + 0 + + + + + + + Element + + + + 2 + + + + + + + True + True + 2 + + + + + + export_ok + export_cancel + + + + + False Download @@ -314,12 +440,6 @@ 1 - - - - - - 0 @@ -360,24 +480,12 @@ 2 - - - - - - 1 0 - - - - - - True diff --git a/cardvault/gui/mainwindow.glade b/cardvault/gui/mainwindow.glade index 7226968..024659a 100644 --- a/cardvault/gui/mainwindow.glade +++ b/cardvault/gui/mainwindow.glade @@ -1,5 +1,5 @@ - + @@ -57,7 +57,7 @@ False Export Library Data True - + @@ -174,20 +174,6 @@ - - - decks - True - False - False - Decks - True - True - searchViewItem - - - - wants @@ -198,7 +184,7 @@ True searchViewItem - + diff --git a/cardvault/handlers.py b/cardvault/handlers.py index e0e715d..8ffe612 100644 --- a/cardvault/handlers.py +++ b/cardvault/handlers.py @@ -51,14 +51,49 @@ class Handlers(SearchHandlers, LibraryHandlers, WantsHandlers): dialog.destroy() + def export_cell_toggled(self, widget, pos): + model = self.app.ui.get_object("export_treestore") + iter = model.get_iter(pos) + model.set_value(iter, 0, not widget.get_active()) + + if len(pos.split(":")) > 1: + # A child node has been clicked + pass + def do_export_json(self, item): """ Export user data to file Called By: Export menu item """ - response = self.app.show_dialog_yn("Temoprary Dialog", "[Choose data to export here]") - if response == Gtk.ResponseType.NO: - return + # dialog = self.app.ui.get_object("export_dialog") + # dialog.set_transient_for(self.app.ui.get_object("mainWindow")) + # + # store = self.app.ui.get_object("export_treestore") # type: Gtk.TreeStore + # store.clear() + # store.append(None, [True, False, "Library"]) + # store.append(None, [True, False, "Decks"]) + # store.append(None, [True, False, "Wants Lists"]) + # + # lib_iter = store.get_iter_first() + # deck_iter = store.iter_next(lib_iter) + # wants_iter = store.iter_next(deck_iter) + # + # store.append(lib_iter, [True, True, "Untagged Cards"]) + # for tag in self.app.tags.keys(): + # store.append(lib_iter, [True, True, tag]) + # + # for name in self.app.wants.keys(): + # store.append(wants_iter, [True, True, name]) + # + # self.app.ui.get_object("export_sel_tree").expand_all() + # + # response = dialog.run() + # dialog.hide() + # + # if not response == Gtk.ResponseType.OK: + # return + + # TODO Read treemodel to select witch parts to export dialog = Gtk.FileChooserDialog("Export Library", self.app.ui.get_object("mainWindow"), Gtk.FileChooserAction.SAVE, diff --git a/cardvault/search.py b/cardvault/search.py index aaf75b6..4830eb5 100644 --- a/cardvault/search.py +++ b/cardvault/search.py @@ -1,11 +1,12 @@ -import gi import time -gi.require_version('Gtk', '3.0') -from gi.repository import Gtk from urllib.error import URLError, HTTPError from mtgsdk import Card from cardvault import application, cardlist, util +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk + class SearchHandlers: def __init__(self, app: 'application.Application'):