diff --git a/about_widget.py b/about_widget.py new file mode 100644 index 0000000..4177039 --- /dev/null +++ b/about_widget.py @@ -0,0 +1,41 @@ +import os + +from PyQt5 import uic +from PyQt5.QtWidgets import QDialog , QFrame +from PyQt5.QtGui import QPixmap + +from constants import * +import globals + +# --------------------------------------------------------------------- + +class AboutWidget( QDialog ) : + """Show an About box.""" + + def __init__( self , parent ) : + # initialize + super().__init__() + # initialize the widget + uic.loadUi( os.path.join(globals.base_dir,"ui/about_widget.ui") , self ) + self.setMinimumSize( self.size() ) + self.lbl_app_icon.setPixmap( + QPixmap( os.path.join( globals.base_dir , "resources/app.ico" ) ) + ) + self.lbl_app_icon.setFrameStyle( QFrame.NoFrame ) + self.lbl_app_name.setText( " {} ({}) ".format( APP_NAME , APP_VERSION ) ) + self.lbl_avatar.setPixmap( + QPixmap( os.path.join( globals.base_dir , "resources/pacman-ghost.png" ) ) \ + .scaled( self.lbl_avatar.size() ) + ) + self.lbl_avatar.setFrameStyle( QFrame.NoFrame ) + # load the dialog + try : + with open( os.path.join( globals.base_dir , "license.txt" ) , "r" ) as fp : + buf = fp.read() + except Exception as ex : + buf = str(ex) + self.lbl_license.setText( buf ) + self.lbl_license.setFrameStyle( QFrame.NoFrame ) + # connect our handlers + self.btn_ok.clicked.connect( self.close ) + diff --git a/license.txt b/license.txt new file mode 100755 index 0000000..ecd508b --- /dev/null +++ b/license.txt @@ -0,0 +1,11 @@ +This software is provided 'as-is', without any express or implied warranty. + +In no event will the author be held liable for any damages arising from the use of this software. + +Permission is granted to anyone to use this software for any non-commercial purpose and to alter it and redistribute it freely, subject to the following restrictions: + +(*) The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software, an acknowledgment is requested but not required. + +(*) Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. Altered source is encouraged to be submitted back to the original author so it can be shared with the community. Please share your changes. + +(*) This notice may not be removed or altered from any source distribution. \ No newline at end of file diff --git a/main_window.py b/main_window.py index 185b514..ff2a7a0 100644 --- a/main_window.py +++ b/main_window.py @@ -12,6 +12,7 @@ from constants import * import globals from add_card_widget import AddCardWidget from startup_widget import StartupWidget +from about_widget import AboutWidget # --------------------------------------------------------------------- @@ -73,6 +74,11 @@ class MainWindow( QMainWindow ) : action.setStatusTip( "Close the program." ) action.triggered.connect( self.close ) file_menu.addAction( action ) + help_menu = menu_bar.addMenu( "&Help" ) + about_action = QAction( "&About" , self ) + about_action.setStatusTip( "About this program." ) + about_action.triggered.connect( self.on_about ) + help_menu.addAction( about_action ) # restore the window geometry buf = globals.app_settings.value( MAINWINDOW_GEOMETRY ) if buf : @@ -240,3 +246,7 @@ class MainWindow( QMainWindow ) : return self.tab_widget.removeTab( index ) self._update_ui() + + def on_about( self ) : + """Show an About box.""" + AboutWidget( self ).exec_() diff --git a/resources/pacman-ghost.png b/resources/pacman-ghost.png new file mode 100644 index 0000000..4316a7f Binary files /dev/null and b/resources/pacman-ghost.png differ diff --git a/ui/about_widget.ui b/ui/about_widget.ui new file mode 100644 index 0000000..ad3764b --- /dev/null +++ b/ui/about_widget.ui @@ -0,0 +1,183 @@ + + + AboutDialog + + + + 0 + 0 + 508 + 434 + + + + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + + + 0 + 0 + 50 + 50 + + + + QFrame::Box + + + + + + + + + 60 + 0 + 281 + 21 + + + + + 16 + + + + *** APP NAME *** + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + 60 + 26 + 121 + 21 + + + + + 8 + true + + + + <html> written by <i>Pacman Ghost</i> </html> + + + + + + 180 + 25 + 21 + 21 + + + + QFrame::Box + + + + + + + + + + + + 0 + 0 + + + + <html> Source code is available <a href="https://github.com/pacman-ghost/asl_cards">here</a>. </html> + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse + + + + + + + + 0 + 0 + + + + <html> Released under an MIT-like license: </html> + + + + + + + 20 + + + + + + 0 + 100 + + + + + 9 + true + + + + QFrame::Box + + + *** LICENSE *** + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + + OK + + + true + + + + + + + +