Add first run dialog.

This commit is contained in:
luxick
2017-08-01 20:57:44 +02:00
parent e5e99bba7c
commit e244efbe8b
3 changed files with 28 additions and 4 deletions

View File

@@ -32,10 +32,9 @@ class Application:
self.current_page = None
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))
# Create database tables if they do not exist
self.db.db_create()
@@ -75,6 +74,17 @@ class Application:
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):
status_bar = self.ui.get_object("statusBar")
status_bar.pop(0)
@@ -152,7 +162,7 @@ class Application:
dialog = self.ui.get_object("ync_dialog")
dialog.set_transient_for(self.ui.get_object("mainWindow"))
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()
dialog.hide()
return response
@@ -162,7 +172,7 @@ class Application:
dialog = self.ui.get_object("yn_dialog")
dialog.set_transient_for(self.ui.get_object("mainWindow"))
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()
dialog.hide()
return response

View File

@@ -265,6 +265,11 @@
<object class="GtkLabel" id="yn_label">
<property name="visible">True</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>
<packing>
<property name="expand">False</property>
@@ -349,6 +354,11 @@
<object class="GtkLabel" id="ync_label">
<property name="visible">True</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>
<packing>
<property name="expand">False</property>

View File

@@ -49,6 +49,9 @@ ALL_SETS_JSON_URL = 'https://mtgjson.com/json/AllSets-x.json'
# URL for card images. Insert card.multiverse_id.
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
SEARCH_TREE_COLORS = {
"unowned": "black",
@@ -67,6 +70,7 @@ default_config = {
"hide_duplicates_in_search": False,
"start_page": "search",
"local_db": False,
"first_run": True,
"log_level": 3,
"legality_colors": {
"Banned": "#C65642",