Disable Deck View option and json export.
This commit is contained in:
@@ -42,7 +42,6 @@ class Application:
|
|||||||
self.pages = {
|
self.pages = {
|
||||||
"search": self.ui.get_object("searchView"),
|
"search": self.ui.get_object("searchView"),
|
||||||
"library": self.ui.get_object("libraryView"),
|
"library": self.ui.get_object("libraryView"),
|
||||||
"decks": not_found,
|
|
||||||
"wants": self.ui.get_object("wantsView")
|
"wants": self.ui.get_object("wantsView")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,132 @@
|
|||||||
<!-- Generated with glade 3.20.0 -->
|
<!-- Generated with glade 3.20.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.20"/>
|
<requires lib="gtk+" version="3.20"/>
|
||||||
|
<object class="GtkTreeStore" id="export_treestore">
|
||||||
|
<columns>
|
||||||
|
<!-- column-name check -->
|
||||||
|
<column type="gboolean"/>
|
||||||
|
<!-- column-name visible -->
|
||||||
|
<column type="gboolean"/>
|
||||||
|
<!-- column-name element -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
</columns>
|
||||||
|
</object>
|
||||||
|
<object class="GtkDialog" id="export_dialog">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="title" translatable="yes">Export Data</property>
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<property name="default_width">320</property>
|
||||||
|
<property name="default_height">260</property>
|
||||||
|
<property name="type_hint">dialog</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkButtonBox">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="layout_style">end</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="export_ok">
|
||||||
|
<property name="label">gtk-ok</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="export_cancel">
|
||||||
|
<property name="label">gtk-cancel</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label" translatable="yes">Choose what to export</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeView" id="export_sel_tree">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="model">export_treestore</property>
|
||||||
|
<property name="headers_clickable">False</property>
|
||||||
|
<property name="enable_search">False</property>
|
||||||
|
<child internal-child="selection">
|
||||||
|
<object class="GtkTreeSelection"/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="export_col_check">
|
||||||
|
<property name="min_width">30</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererToggle">
|
||||||
|
<signal name="toggled" handler="export_cell_toggled" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="visible">1</attribute>
|
||||||
|
<attribute name="active">0</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="export_col_element">
|
||||||
|
<property name="title" translatable="yes">Element</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">2</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<action-widgets>
|
||||||
|
<action-widget response="-5">export_ok</action-widget>
|
||||||
|
<action-widget response="-6">export_cancel</action-widget>
|
||||||
|
</action-widgets>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
<object class="GtkDialog" id="loadDataDialog">
|
<object class="GtkDialog" id="loadDataDialog">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="title" translatable="yes">Download</property>
|
<property name="title" translatable="yes">Download</property>
|
||||||
@@ -314,12 +440,6 @@
|
|||||||
<property name="top_attach">1</property>
|
<property name="top_attach">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
@@ -360,24 +480,12 @@
|
|||||||
<property name="width">2</property>
|
<property name="width">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">0</property>
|
<property name="top_attach">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.20.0 -->
|
<!-- Generated with glade 3.20.1 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.20"/>
|
<requires lib="gtk+" version="3.20"/>
|
||||||
<object class="GtkWindow" id="mainWindow">
|
<object class="GtkWindow" id="mainWindow">
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Export Library Data</property>
|
<property name="label" translatable="yes">Export Library Data</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="activate" handler="do_export_json" swapped="no"/>
|
<signal name="activate" handler="do_export_library" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -174,20 +174,6 @@
|
|||||||
<accelerator key="2" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
<accelerator key="2" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkRadioMenuItem" id="decksViewItem">
|
|
||||||
<property name="name">decks</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="label" translatable="yes">Decks</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="draw_as_radio">True</property>
|
|
||||||
<property name="group">searchViewItem</property>
|
|
||||||
<signal name="activate" handler="on_view_changed" swapped="no"/>
|
|
||||||
<accelerator key="3" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioMenuItem" id="wantsViewItem">
|
<object class="GtkRadioMenuItem" id="wantsViewItem">
|
||||||
<property name="name">wants</property>
|
<property name="name">wants</property>
|
||||||
@@ -198,7 +184,7 @@
|
|||||||
<property name="draw_as_radio">True</property>
|
<property name="draw_as_radio">True</property>
|
||||||
<property name="group">searchViewItem</property>
|
<property name="group">searchViewItem</property>
|
||||||
<signal name="activate" handler="on_view_changed" swapped="no"/>
|
<signal name="activate" handler="on_view_changed" swapped="no"/>
|
||||||
<accelerator key="4" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
<accelerator key="3" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -51,14 +51,49 @@ class Handlers(SearchHandlers, LibraryHandlers, WantsHandlers):
|
|||||||
|
|
||||||
dialog.destroy()
|
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):
|
def do_export_json(self, item):
|
||||||
"""
|
"""
|
||||||
Export user data to file
|
Export user data to file
|
||||||
Called By: Export menu item
|
Called By: Export menu item
|
||||||
"""
|
"""
|
||||||
response = self.app.show_dialog_yn("Temoprary Dialog", "[Choose data to export here]")
|
# dialog = self.app.ui.get_object("export_dialog")
|
||||||
if response == Gtk.ResponseType.NO:
|
# dialog.set_transient_for(self.app.ui.get_object("mainWindow"))
|
||||||
return
|
#
|
||||||
|
# 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"),
|
dialog = Gtk.FileChooserDialog("Export Library", self.app.ui.get_object("mainWindow"),
|
||||||
Gtk.FileChooserAction.SAVE,
|
Gtk.FileChooserAction.SAVE,
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import gi
|
|
||||||
import time
|
import time
|
||||||
gi.require_version('Gtk', '3.0')
|
|
||||||
from gi.repository import Gtk
|
|
||||||
from urllib.error import URLError, HTTPError
|
from urllib.error import URLError, HTTPError
|
||||||
from mtgsdk import Card
|
from mtgsdk import Card
|
||||||
from cardvault import application, cardlist, util
|
from cardvault import application, cardlist, util
|
||||||
|
|
||||||
|
import gi
|
||||||
|
gi.require_version('Gtk', '3.0')
|
||||||
|
from gi.repository import Gtk
|
||||||
|
|
||||||
|
|
||||||
class SearchHandlers:
|
class SearchHandlers:
|
||||||
def __init__(self, app: 'application.Application'):
|
def __init__(self, app: 'application.Application'):
|
||||||
|
|||||||
Reference in New Issue
Block a user