Add card view to search page.
This commit is contained in:
@@ -18,6 +18,8 @@ class EngineConfig:
|
|||||||
db_file = 'cardvault.db'
|
db_file = 'cardvault.db'
|
||||||
# Default path to store temporary files
|
# Default path to store temporary files
|
||||||
cache_path = os.path.join(os.path.expanduser('~'), '.cache', 'cardvault')
|
cache_path = os.path.join(os.path.expanduser('~'), '.cache', 'cardvault')
|
||||||
|
# Icon cache path
|
||||||
|
icon_cache_path = os.path.join(os.path.expanduser('~'), '.cache', 'cardvault', 'icons')
|
||||||
|
|
||||||
|
|
||||||
class EngineConstants:
|
class EngineConstants:
|
||||||
|
|||||||
96
cv_gtk3/card_view.py
Normal file
96
cv_gtk3/card_view.py
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
import gi
|
||||||
|
gi.require_version('Gtk', '3.0')
|
||||||
|
from gi.repository import Gtk
|
||||||
|
|
||||||
|
from cv_gtk3.gtk_util import GTKUtilities
|
||||||
|
from cv_engine.util import MTGConstants
|
||||||
|
|
||||||
|
|
||||||
|
class CardView(Gtk.ScrolledWindow):
|
||||||
|
""" Class for displaying a list of cards in an GTKTreeView """
|
||||||
|
def __init__(self, ui_file, filtered):
|
||||||
|
""" Constructor for a card list display
|
||||||
|
:param ui_file: Full path to an CardView glade file
|
||||||
|
:param filtered: Should the card list be filterable
|
||||||
|
"""
|
||||||
|
self.filtered = filtered
|
||||||
|
self.cards = []
|
||||||
|
# Call constructor of superclass
|
||||||
|
super(CardView, self).__init__()
|
||||||
|
self.set_hexpand(True)
|
||||||
|
self.set_vexpand(True)
|
||||||
|
# Build UI
|
||||||
|
self.ui = Gtk.Builder()
|
||||||
|
self.ui.add_from_file(ui_file)
|
||||||
|
self.tree = self.ui.get_object('cardTree')
|
||||||
|
self.store = self.ui.get_object('cardStore')
|
||||||
|
self.store.set_sort_func(4, self.compare_rarity, None)
|
||||||
|
# Add the TreeView
|
||||||
|
self.add(self.tree)
|
||||||
|
|
||||||
|
def get_selected_cards(self):
|
||||||
|
""" Get the currently selected cards in the TreeView
|
||||||
|
:return: List od card objects
|
||||||
|
"""
|
||||||
|
(model, path_list) = self.ui.get_object("cardTree").get_selection().get_selected_rows()
|
||||||
|
selected_ids = []
|
||||||
|
for path in path_list:
|
||||||
|
tree_iter = model.get_iter(path)
|
||||||
|
selected_ids.append(model.get_value(tree_iter, 0))
|
||||||
|
return [card for card in self.cards if card.multiverse_id in selected_ids]
|
||||||
|
|
||||||
|
def update(self, card_list):
|
||||||
|
""" Update the card view with a new list of cards
|
||||||
|
:param card_list:
|
||||||
|
"""
|
||||||
|
self.cards = card_list
|
||||||
|
self.ui.get_object("cardStore").clear()
|
||||||
|
# Disable update if tree is filtered (performance)
|
||||||
|
if self.filtered:
|
||||||
|
self.tree.freeze_child_notify()
|
||||||
|
# Fill list with new cards
|
||||||
|
for card in card_list:
|
||||||
|
if card.multiverse_id is None: continue
|
||||||
|
# TODO load row color base on card status (owned, wanted,...)
|
||||||
|
color = 'black'
|
||||||
|
mana_cost = None
|
||||||
|
if not card.types.__contains__('Land'):
|
||||||
|
mana_cost = GTKUtilities.get_mana_icons(card.mana_cost)
|
||||||
|
item = [card.multiverse_id,
|
||||||
|
card.name,
|
||||||
|
' '.join(card.supertypes or ''),
|
||||||
|
' '.join(card.types or ''),
|
||||||
|
card.rarity,
|
||||||
|
card.power,
|
||||||
|
card.toughness,
|
||||||
|
', '.join(card.printings or ''),
|
||||||
|
mana_cost,
|
||||||
|
card.cmc,
|
||||||
|
card.set_name,
|
||||||
|
color,
|
||||||
|
card.original_text]
|
||||||
|
self.store.append(item)
|
||||||
|
# Reactivate update for filtered trees
|
||||||
|
if self.filtered:
|
||||||
|
self.tree.thaw_child_notify()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def compare_rarity(model, row1, row2, _):
|
||||||
|
""" Compare function for two the rarities of two cards
|
||||||
|
:param model: The tree view model
|
||||||
|
:param row1: The first row to compare
|
||||||
|
:param row2: The second row to compare
|
||||||
|
:param _: ignored
|
||||||
|
:return: Integer value based on comparison
|
||||||
|
"""
|
||||||
|
sort_column = 4
|
||||||
|
value1 = model.get_value(row1, sort_column)
|
||||||
|
value2 = model.get_value(row2, sort_column)
|
||||||
|
if MTGConstants.rarities[value1.lower()] < MTGConstants.rarities[value2.lower()]:
|
||||||
|
return -1
|
||||||
|
elif value1 == value2:
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
61
cv_gtk3/gtk_util.py
Normal file
61
cv_gtk3/gtk_util.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import re
|
||||||
|
import os
|
||||||
|
from gi.repository import GdkPixbuf
|
||||||
|
try:
|
||||||
|
from PIL import Image as PImage
|
||||||
|
except ImportError as err:
|
||||||
|
print('PIL imaging library is not installed')
|
||||||
|
|
||||||
|
from cv_engine.util import EngineConfig
|
||||||
|
|
||||||
|
|
||||||
|
class GTKUtilities:
|
||||||
|
""" Access to image caches and utilities for use in the GTK application """
|
||||||
|
# Loaded mana symbols Format: {'B': GDKPixbuf, '3': GDKPixbuf}
|
||||||
|
mana_icons = {}
|
||||||
|
# Cache for combined mana cost icons
|
||||||
|
precon_icon_cache = {}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_mana_icons(mana_string):
|
||||||
|
""" Return the combined mana symbols for a mana string
|
||||||
|
:param mana_string: String in the format '{3}{U}{B}'
|
||||||
|
:return: GdkPixbuf containing the combined symbols
|
||||||
|
"""
|
||||||
|
if not mana_string:
|
||||||
|
return
|
||||||
|
icon_list = re.findall("{(.*?)}", mana_string.replace("/", "-"))
|
||||||
|
icon_name = "_".join(icon_list)
|
||||||
|
try:
|
||||||
|
icon = GTKUtilities.precon_icon_cache[icon_name]
|
||||||
|
except KeyError:
|
||||||
|
icon = GTKUtilities.create_mana_icons(mana_string)
|
||||||
|
GTKUtilities.precon_icon_cache[icon_name] = icon
|
||||||
|
return icon
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def create_mana_icons(mana_string):
|
||||||
|
# Convert the string to a List
|
||||||
|
glyphs = re.findall("{(.*?)}", mana_string)
|
||||||
|
if len(glyphs) == 0:
|
||||||
|
return
|
||||||
|
# Compute horizontal size for the final image
|
||||||
|
size = len(glyphs) * 105
|
||||||
|
image = PImage.new("RGBA", (size, 105))
|
||||||
|
for icon in glyphs:
|
||||||
|
x_pos = glyphs.index(icon) * 105
|
||||||
|
try:
|
||||||
|
loaded = GTKUtilities.mana_icons[icon]
|
||||||
|
except KeyError:
|
||||||
|
return
|
||||||
|
image.paste(loaded, (x_pos, 0))
|
||||||
|
# Save pre build icon file
|
||||||
|
path = os.path.join(EngineConfig.icon_cache_path, "_".join(glyphs) + ".png")
|
||||||
|
image.save(path)
|
||||||
|
try:
|
||||||
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file(path)
|
||||||
|
pixbuf = pixbuf.scale_simple(image.width / 5, image.height / 5, GdkPixbuf.InterpType.HYPER)
|
||||||
|
except Exception as err:
|
||||||
|
print(err)
|
||||||
|
return
|
||||||
|
return pixbuf
|
||||||
@@ -1,41 +1,40 @@
|
|||||||
import gi
|
import gi
|
||||||
|
import os
|
||||||
|
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
|
||||||
from cv_engine import engine
|
from cv_engine import engine
|
||||||
from cv_engine.util import Utilities
|
|
||||||
|
|
||||||
from cv_gtk3.main_window import MainWindowFunctions
|
from cv_gtk3.main_window import MainWindowFunctions
|
||||||
from cv_gtk3.setting import GUISettings
|
from cv_gtk3.setting import GUISettings
|
||||||
|
from cv_gtk3.signal_handlers import handlers
|
||||||
|
|
||||||
|
|
||||||
class CardvaultGTK(MainWindowFunctions):
|
class CardvaultGTK(MainWindowFunctions):
|
||||||
"""
|
""" Main UI class for the GTK interface """
|
||||||
Main UI class for the GTK interface
|
|
||||||
"""
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# Start engine (without config file)
|
# Start engine (without config file)
|
||||||
self.engine = engine.CardvaultEngine()
|
self.engine = engine.CardvaultEngine()
|
||||||
|
# Set Glade file location
|
||||||
|
GUISettings.glade_file_path = os.path.join(os.path.dirname(__file__), 'gui')
|
||||||
# Load Glade files
|
# Load Glade files
|
||||||
glade_files = ['mainwindow.glade', 'overlays.glade', 'search.glade', 'dialogs.glade']
|
glade_files = ['mainwindow.glade', 'search.glade', 'overlays.glade']
|
||||||
self.ui = Gtk.Builder()
|
self.ui = Gtk.Builder()
|
||||||
for file in glade_files:
|
for file in glade_files:
|
||||||
self.ui.add_from_file(Utilities.expand_file_path(__file__, ['gui', file]))
|
self.ui.add_from_file(os.path.join(GUISettings.glade_file_path, file))
|
||||||
|
|
||||||
# Set pages for the ui to use
|
# Set pages for the ui to use
|
||||||
GUISettings.pages = {
|
GUISettings.pages = {
|
||||||
"search": self.ui.get_object("searchView"),
|
"search": self.ui.get_object("searchView"),
|
||||||
}
|
}
|
||||||
|
|
||||||
# Call constructor of superclasses
|
# Call constructor of superclasses
|
||||||
MainWindowFunctions.__init__(self, self.ui)
|
MainWindowFunctions.__init__(self, self.ui)
|
||||||
|
# Create Signal handlers and connect them to the UI
|
||||||
self.ui.get_object('mainWindow').connect('delete-event', Gtk.main_quit)
|
self.handlers = handlers.Handlers(self)
|
||||||
|
self.ui.connect_signals(self.handlers)
|
||||||
|
# Initialize starting view
|
||||||
self.ui.get_object('mainWindow').show_all()
|
self.ui.get_object('mainWindow').show_all()
|
||||||
self.hide_initial_widgets()
|
self.hide_initial_widgets()
|
||||||
|
|
||||||
self.switch_page('search')
|
self.switch_page('search')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -73,16 +73,6 @@
|
|||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="main_load_data">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="tooltip_text" translatable="yes">Download card data to hard drive</property>
|
|
||||||
<property name="label" translatable="yes">Download Card Data</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="do_download_card_data" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuItem">
|
<object class="GtkMenuItem">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -94,21 +84,21 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuItem" id="main_clr_usr_data">
|
<object class="GtkMenuItem" id="delete_user_library">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Clear User Data</property>
|
<property name="label" translatable="yes">Clear User Data</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="activate" handler="do_card_data_user" swapped="no"/>
|
<signal name="activate" handler="do_delete_user_library" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuItem" id="main_clr_crd_data">
|
<object class="GtkMenuItem" id="delete_card_data">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Clear Card Data</property>
|
<property name="label" translatable="yes">Clear Card Data</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="activate" handler="do_card_data_card" swapped="no"/>
|
<signal name="activate" handler="do_delete_card_data" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -155,7 +145,7 @@
|
|||||||
<property name="label" translatable="yes">Search</property>
|
<property name="label" translatable="yes">Search</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="draw_as_radio">True</property>
|
<property name="draw_as_radio">True</property>
|
||||||
<signal name="activate" handler="on_view_changed" swapped="no"/>
|
<signal name="activate" handler="do_change_view" swapped="no"/>
|
||||||
<accelerator key="1" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
<accelerator key="1" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
@@ -168,7 +158,7 @@
|
|||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<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="do_change_view" swapped="no"/>
|
||||||
<accelerator key="2" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
<accelerator key="2" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
@@ -181,7 +171,7 @@
|
|||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<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="do_change_view" swapped="no"/>
|
||||||
<accelerator key="3" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
<accelerator key="3" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
@@ -200,12 +190,12 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuItem" id="prefs_item">
|
<object class="GtkMenuItem" id="open_prefs">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Preferences</property>
|
<property name="label" translatable="yes">Preferences</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="activate" handler="prefs_open" swapped="no"/>
|
<signal name="activate" handler="do_prefs_open" swapped="no"/>
|
||||||
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|||||||
@@ -366,22 +366,6 @@
|
|||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkButton" id="addRemoveButton">
|
|
||||||
<property name="label" translatable="yes">Add to Library</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<signal name="clicked" handler="do_add_clicked" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="pack_type">end</property>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
class GUISettings:
|
class GUISettings:
|
||||||
"""
|
""" Settings for the GUI """
|
||||||
Settings for the GUI
|
|
||||||
"""
|
|
||||||
# Collection of all pages the UI can use
|
# Collection of all pages the UI can use
|
||||||
pages = {}
|
pages = {}
|
||||||
# Currently viewed page
|
# Currently viewed page
|
||||||
current_page = ''
|
current_page = ''
|
||||||
# Title for the GTK window
|
# Title for the GTK window
|
||||||
application_title = 'Cardvault'
|
application_title = 'Cardvault'
|
||||||
|
# Location of Glade UI files
|
||||||
|
glade_file_path = ''
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
class Handlers:
|
from cv_gtk3.signal_handlers.menu_bar import MenuBarHandlers
|
||||||
"""
|
from cv_gtk3.signal_handlers.search import SearchPageHandlers
|
||||||
Class containing all signal handlers for the GTK GUI
|
|
||||||
"""
|
|
||||||
|
class Handlers(MenuBarHandlers, SearchPageHandlers):
|
||||||
|
""" Class containing all signal handlers for the GTK GUI """
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
"""
|
""" Initialize handler class
|
||||||
Initialize handler class
|
|
||||||
:param app: reference to an CardvaultGTK object
|
:param app: reference to an CardvaultGTK object
|
||||||
"""
|
"""
|
||||||
self.app = app
|
self.app = app
|
||||||
|
# Call constructors of superclasses
|
||||||
|
MenuBarHandlers.__init__(self, self.app)
|
||||||
|
SearchPageHandlers.__init__(self, self.app)
|
||||||
|
|||||||
44
cv_gtk3/signal_handlers/menu_bar.py
Normal file
44
cv_gtk3/signal_handlers/menu_bar.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import gi
|
||||||
|
gi.require_version('Gtk', '3.0')
|
||||||
|
from gi.repository import Gtk
|
||||||
|
|
||||||
|
|
||||||
|
class MenuBarHandlers:
|
||||||
|
"""
|
||||||
|
Class for handling signals from the menu bar
|
||||||
|
"""
|
||||||
|
def __init__(self, app):
|
||||||
|
"""
|
||||||
|
Constructor
|
||||||
|
:param app: Reference to a CardvaultGTK object
|
||||||
|
"""
|
||||||
|
self.app = app
|
||||||
|
|
||||||
|
def do_save_library(self, menu_item):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def do_export_library(self, menu_item):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def do_import_library(self, menu_item):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def do_delete_user_library(self, menu_item):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def do_delete_card_data(self, menu_item):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def do_change_view(self, menu_item):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def do_prefs_open(self, manu_item):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def do_delete_event(*args):
|
||||||
|
"""
|
||||||
|
Signal will be sent when app should close
|
||||||
|
:param args: Arguments to the delete event
|
||||||
|
"""
|
||||||
|
Gtk.main_quit()
|
||||||
56
cv_gtk3/signal_handlers/search.py
Normal file
56
cv_gtk3/signal_handlers/search.py
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from cv_gtk3.card_view import CardView
|
||||||
|
from cv_gtk3.setting import GUISettings
|
||||||
|
|
||||||
|
|
||||||
|
class SearchPageHandlers:
|
||||||
|
""" Class for handling Signals from the search page """
|
||||||
|
def __init__(self, app):
|
||||||
|
""" Constructor
|
||||||
|
:param app: Reference to an CardvaultGTK object
|
||||||
|
"""
|
||||||
|
self.app = app
|
||||||
|
|
||||||
|
# Build the card view
|
||||||
|
overlay = self.app.ui.get_object("searchResults")
|
||||||
|
card_list = CardView(ui_file=os.path.join(GUISettings.glade_file_path, 'cardtree.glade'), filtered=False)
|
||||||
|
card_list.set_name("resultsScroller")
|
||||||
|
# TODO Context menu for card view
|
||||||
|
# card_list.tree.connect("row-activated", self.on_search_card_selected)
|
||||||
|
# card_list.selection.connect("changed", self.on_search_selection_changed)
|
||||||
|
overlay.add(card_list)
|
||||||
|
overlay.add_overlay(self.app.ui.get_object("searchOverlay"))
|
||||||
|
overlay.show_all()
|
||||||
|
|
||||||
|
def do_search_cards(self, *args):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def do_clear_mana_filter(button_grid):
|
||||||
|
""" Reset filter buttons in mana grid """
|
||||||
|
for button in button_grid.get_children():
|
||||||
|
if hasattr(button, 'set_active'):
|
||||||
|
button.set_active(False)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def do_clear_set_filter(entry, *_):
|
||||||
|
""" Reset set filter combo box """
|
||||||
|
entry.set_text('')
|
||||||
|
|
||||||
|
def do_search_clear_all_clicked(self, *_):
|
||||||
|
""" Rest all controls in search view """
|
||||||
|
self.app.ui.get_object("searchEntry").set_text("")
|
||||||
|
self.do_clear_mana_filter(self.app.ui.get_object("manaFilterGrid"))
|
||||||
|
self.app.ui.get_object("rarityCombo").set_active(0)
|
||||||
|
self.app.ui.get_object("typeCombo").set_active(0)
|
||||||
|
self.app.ui.get_object("setEntry").set_text("")
|
||||||
|
|
||||||
|
def search_tree_popup_showed(self, _):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def do_show_card_details(self, _):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def do_search_add_to_lib(self, _):
|
||||||
|
pass
|
||||||
Reference in New Issue
Block a user