diff --git a/add_card_widget.py b/add_card_widget.py index 8943cd3..d1a2bf1 100644 --- a/add_card_widget.py +++ b/add_card_widget.py @@ -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() ) diff --git a/main_window.py b/main_window.py index 5176673..9a54910 100644 --- a/main_window.py +++ b/main_window.py @@ -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 ) diff --git a/resources/progress.gif b/resources/progress.gif new file mode 100755 index 0000000..dedab49 Binary files /dev/null and b/resources/progress.gif differ diff --git a/startup_widget.py b/startup_widget.py index df03a34..2ffebd8 100644 --- a/startup_widget.py +++ b/startup_widget.py @@ -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 ) ) diff --git a/ui/add_card_widget.ui b/ui/add_card_widget.ui index acb1810..1eb2fbf 100644 --- a/ui/add_card_widget.ui +++ b/ui/add_card_widget.ui @@ -6,171 +6,239 @@ 0 0 - 380 - 336 + 450 + 300 - - - - -1 - 9 - 301 - 55 - + + + 2 - - - 0 - 0 - + + 8 - - - 16777215 - 55 - + + 8 - - - - 10 - 10 - 81 - 21 - - - - &Nationality: - - - cbo_nationality - - - - - - 170 - 30 - 91 - 26 - - - - Or&dnance - - - - - - 90 - 10 - 131 - 21 - - - - - - - 90 - 30 - 81 - 26 - - - - &Vehicles - - - - - - - 10 - 280 - 361 - 46 - + + 8 - - - 0 - 0 - + + 8 - - - - - Qt::Horizontal + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + 290 + 0 + 89 + 26 + - + + Or&dnance + + + + + + 80 + 0 + 120 + 28 + + + + + 0 + 0 + + + - 40 - 20 + 120 + 0 + + + + + 120 + 16777215 - - - - + + + + + 0 + -1 + 75 + 31 + + + + &Nationality: + + + cbo_nationality + + + + + + 210 + 0 + 79 + 26 + + - Cancel + &Vehicles - - - + label + rb_ordnance + cbo_nationality + label + rb_vehicles + + + + + + + 0 + 20 + + + + + 16777215 + 20 + + + + + + 0 + 0 + 51 + 19 + + + + + 16777215 + 20 + + - &OK + &Cards: - - true + + lb_cards - - - - - - - 10 - 50 - 53 - 20 - - - - - 16777215 - 20 - - - - &Cards: - - - lb_cards - - - - - - 9 - 71 - 362 - 211 - - - - - 0 - 0 - - - + + + + + + + 0 + 0 + + + + + 0 + 100 + + + + + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + 2 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + &OK + + + true + + + + + + + + + lb_cards + diff --git a/ui/startup_widget.ui b/ui/startup_widget.ui index 86f3e72..b74cec4 100644 --- a/ui/startup_widget.ui +++ b/ui/startup_widget.ui @@ -6,8 +6,8 @@ 0 0 - 566 - 399 + 592 + 418 @@ -83,6 +83,12 @@ 0 + + + 75 + true + + 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. @@ -95,8 +101,30 @@ - - + + + + 8 + true + + + + color:#444 ; + + + <html>This needs <a href="https://ghostscript.com">Ghostscript</a> to be installed.</html> + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse + + + + + + 2 @@ -104,7 +132,7 @@ 0 - 8 + 5 0 @@ -122,6 +150,67 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 8 + 50 + true + false + + + + color:#444 ; + + + These PDF files can be obtained <a href="http://aslcards.com">here</a>. + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse + + + + + + + + + + + 2 + + + 0 + + + 0 + + + 0 + + + 0 + @@ -272,9 +361,9 @@ QFrame::Raised - + - 2 + 0 0 @@ -288,42 +377,97 @@ 0 - - - - 24 - - - - - + + - 0 - 15 + 50 + 50 - 16777215 - 15 + 50 + 50 - - 24 + + margin:0 5px 5px 0; - - false + + QFrame::Box - - - - - &Cancel + + + + 0 + + + + 2 + + + + + 24 + + + + + + + + 0 + 15 + + + + + 16777215 + 15 + + + + 24 + + + false + + + + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Cancel + + + + + + + @@ -387,6 +531,12 @@ + + + 75 + true + + If you have already analyzed the PDF files, open the &database: @@ -454,6 +604,9 @@ true + + color:#444 ; + Put the database in the same directory as this program, and it will be loaded automatically, or add a "--db ..." parameter to the command-line arguments. @@ -507,6 +660,7 @@ btn_cancel_analyze le_load_db_fname btn_load_db_fname + btn_load_db