diff --git a/justcheckers/app.py b/justcheckers/app.py index 2293ce3..0e538cd 100644 --- a/justcheckers/app.py +++ b/justcheckers/app.py @@ -1,59 +1,43 @@ -# -# Copyright (c) 2014 Dorian Pula -# -# justCheckers is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, -# or (at your option) any later version. -# -# justCheckers is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with justCheckers. If not, see . -# -# Please share and enjoy! -# +""" +Main application for justCheckers + +:copyright: Copyright 2004-2017, Dorian Pula +:license: GPL v3+ +""" import logging import os import sys -from PySide import QtGui +from kivy.app import App +from kivy.logger import Logger import justcheckers -from justcheckers.ui.window import DesktopGameWindow LOG = logging.getLogger(__name__) -def main(): - """Main entry point into the app.""" - app = QtGui.QApplication(sys.argv) - log_system_and_game_info() - view = DesktopGameWindow() - view.show() - app.exec_() - sys.exit() +class JustCheckersApp(App): + def on_start(self): + log_system_and_game_info() + super(JustCheckersApp, self).on_start() def log_system_and_game_info(): """Logs information about the game and system running the game.""" - LOG.info('justCheckers -- v{}'.format(justcheckers.__version__)) + Logger.info('justCheckers -- v{}'.format(justcheckers.__version__)) message = 'I am running on {os}.\nMy screen is {height}x{width}' - geometry = QtGui.QDesktopWidget().availableGeometry() + root_window = App.get_running_app().root_window os_sys = sys.platform if sys.platform == 'posix': os_name, _, _, _, os_arch = os.uname() os_sys = '{name} {arch}'.format(name=os_name, arch=os_arch) - LOG.info(message.format(os=os_sys, height=geometry.height(), width=geometry.width())) + Logger.info(message.format(os=os_sys, height=root_window.height, width=root_window.width)) if __name__ == '__main__': - main() + JustCheckersApp().run() diff --git a/justcheckers/justcheckers.kv b/justcheckers/justcheckers.kv new file mode 100644 index 0000000..7c89443 --- /dev/null +++ b/justcheckers/justcheckers.kv @@ -0,0 +1,5 @@ +#: import justcheckers justcheckers + +BoxLayout: + Label: + text: "justCheckers {}".format(justcheckers.__version__)