Add first run dialog.
This commit is contained in:
@@ -32,10 +32,9 @@ class Application:
|
|||||||
|
|
||||||
self.current_page = None
|
self.current_page = None
|
||||||
self.unsaved_changes = False
|
self.unsaved_changes = False
|
||||||
self.current_lib_tag = "All"
|
self.current_lib_tag = "Untagged"
|
||||||
|
|
||||||
self.db = database.CardVaultDB(util.get_root_filename(util.DB_NAME))
|
self.db = database.CardVaultDB(util.get_root_filename(util.DB_NAME))
|
||||||
|
|
||||||
# Create database tables if they do not exist
|
# Create database tables if they do not exist
|
||||||
self.db.db_create()
|
self.db.db_create()
|
||||||
|
|
||||||
@@ -75,6 +74,17 @@ class Application:
|
|||||||
|
|
||||||
util.log("Launching Card Vault version {}".format(util.VERSION), util.LogLevel.Info)
|
util.log("Launching Card Vault version {}".format(util.VERSION), util.LogLevel.Info)
|
||||||
|
|
||||||
|
if self.config.get('first_run'):
|
||||||
|
ref = '<a href="' + util.MANUAL_LOCATION + '">' + util.MANUAL_LOCATION + '</a>'
|
||||||
|
s = "Welcome to Card Vault.\n\nIf you need help using the application please refer to the manual at\n{}\n\n" \
|
||||||
|
"To increase search performance and to be able to search while offline it is advised to use the " \
|
||||||
|
"offline mode.\nDo you want to start the download?".format(ref)
|
||||||
|
response = self.show_dialog_yn("Welcome", s)
|
||||||
|
if response == Gtk.ResponseType.YES:
|
||||||
|
self.handlers.do_download_card_data(Gtk.MenuItem())
|
||||||
|
self.config['first_run'] = False
|
||||||
|
self.save_config()
|
||||||
|
|
||||||
def push_status(self, msg):
|
def push_status(self, msg):
|
||||||
status_bar = self.ui.get_object("statusBar")
|
status_bar = self.ui.get_object("statusBar")
|
||||||
status_bar.pop(0)
|
status_bar.pop(0)
|
||||||
@@ -152,7 +162,7 @@ class Application:
|
|||||||
dialog = self.ui.get_object("ync_dialog")
|
dialog = self.ui.get_object("ync_dialog")
|
||||||
dialog.set_transient_for(self.ui.get_object("mainWindow"))
|
dialog.set_transient_for(self.ui.get_object("mainWindow"))
|
||||||
dialog.set_title(title)
|
dialog.set_title(title)
|
||||||
self.ui.get_object("ync_label").set_text(message)
|
self.ui.get_object("ync_label").set_markup(message)
|
||||||
response = dialog.run()
|
response = dialog.run()
|
||||||
dialog.hide()
|
dialog.hide()
|
||||||
return response
|
return response
|
||||||
@@ -162,7 +172,7 @@ class Application:
|
|||||||
dialog = self.ui.get_object("yn_dialog")
|
dialog = self.ui.get_object("yn_dialog")
|
||||||
dialog.set_transient_for(self.ui.get_object("mainWindow"))
|
dialog.set_transient_for(self.ui.get_object("mainWindow"))
|
||||||
dialog.set_title(title)
|
dialog.set_title(title)
|
||||||
self.ui.get_object("yn_label").set_text(message)
|
self.ui.get_object("yn_label").set_markup(message)
|
||||||
response = dialog.run()
|
response = dialog.run()
|
||||||
dialog.hide()
|
dialog.hide()
|
||||||
return response
|
return response
|
||||||
|
|||||||
@@ -265,6 +265,11 @@
|
|||||||
<object class="GtkLabel" id="yn_label">
|
<object class="GtkLabel" id="yn_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">2</property>
|
||||||
|
<property name="margin_right">2</property>
|
||||||
|
<property name="margin_top">2</property>
|
||||||
|
<property name="margin_bottom">2</property>
|
||||||
|
<property name="justify">center</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -349,6 +354,11 @@
|
|||||||
<object class="GtkLabel" id="ync_label">
|
<object class="GtkLabel" id="ync_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">2</property>
|
||||||
|
<property name="margin_right">2</property>
|
||||||
|
<property name="margin_top">2</property>
|
||||||
|
<property name="margin_bottom">2</property>
|
||||||
|
<property name="justify">center</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ ALL_SETS_JSON_URL = 'https://mtgjson.com/json/AllSets-x.json'
|
|||||||
# URL for card images. Insert card.multiverse_id.
|
# URL for card images. Insert card.multiverse_id.
|
||||||
CARD_IMAGE_URL = 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid={}&type=card'
|
CARD_IMAGE_URL = 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid={}&type=card'
|
||||||
|
|
||||||
|
# Location of manual wiki
|
||||||
|
MANUAL_LOCATION = 'https://github.com/luxick/cardvault'
|
||||||
|
|
||||||
# Colors for card rows in search view
|
# Colors for card rows in search view
|
||||||
SEARCH_TREE_COLORS = {
|
SEARCH_TREE_COLORS = {
|
||||||
"unowned": "black",
|
"unowned": "black",
|
||||||
@@ -67,6 +70,7 @@ default_config = {
|
|||||||
"hide_duplicates_in_search": False,
|
"hide_duplicates_in_search": False,
|
||||||
"start_page": "search",
|
"start_page": "search",
|
||||||
"local_db": False,
|
"local_db": False,
|
||||||
|
"first_run": True,
|
||||||
"log_level": 3,
|
"log_level": 3,
|
||||||
"legality_colors": {
|
"legality_colors": {
|
||||||
"Banned": "#C65642",
|
"Banned": "#C65642",
|
||||||
|
|||||||
Reference in New Issue
Block a user