Minor UI changes.

master
Pacman Ghost 7 years ago
parent d1bf48b3e3
commit f8dbc27801
  1. 13
      add_card_widget.py
  2. 2
      main_window.py
  3. BIN
      resources/progress.gif
  4. 10
      startup_widget.py
  5. 360
      ui/add_card_widget.ui
  6. 212
      ui/startup_widget.ui

@ -24,9 +24,6 @@ class AddCardWidget( QWidget ) :
# initialize the widget # initialize the widget
uic.loadUi( os.path.join(globals.base_dir,"ui/add_card_widget.ui") , self ) uic.loadUi( os.path.join(globals.base_dir,"ui/add_card_widget.ui") , self )
self.lb_cards.setSortingEnabled( True ) self.lb_cards.setSortingEnabled( True )
w = self.buttons_widget
self.xmargin = w.x()
self.ymargin = self.size().height() - (w.y() + w.height())
# load the widget # load the widget
for nationality in globals.cards : for nationality in globals.cards :
self.cbo_nationality.addItem( nationality ) self.cbo_nationality.addItem( nationality )
@ -107,13 +104,3 @@ class AddCardWidget( QWidget ) :
if not self.lb_cards.currentItem() : if not self.lb_cards.currentItem() :
QApplication.beep() QApplication.beep()
self.on_ok() self.on_ok()
def resizeEvent( self , evt ) :
# handle the event
w = self.buttons_widget
self.buttons_widget.setGeometry(
self.xmargin , self.size().height() - self.ymargin - w.height() ,
self.size().width() - 2*self.xmargin , w.height()
)
w = self.lb_cards
w.resize( self.size().width() - 2*self.xmargin , self.buttons_widget.y() - w.y() )

@ -63,7 +63,7 @@ class MainWindow( QMainWindow ) :
self.add_card_action.setStatusTip( "Add an ASL Card." ) self.add_card_action.setStatusTip( "Add an ASL Card." )
self.add_card_action.triggered.connect( self.on_add_card ) self.add_card_action.triggered.connect( self.on_add_card )
file_menu.addAction( self.add_card_action ) file_menu.addAction( self.add_card_action )
self.close_tab_action = QAction(" &Close" , self ) self.close_tab_action = QAction( "&Close" , self )
self.close_tab_action.setShortcut( "Ctrl+W" ) self.close_tab_action.setShortcut( "Ctrl+W" )
self.close_tab_action.setStatusTip( "Close the current tab." ) self.close_tab_action.setStatusTip( "Close the current tab." )
self.close_tab_action.triggered.connect( self.on_close_tab ) self.close_tab_action.triggered.connect( self.on_close_tab )

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

@ -3,7 +3,7 @@ import os
from PyQt5 import uic from PyQt5 import uic
from PyQt5.QtCore import Qt , QMetaObject , QThread , pyqtSignal , pyqtSlot , Q_ARG , Q_RETURN_ARG from PyQt5.QtCore import Qt , QMetaObject , QThread , pyqtSignal , pyqtSlot , Q_ARG , Q_RETURN_ARG
from PyQt5.QtWidgets import QWidget , QFrame , QFileDialog , QMessageBox from PyQt5.QtWidgets import QWidget , QFrame , QFileDialog , QMessageBox
from PyQt5.QtGui import QPixmap , QIcon from PyQt5.QtGui import QPixmap , QIcon , QMovie
from asl_cards.parse import PdfParser from asl_cards.parse import PdfParser
import asl_cards.db as db import asl_cards.db as db
@ -99,6 +99,12 @@ class StartupWidget( QWidget ) :
uic.loadUi( os.path.join(globals.base_dir,"ui/startup_widget.ui") , self ) uic.loadUi( os.path.join(globals.base_dir,"ui/startup_widget.ui") , self )
self.setMinimumSize( self.size() ) self.setMinimumSize( self.size() )
self.frm_analyze_progress.hide() self.frm_analyze_progress.hide()
# NOTE: The animation was created at loading.io:
# color1=#047ab3 ; color2=#83bfdc ; bgd=#ffffff ; speed=2
self.progress_animation = QMovie( os.path.join( globals.base_dir , "resources/progress.gif" ) )
self.lbl_progress.setFrameStyle( QFrame.NoFrame )
self.lbl_progress.setScaledContents( True )
self.lbl_progress.setMovie( self.progress_animation )
# initialize the widget # initialize the widget
self.lbl_analyze_icon.setPixmap( self.lbl_analyze_icon.setPixmap(
QPixmap( os.path.join( globals.base_dir , "resources/analyze.png" ) ) QPixmap( os.path.join( globals.base_dir , "resources/analyze.png" ) )
@ -184,6 +190,7 @@ class StartupWidget( QWidget ) :
# run the analysis (in a worker thread) # run the analysis (in a worker thread)
self.frm_open_db.hide() self.frm_open_db.hide()
self.frm_analyze_progress.show() self.frm_analyze_progress.show()
self.progress_animation.start()
self._update_analyze_ui( False ) self._update_analyze_ui( False )
self.btn_cancel_analyze.setEnabled( True ) self.btn_cancel_analyze.setEnabled( True )
self.btn_cancel_analyze.clicked.connect( self.on_cancel_analyze ) self.btn_cancel_analyze.clicked.connect( self.on_cancel_analyze )
@ -228,6 +235,7 @@ class StartupWidget( QWidget ) :
def on_analyze_completed( self , ex ) : def on_analyze_completed( self , ex ) :
# clean up # clean up
self.analyze_thread = None self.analyze_thread = None
self.progress_animation.stop()
# check if the analysis failed # check if the analysis failed
if ex : if ex :
MainWindow.show_error_msg( "Analyze failed:\n\n{}".format( ex ) ) MainWindow.show_error_msg( "Analyze failed:\n\n{}".format( ex ) )

@ -6,171 +6,239 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>380</width> <width>450</width>
<height>336</height> <height>300</height>
</rect> </rect>
</property> </property>
<widget class="QWidget" name="controls_widget" native="true"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="geometry"> <property name="spacing">
<rect> <number>2</number>
<x>-1</x>
<y>9</y>
<width>301</width>
<height>55</height>
</rect>
</property> </property>
<property name="sizePolicy"> <property name="leftMargin">
<sizepolicy hsizetype="Preferred" vsizetype="Ignored"> <number>8</number>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="maximumSize"> <property name="topMargin">
<size> <number>8</number>
<width>16777215</width>
<height>55</height>
</size>
</property> </property>
<widget class="QLabel" name="label"> <property name="rightMargin">
<property name="geometry"> <number>8</number>
<rect>
<x>10</x>
<y>10</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>&amp;Nationality:</string>
</property>
<property name="buddy">
<cstring>cbo_nationality</cstring>
</property>
</widget>
<widget class="QRadioButton" name="rb_ordnance">
<property name="geometry">
<rect>
<x>170</x>
<y>30</y>
<width>91</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>Or&amp;dnance</string>
</property>
</widget>
<widget class="QComboBox" name="cbo_nationality">
<property name="geometry">
<rect>
<x>90</x>
<y>10</y>
<width>131</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QRadioButton" name="rb_vehicles">
<property name="geometry">
<rect>
<x>90</x>
<y>30</y>
<width>81</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>&amp;Vehicles</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="buttons_widget" native="true">
<property name="geometry">
<rect>
<x>10</x>
<y>280</y>
<width>361</width>
<height>46</height>
</rect>
</property> </property>
<property name="sizePolicy"> <property name="bottomMargin">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <number>8</number>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <item>
<item> <widget class="QWidget" name="widget" native="true">
<spacer name="horizontalSpacer"> <property name="minimumSize">
<property name="orientation"> <size>
<enum>Qt::Horizontal</enum> <width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<widget class="QRadioButton" name="rb_ordnance">
<property name="geometry">
<rect>
<x>290</x>
<y>0</y>
<width>89</width>
<height>26</height>
</rect>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="text">
<string>Or&amp;dnance</string>
</property>
</widget>
<widget class="QComboBox" name="cbo_nationality">
<property name="geometry">
<rect>
<x>80</x>
<y>0</y>
<width>120</width>
<height>28</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size> <size>
<width>40</width> <width>120</width>
<height>20</height> <height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size> </size>
</property> </property>
</spacer> </widget>
</item> <widget class="QLabel" name="label">
<item> <property name="geometry">
<widget class="QPushButton" name="cancel_button"> <rect>
<x>0</x>
<y>-1</y>
<width>75</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&amp;Nationality:</string>
</property>
<property name="buddy">
<cstring>cbo_nationality</cstring>
</property>
</widget>
<widget class="QRadioButton" name="rb_vehicles">
<property name="geometry">
<rect>
<x>210</x>
<y>0</y>
<width>79</width>
<height>26</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>Cancel</string> <string>&amp;Vehicles</string>
</property> </property>
</widget> </widget>
</item> <zorder>label</zorder>
<item> <zorder>rb_ordnance</zorder>
<widget class="QPushButton" name="ok_button"> <zorder>cbo_nationality</zorder>
<zorder>label</zorder>
<zorder>rb_vehicles</zorder>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>51</width>
<height>19</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text"> <property name="text">
<string>&amp;OK</string> <string>&amp;Cards:</string>
</property> </property>
<property name="default"> <property name="buddy">
<bool>true</bool> <cstring>lb_cards</cstring>
</property> </property>
</widget> </widget>
</item> </widget>
</layout> </item>
</widget> <item>
<widget class="QLabel" name="label_2"> <widget class="QListWidget" name="lb_cards">
<property name="geometry"> <property name="sizePolicy">
<rect> <sizepolicy hsizetype="Expanding" vsizetype="Ignored">
<x>10</x> <horstretch>0</horstretch>
<y>50</y> <verstretch>0</verstretch>
<width>53</width> </sizepolicy>
<height>20</height> </property>
</rect> <property name="minimumSize">
</property> <size>
<property name="maximumSize"> <width>0</width>
<size> <height>100</height>
<width>16777215</width> </size>
<height>20</height> </property>
</size> </widget>
</property> </item>
<property name="text"> <item>
<string>&amp;Cards:</string> <widget class="QWidget" name="widget_3" native="true">
</property> <property name="minimumSize">
<property name="buddy"> <size>
<cstring>lb_cards</cstring> <width>0</width>
</property> <height>30</height>
</widget> </size>
<widget class="QListWidget" name="lb_cards"> </property>
<property name="geometry"> <property name="maximumSize">
<rect> <size>
<x>9</x> <width>16777215</width>
<y>71</y> <height>30</height>
<width>362</width> </size>
<height>211</height> </property>
</rect> <layout class="QHBoxLayout" name="horizontalLayout_2">
</property> <property name="spacing">
<property name="sizePolicy"> <number>2</number>
<sizepolicy hsizetype="Expanding" vsizetype="Ignored"> </property>
<horstretch>0</horstretch> <property name="leftMargin">
<verstretch>0</verstretch> <number>0</number>
</sizepolicy> </property>
</property> <property name="topMargin">
</widget> <number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancel_button">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ok_button">
<property name="text">
<string>&amp;OK</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget> </widget>
<tabstops>
<tabstop>lb_cards</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>566</width> <width>592</width>
<height>399</height> <height>418</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
@ -83,6 +83,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text"> <property name="text">
<string>If this is the first time you have run this program, you need to analyze the PDF files first, and save the results in a database.</string> <string>If this is the first time you have run this program, you need to analyze the PDF files first, and save the results in a database.</string>
</property> </property>
@ -95,8 +101,30 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QWidget" name="widget_5" native="true"> <widget class="QLabel" name="label_5">
<layout class="QVBoxLayout" name="verticalLayout_3"> <property name="font">
<font>
<pointsize>8</pointsize>
<italic>true</italic>
</font>
</property>
<property name="styleSheet">
<string notr="true">color:#444 ;</string>
</property>
<property name="text">
<string>&lt;html&gt;This needs &lt;a href=&quot;https://ghostscript.com&quot;&gt;Ghostscript&lt;/a&gt; to be installed.&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing"> <property name="spacing">
<number>2</number> <number>2</number>
</property> </property>
@ -104,7 +132,7 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>8</number> <number>5</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>0</number> <number>0</number>
@ -122,6 +150,67 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>8</pointsize>
<weight>50</weight>
<italic>true</italic>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color:#444 ;</string>
</property>
<property name="text">
<string>These PDF files can be obtained &lt;a href=&quot;http://aslcards.com&quot;&gt;here&lt;/a&gt;.</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_5" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QWidget" name="widget_6" native="true"> <widget class="QWidget" name="widget_6" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
@ -272,9 +361,9 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="spacing"> <property name="spacing">
<number>2</number> <number>0</number>
</property> </property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
@ -288,42 +377,97 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item alignment="Qt::AlignTop">
<widget class="QProgressBar" name="pb_files"> <widget class="QLabel" name="lbl_progress">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="pb_pages">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>50</width>
<height>15</height> <height>50</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>50</width>
<height>15</height> <height>50</height>
</size> </size>
</property> </property>
<property name="value"> <property name="styleSheet">
<number>24</number> <string notr="true">margin:0 5px 5px 0;</string>
</property> </property>
<property name="textVisible"> <property name="frameShape">
<bool>false</bool> <enum>QFrame::Box</enum>
</property> </property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QPushButton" name="btn_cancel_analyze">
<property name="text"> <property name="text">
<string>&amp;Cancel</string> <string/>
</property>
<property name="margin">
<number>0</number>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QProgressBar" name="pb_files">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="pb_pages">
<property name="minimumSize">
<size>
<width>0</width>
<height>15</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="value">
<number>24</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_cancel_analyze">
<property name="text">
<string>&amp;Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -387,6 +531,12 @@
</property> </property>
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text"> <property name="text">
<string>If you have already analyzed the PDF files, open the &amp;database:</string> <string>If you have already analyzed the PDF files, open the &amp;database:</string>
</property> </property>
@ -454,6 +604,9 @@
<italic>true</italic> <italic>true</italic>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true">color:#444 ;</string>
</property>
<property name="text"> <property name="text">
<string>Put the database in the same directory as this program, and it will be loaded automatically, or add a &quot;--db ...&quot; parameter to the command-line arguments.</string> <string>Put the database in the same directory as this program, and it will be loaded automatically, or add a &quot;--db ...&quot; parameter to the command-line arguments.</string>
</property> </property>
@ -507,6 +660,7 @@
<tabstop>btn_cancel_analyze</tabstop> <tabstop>btn_cancel_analyze</tabstop>
<tabstop>le_load_db_fname</tabstop> <tabstop>le_load_db_fname</tabstop>
<tabstop>btn_load_db_fname</tabstop> <tabstop>btn_load_db_fname</tabstop>
<tabstop>btn_load_db</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>

Loading…
Cancel
Save