Skip to content

Commit

Permalink
Merge pull request #139 from Linkid/bump/fretwork
Browse files Browse the repository at this point in the history
Update the fretwork lib to the version 0.3.0
  • Loading branch information
Linkid committed Jan 18, 2018
2 parents 7f0adfa + ce5bf91 commit 58f6672
Show file tree
Hide file tree
Showing 39 changed files with 278 additions and 183 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Expand Up @@ -13,6 +13,8 @@ matrix:
- env:
- GIT_COMMIT=0
before_install:
- LD_LIBRARY_PATH=/usr/local/lib64/:$LD_LIBRARY_PATH
- export LD_LIBRARY_PATH
- sudo apt-get -qq update
- sudo apt-get install -y
libogg-dev
Expand All @@ -27,6 +29,11 @@ matrix:
libvorbis-dev
mesa-utils
portaudio19-dev
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- LD_LIBRARY_PATH=/usr/local/lib64/:$LD_LIBRARY_PATH
- export LD_LIBRARY_PATH
- sudo apt-get -q update
- sudo apt-get install -y gcc-4.9 g++-4.9

install:
- pip install pytest
Expand Down
26 changes: 14 additions & 12 deletions FoFiX.py
Expand Up @@ -36,6 +36,8 @@
import platform
import subprocess
import atexit
import logging


def run_command(command):
command = command.split(' ')
Expand Down Expand Up @@ -120,14 +122,15 @@ def cmd_args():
if os.name == "posix":
# Under MacOS X, put the logs in ~/Library/Logs
if os.uname()[0] == "Darwin":
logFile = open(os.path.expanduser('~/Library/Logs/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME), 'w')
logfile = os.path.expanduser('~/Library/Logs/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME)
else: # GNU/Linux et al.
logFile = VFS.open('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME, 'w')
logfile = VFS.resolveWrite('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME)
else:
logFile = VFS.open('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME, 'w')
log.setLogfile(logFile)
logfile = VFS.resolveWrite('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME)
log.configure(logfile)
logger = logging.getLogger(__name__)

fretworkRequired = (0, 2, 0)
fretworkRequired = (0, 3, 0)
reqVerStr = '.'.join([str(i) for i in fretworkRequired])
fretworkErrorStr = '''
Expand Down Expand Up @@ -220,7 +223,7 @@ def load_config(configPath):
return config

def restart(self):
log.notice("Restarting.")
logger.info("Restarting.")
self.engine.audio.close()
self.restartRequested = True

Expand All @@ -233,7 +236,7 @@ def run(self):
try:
vidPlayer = VideoLayer(self.engine, vidSource, cancellable=True)
except (IOError, VideoPlayerError):
log.error("Error loading intro video:")
logger.error("Error loading intro video:")
else:
vidPlayer.play()
self.engine.view.pushLayer(vidPlayer)
Expand All @@ -253,7 +256,7 @@ def run(self):
while self.engine.run():
pass
except KeyboardInterrupt:
log.notice("Left mainloop due to KeyboardInterrupt.")
logger.info("Left mainloop due to KeyboardInterrupt.")
# don't reraise

# Restart the program if the engine is asking that we do so.
Expand All @@ -276,8 +279,8 @@ def run(self):
except (KeyboardInterrupt, SystemExit):
raise
except Exception:
log.error("Terminating due to unhandled exception: ")
_logname = os.path.abspath(log.logFile.name)
logger.error("Terminating due to unhandled exception: ")
_logname = os.path.abspath(logfile)
_errmsg = "%s\n\n%s\n%s\n%s\n%s" % (
_("Terminating due to unhandled exception:"),
traceback.format_exc(),
Expand All @@ -290,10 +293,9 @@ def run(self):
import win32api
import win32con
if win32api.MessageBox(0, "%s\n\n%s" % (_errmsg, _("Open the logfile now?")), "%s %s" % (Version.PROGRAM_NAME, Version.version()), win32con.MB_YESNO|win32con.MB_ICONSTOP) == win32con.IDYES:
log.logFile.close()
os.startfile(_logname)
if hasattr(sys, 'frozen'):
sys.exit(1) # don't reraise if py2exe'd so the "Errors occurred" box won't appear after this and confuse the user as to which logfile we actually want
else:
print >>sys.stderr, _errmsg
logger.error(_errmsg)
raise
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -36,7 +36,6 @@ OS-specific dependencies:
- Only 32bit Python is supported
- [pyWin32](https://sourceforge.net/projects/pywin32/files/pywin32/)
- [win32 dependency pack](https://www.dropbox.com/s/p8xv4pktq670q9i/fofix-win32-deppack-20130304-updated.zip?dl=0) (to unzip into the `win32` directory)
- fretwork - `pip install https://github.com/fofix/fretwork/releases/download/0.2.0/fretwork-0.2.0-cp27-none-win32.whl`

- Unix:
- a C++ compiler
Expand Down
1 change: 0 additions & 1 deletion doc/source/quickstart/installation.rst
Expand Up @@ -36,7 +36,6 @@ Windows
Install the following dependencies:
- `pyWin32 <https://sourceforge.net/projects/pywin32/files/pywin32/>`_
- `win32 dependency pack <https://www.dropbox.com/s/p8xv4pktq670q9i/fofix-win32-deppack-20130304-updated.zip?dl=0>`_ (to unzip into the ``win32`` directory)
- fretwork - ``pip install https://github.com/fofix/fretwork/releases/download/0.2.0/fretwork-0.2.0-cp27-none-win32.whl``


Unix
Expand Down
8 changes: 5 additions & 3 deletions fofix/core/Config.py
@@ -1,5 +1,5 @@
#####################################################################
# -*- coding: iso-8859-1 -*- #
# -*- coding: utf-8 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyöstilä #
Expand All @@ -23,15 +23,17 @@
# MA 02110-1301, USA. #
#####################################################################

import logging
import os
import StringIO
from ConfigParser import RawConfigParser

from fretwork import log
from fretwork.unicode import utf8, unicodify

from fofix.core import VFS


log = logging.getLogger(__name__)
config = None
prototype = {}

Expand Down Expand Up @@ -148,7 +150,7 @@ def _convertValue(value, type, default=False):
else:
try:
return type(value)
except:
except Exception:
return None

class Config(object):
Expand Down
13 changes: 8 additions & 5 deletions fofix/core/Data.py
Expand Up @@ -23,20 +23,23 @@
# MA 02110-1301, USA. #
#####################################################################

import logging
import os
import glob
import random

from fretwork import log
from fretwork.audio import Sound

from fofix.core.Font import Font
from fofix.core.Image import ImgDrawing

from fofix.core import Config
from fofix.core import Version
from fofix.core import Player


log = logging.getLogger(__name__)


# these constants define a few customized letters in the default font
# MFH - with the new simplified Font.py, no more custom glyphs... let's do
# a simple replacement here for now...
Expand Down Expand Up @@ -440,9 +443,9 @@ def getImgDrawing(self, fileName, openImage=True):
fileName1 = os.path.join(dataPath, fileName)
if self.logLoadings == 1:
if openImage:
log.notice("Trying to load image: %s" % fileName1)
log.info("Trying to load image: %s" % fileName1)
else:
log.notice("Checking image: %s" % fileName1)
log.info("Checking image: %s" % fileName1)
# check if fileName1 exists (has extension)
if os.path.exists(fileName1):
if openImage:
Expand All @@ -458,7 +461,7 @@ def getImgDrawing(self, fileName, openImage=True):
else:
# find extension
fileName1 = os.path.splitext(fileName1)[0]

# glob parses [] but those are legal chars on Windows, so we must escape them.
# it must be done like this so replacements are not mangled
# by other replacements.
Expand Down
22 changes: 11 additions & 11 deletions fofix/core/GameEngine.py
@@ -1,5 +1,5 @@
#####################################################################
# -*- coding: iso-8859-1 -*- #
# -*- coding: utf-8 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Ky?stil? #
Expand Down Expand Up @@ -37,15 +37,14 @@
import os
import sys
import imp
import logging

from fretwork import log
from fretwork.audio import Audio
from fretwork.task import TaskEngine
from fretwork.timer import FpsTimer

from fofix.core.constants import *
from fofix.core.Video import Video

from fofix.core.View import View
from fofix.core.Input import Input, KeyListener, SystemEventListener
from fofix.core.Resource import Resource
Expand All @@ -55,18 +54,19 @@
from fofix.core.Theme import Theme
from fofix.core.Shader import shaders
from fofix.core.Image import drawImage

from fofix.core import cmgl
from fofix.core import Config
from fofix.core import ConfigDefs
from fofix.core import Version
from fofix.core import Player
from fofix.core import Mod
from fofix.game import Dialogs

from fofix.game.World import World
from fofix.game.Debug import DebugLayer


log = logging.getLogger(__name__)

# evilynux - Grab name and version from Version class.
version = "%s v%s" % ( Version.PROGRAM_NAME, Version.version() )

Expand Down Expand Up @@ -264,7 +264,7 @@ def __init__(self, config = None):
# GNU/Linux) as the Viewport was not set yet.
try:
viewport = glGetIntegerv(GL_VIEWPORT)
except:
except Exception:
viewport = [0, 0, width, height]
h = viewport[3] - viewport[1]
w = viewport[2] - viewport[0]
Expand Down Expand Up @@ -329,7 +329,7 @@ def _initTheme(self, themename, themepath):
:type themepath: str
"""

log.notice( 'Setting theme %s from "%s"' % (themename,themepath) )
log.info('Setting theme %s from "%s"' % (themename,themepath))

self.theme = None
try:
Expand All @@ -339,20 +339,20 @@ def _initTheme(self, themename, themepath):
# Found it! Load it.
theme = imp.load_module("CustomTheme", fp, pathname, description)
self.theme = theme.CustomTheme(themepath, themename)
log.notice('Theme activated using custom class "%s"' % pathname)
log.info('Theme activated using custom class "%s"' % pathname)
except ImportError as e:
# Unable to load module; log it, but continue with default Theme.
log.error('Failed to load CustomTheme.py from "%s"' % pathname)
finally:
fp.close()
except ImportError:
# CustomTheme.py file is optional, but notify developer anyway.
log.notice("No CustomTheme.py found in theme")
log.info("No CustomTheme.py found in theme")
pass

if self.theme is None:
self.theme = Theme(themepath, themename)
log.notice("Theme activated using built-in Theme class")
log.info("Theme activated using built-in Theme class")
self.task.addTask(self.theme)

def _initStages(self):
Expand Down Expand Up @@ -481,7 +481,7 @@ def startWorld(self, players, maxplayers = None, gameMode = 0, multiMode = 0, al

def finishGame(self):
if not self.world:
log.notice("GameEngine.finishGame called before World created.")
log.info("GameEngine.finishGame called before World created.")
return
self.world.finishGame()
self.world = None
Expand Down
9 changes: 6 additions & 3 deletions fofix/core/Image.py
@@ -1,5 +1,5 @@
#####################################################################
# -*- coding: iso-8859-1 -*- #
# -*- coding: utf-8 -*- #
# #
# Frets on Fire X #
# Copyright (C) 2006 Sami Kyöstilä #
Expand All @@ -21,18 +21,21 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, #
# MA 02110-1301, USA. #
#####################################################################

from __future__ import with_statement
import logging

import numpy as np
from PIL import Image
from OpenGL.GL import *

from fretwork import log

from fofix.core.Texture import Texture
from fofix.core.constants import *
from fofix.core import cmgl


log = logging.getLogger(__name__)

#stump: the last few stubs of DummyAmanith.py are inlined here since this
# is the only place in the whole program that uses it now that we've pruned
# the dead SVG code.
Expand Down
13 changes: 10 additions & 3 deletions fofix/core/Input.py
@@ -1,5 +1,5 @@
#####################################################################
# -*- coding: iso-8859-1 -*- #
# -*- coding: utf-8 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyöstilä #
Expand All @@ -22,8 +22,11 @@
# MA 02110-1301, USA. #
#####################################################################

import logging
import pygame


log = logging.getLogger(__name__)
haveMidi = False

try:
Expand All @@ -32,14 +35,14 @@
except ImportError:
haveMidi = False

from fretwork import log
from fretwork.audio import Music
from fretwork.task import Task

from fofix.core.Player import Controls
from fofix.core import Player
from fofix.core import Config


class KeyListener(object):
def keyPressed(self, key, unicode):
pass
Expand All @@ -53,6 +56,7 @@ def lostFocus(self):
def exitRequested(self):
pass


class MouseListener(object):
def mouseButtonPressed(self, button, pos):
pass
Expand All @@ -63,6 +67,7 @@ def mouseButtonReleased(self, button, pos):
def mouseMoved(self, pos, rel):
pass


class SystemEventListener(object):
def screenResized(self, size):
pass
Expand All @@ -76,8 +81,10 @@ def musicFinished(self):
def quit(self):
pass


MusicFinished = pygame.USEREVENT


class Input(Task):
def __init__(self):

Expand Down Expand Up @@ -142,7 +149,7 @@ def __init__(self):
if len(self.midi) == 0:
log.debug("No MIDI input ports found.")
else:
log.notice("MIDI input support is not available; install at least pygame 1.9 to get it.")
log.info("MIDI input support is not available; install at least pygame 1.9 to get it.")

def showMouse(self):
pygame.mouse.set_visible(True)
Expand Down

0 comments on commit 58f6672

Please sign in to comment.