Quick rough setup of justCheckers as a Kivy app.

This commit is contained in:
Dorian 2017-02-22 09:27:13 -05:00
parent 35742760b3
commit e5dae0520d
2 changed files with 21 additions and 32 deletions

View File

@ -1,59 +1,43 @@
#
# Copyright (c) 2014 Dorian Pula <dorian.pula@amber-penguin-software.ca>
#
# 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 <http://www.gnu.org/licenses/>.
#
# Please share and enjoy!
#
"""
Main application for justCheckers
:copyright: Copyright 2004-2017, Dorian Pula <dorian.pula@amber-penguin-software.ca>
: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()

View File

@ -0,0 +1,5 @@
#: import justcheckers justcheckers
BoxLayout:
Label:
text: "justCheckers {}".format(justcheckers.__version__)