Changed the app icon, also included it in the About box.

master
Pacman Ghost 5 years ago
parent 2845ce5aeb
commit b1639ebf66
  1. 33
      vasl_templates/about.py
  2. 225
      vasl_templates/ui/about.ui
  3. 1
      vasl_templates/webapp/config/constants.py
  4. BIN
      vasl_templates/webapp/static/images/app.ico
  5. BIN
      vasl_templates/webapp/static/images/app.snag

@ -1,14 +1,18 @@
"""Implement the "about" dialog.""" """Implement the "about" dialog."""
import sys
import os import os
import json import json
import time import time
import io import io
import re
from PyQt5 import uic from PyQt5 import uic, QtCore
from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QDesktopServices, QIcon, QCursor
from PyQt5.QtWidgets import QDialog from PyQt5.QtWidgets import QDialog
from vasl_templates.webapp.config.constants import APP_NAME, APP_VERSION, BASE_DIR from vasl_templates.webapp.config.constants import APP_NAME, APP_VERSION, APP_HOME_URL, BASE_DIR, IS_FROZEN
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
@ -22,11 +26,21 @@ class AboutDialog( QDialog ):
# initialize the UI # initialize the UI
base_dir = os.path.split( __file__ )[0] base_dir = os.path.split( __file__ )[0]
dname = os.path.join( base_dir, "ui/about.ui" ) fname = os.path.join( base_dir, "ui/about.ui" )
uic.loadUi( dname, self ) uic.loadUi( fname, self )
self.setFixedSize( self.size() ) self.setFixedSize( self.size() )
self.close_button.clicked.connect( self.on_close ) self.close_button.clicked.connect( self.on_close )
# initialize the UI
if IS_FROZEN:
dname = os.path.join( sys._MEIPASS, "vasl_templates/webapp" ) #pylint: disable=no-member,protected-access
else:
dname = os.path.join( os.path.split(__file__)[0], "webapp" )
fname = os.path.join( dname, "static/images/app.ico" )
self.app_icon.setPixmap( QIcon( fname ).pixmap(64,64) )
self.app_icon.mouseReleaseEvent = self.on_app_icon_clicked
self.app_icon.setCursor( QCursor( QtCore.Qt.PointingHandCursor ) )
# get the build info # get the build info
dname = os.path.join( BASE_DIR, "config" ) dname = os.path.join( BASE_DIR, "config" )
fname = os.path.join( dname, "build-info.json" ) fname = os.path.join( dname, "build-info.json" )
@ -53,9 +67,14 @@ class AboutDialog( QDialog ):
self.build_info.setText( buf.getvalue() ) self.build_info.setText( buf.getvalue() )
else: else:
self.build_info.setText( "" ) self.build_info.setText( "" )
self.home_url.setText( mo = re.search( r"^https?://(.+)", APP_HOME_URL )
"Get the source code and releases from <a href='http://github.com/pacman-ghost/vasl-templates'>Github</a>." self.home_url.setText( "Visit us at <a href='{}'>{}</a>.".format(
) APP_HOME_URL, mo.group(1) if mo else APP_HOME_URL
) )
def on_app_icon_clicked( self, event ): #pylint: disable=no-self-use,unused-argument
"""Click handler."""
QDesktopServices.openUrl( QUrl( APP_HOME_URL ) )
def on_close( self ): def on_close( self ):
"""Close the dialog.""" """Close the dialog."""

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>428</width> <width>410</width>
<height>142</height> <height>150</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -19,113 +19,130 @@
<property name="modal"> <property name="modal">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <widget class="QLabel" name="app_icon">
<item> <property name="geometry">
<widget class="QLabel" name="app_name"> <rect>
<property name="font"> <x>10</x>
<font> <y>10</y>
<family>DejaVu Sans</family> <width>64</width>
<pointsize>12</pointsize> <height>64</height>
</font> </rect>
</property> </property>
<property name="text"> <property name="frameShape">
<string>*** APP NAME ***</string> <enum>QFrame::NoFrame</enum>
</property> </property>
</widget> <property name="text">
</item> <string/>
<item> </property>
<widget class="QLabel" name="build_info"> </widget>
<property name="text"> <widget class="QWidget" name="verticalLayoutWidget">
<string>*** BUILD INFO ***</string> <property name="geometry">
</property> <rect>
</widget> <x>80</x>
</item> <y>20</y>
<item> <width>321</width>
<widget class="QLabel" name="home_url"> <height>44</height>
<property name="text"> </rect>
<string>*** HOME URL ***</string> </property>
</property> <layout class="QVBoxLayout" name="verticalLayout">
<property name="openExternalLinks"> <item>
<bool>true</bool> <widget class="QLabel" name="app_name">
</property> <property name="font">
</widget> <font>
</item> <family>DejaVu Sans</family>
<item> <pointsize>12</pointsize>
<widget class="QLabel" name="license"> </font>
<property name="text">
<string>Licensed under the GNU Affero General Public License (v3).</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>5</number>
</property> </property>
<property name="leftMargin"> <property name="text">
<number>0</number> <string>*** APP NAME ***</string>
</property> </property>
<property name="topMargin"> </widget>
<number>0</number> </item>
<item>
<widget class="QLabel" name="build_info">
<property name="font">
<font>
<family>DejaVu Sans</family>
<italic>true</italic>
</font>
</property> </property>
<property name="rightMargin"> <property name="text">
<number>0</number> <string>*** BUILD INFO ***</string>
</property> </property>
<property name="bottomMargin"> </widget>
<number>0</number> </item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>391</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
<item> <property name="sizeHint" stdset="0">
<spacer name="horizontalSpacer"> <size>
<property name="orientation"> <width>309</width>
<enum>Qt::Horizontal</enum> <height>20</height>
</property> </size>
<property name="sizeHint" stdset="0"> </property>
<size> </spacer>
<width>309</width> </item>
<height>20</height> <item>
</size> <widget class="QPushButton" name="close_button">
</property> <property name="sizePolicy">
</spacer> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
</item> <horstretch>0</horstretch>
<item> <verstretch>0</verstretch>
<widget class="QPushButton" name="close_button"> </sizepolicy>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <property name="text">
<horstretch>0</horstretch> <string>Close</string>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="default">
</property> <bool>true</bool>
<property name="text"> </property>
<string>Close</string> </widget>
</property> </item>
<property name="default"> </layout>
<bool>true</bool> </widget>
</property> <widget class="QLabel" name="home_url">
</widget> <property name="geometry">
</item> <rect>
</layout> <x>10</x>
</widget> <y>100</y>
</item> <width>391</width>
</layout> <height>17</height>
</rect>
</property>
<property name="text">
<string>*** HOME URL ***</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="license">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>388</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Licensed under the GNU Affero General Public License (v3).</string>
</property>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

@ -6,6 +6,7 @@ import os
APP_NAME = "VASL Templates" APP_NAME = "VASL Templates"
APP_VERSION = "v0.10" # nb: also update setup.py APP_VERSION = "v0.10" # nb: also update setup.py
APP_DESCRIPTION = "Generate HTML for use in VASL scenarios." APP_DESCRIPTION = "Generate HTML for use in VASL scenarios."
APP_HOME_URL = "https://vasl-templates.org"
if getattr( sys, "frozen", False ): if getattr( sys, "frozen", False ):
IS_FROZEN = True IS_FROZEN = True

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Loading…
Cancel
Save