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> Main application for justCheckers
#
# justCheckers is free software: you can redistribute it and/or modify it :copyright: Copyright 2004-2017, Dorian Pula <dorian.pula@amber-penguin-software.ca>
# under the terms of the GNU General Public License as published by the :license: GPL v3+
# 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!
#
import logging import logging
import os import os
import sys import sys
from PySide import QtGui from kivy.app import App
from kivy.logger import Logger
import justcheckers import justcheckers
from justcheckers.ui.window import DesktopGameWindow
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
def main(): class JustCheckersApp(App):
"""Main entry point into the app.""" def on_start(self):
app = QtGui.QApplication(sys.argv)
log_system_and_game_info() log_system_and_game_info()
view = DesktopGameWindow() super(JustCheckersApp, self).on_start()
view.show()
app.exec_()
sys.exit()
def log_system_and_game_info(): def log_system_and_game_info():
"""Logs information about the game and system running the game.""" """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}' 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 os_sys = sys.platform
if sys.platform == 'posix': if sys.platform == 'posix':
os_name, _, _, _, os_arch = os.uname() os_name, _, _, _, os_arch = os.uname()
os_sys = '{name} {arch}'.format(name=os_name, arch=os_arch) 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__': if __name__ == '__main__':
main() JustCheckersApp().run()

View File

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