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
uic.loadUi( os.path.join(globals.base_dir,"ui/add_card_widget.ui") , self )
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
for nationality in globals.cards :
self.cbo_nationality.addItem( nationality )
@ -107,13 +104,3 @@ class AddCardWidget( QWidget ) :
if not self.lb_cards.currentItem() :
QApplication.beep()
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.triggered.connect( self.on_add_card )
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.setStatusTip( "Close the current 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.QtCore import Qt , QMetaObject , QThread , pyqtSignal , pyqtSlot , Q_ARG , Q_RETURN_ARG
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
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 )
self.setMinimumSize( self.size() )
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
self.lbl_analyze_icon.setPixmap(
QPixmap( os.path.join( globals.base_dir , "resources/analyze.png" ) )
@ -184,6 +190,7 @@ class StartupWidget( QWidget ) :
# run the analysis (in a worker thread)
self.frm_open_db.hide()
self.frm_analyze_progress.show()
self.progress_animation.start()
self._update_analyze_ui( False )
self.btn_cancel_analyze.setEnabled( True )
self.btn_cancel_analyze.clicked.connect( self.on_cancel_analyze )
@ -228,6 +235,7 @@ class StartupWidget( QWidget ) :
def on_analyze_completed( self , ex ) :
# clean up
self.analyze_thread = None
self.progress_animation.stop()
# check if the analysis failed
if ex :
MainWindow.show_error_msg( "Analyze failed:\n\n{}".format( ex ) )

@ -6,171 +6,239 @@
<rect>
<x>0</x>
<y>0</y>
<width>380</width>
<height>336</height>
<width>450</width>
<height>300</height>
</rect>
</property>
<widget class="QWidget" name="controls_widget" native="true">
<property name="geometry">
<rect>
<x>-1</x>
<y>9</y>
<width>301</width>
<height>55</height>
</rect>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="leftMargin">
<number>8</number>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>55</height>
</size>
<property name="topMargin">
<number>8</number>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<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 name="rightMargin">
<number>8</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="bottomMargin">
<number>8</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item>
<widget class="QWidget" name="widget" native="true">
<property name="minimumSize">
<size>
<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 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>
<width>40</width>
<height>20</height>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancel_button">
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<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">
<string>Cancel</string>
<string>&amp;Vehicles</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ok_button">
<zorder>label</zorder>
<zorder>rb_ordnance</zorder>
<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">
<string>&amp;OK</string>
<string>&amp;Cards:</string>
</property>
<property name="default">
<bool>true</bool>
<property name="buddy">
<cstring>lb_cards</cstring>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>53</width>
<height>20</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>&amp;Cards:</string>
</property>
<property name="buddy">
<cstring>lb_cards</cstring>
</property>
</widget>
<widget class="QListWidget" name="lb_cards">
<property name="geometry">
<rect>
<x>9</x>
<y>71</y>
<width>362</width>
<height>211</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QListWidget" name="lb_cards">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_3" native="true">
<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_2">
<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>
<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>
<tabstops>
<tabstop>lb_cards</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>566</width>
<height>399</height>
<width>592</width>
<height>418</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@ -83,6 +83,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<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>
</property>
@ -95,8 +101,30 @@
</widget>
</item>
<item>
<widget class="QWidget" name="widget_5" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<widget class="QLabel" name="label_5">
<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">
<number>2</number>
</property>
@ -104,7 +132,7 @@
<number>0</number>
</property>
<property name="topMargin">
<number>8</number>
<number>5</number>
</property>
<property name="rightMargin">
<number>0</number>
@ -122,6 +150,67 @@
</property>
</widget>
</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>
<widget class="QWidget" name="widget_6" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
@ -272,9 +361,9 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="spacing">
<number>2</number>
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
@ -288,42 +377,97 @@
<property name="bottomMargin">
<number>0</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">
<item alignment="Qt::AlignTop">
<widget class="QLabel" name="lbl_progress">
<property name="minimumSize">
<size>
<width>0</width>
<height>15</height>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="value">
<number>24</number>
<property name="styleSheet">
<string notr="true">margin:0 5px 5px 0;</string>
</property>
<property name="textVisible">
<bool>false</bool>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QPushButton" name="btn_cancel_analyze">
<property name="text">
<string>&amp;Cancel</string>
<string/>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</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>
</widget>
</item>
@ -387,6 +531,12 @@
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>If you have already analyzed the PDF files, open the &amp;database:</string>
</property>
@ -454,6 +604,9 @@
<italic>true</italic>
</font>
</property>
<property name="styleSheet">
<string notr="true">color:#444 ;</string>
</property>
<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>
</property>
@ -507,6 +660,7 @@
<tabstop>btn_cancel_analyze</tabstop>
<tabstop>le_load_db_fname</tabstop>
<tabstop>btn_load_db_fname</tabstop>
<tabstop>btn_load_db</tabstop>
</tabstops>
<resources/>
<connections/>

Loading…
Cancel
Save