Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
900supersport committed Nov 3, 2013
1 parent d1c966a commit 178b946
Show file tree
Hide file tree
Showing 15 changed files with 2,637 additions and 0 deletions.
89 changes: 89 additions & 0 deletions FreakTabKitchen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/python
#
# FreakTabKitchen www.freaktab.com
#
# Copyright 2013 Brian Mahoney brian@mahoneybrian.wanadoo.co.uk
#
###########################################################################
#
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
#
###########################################################################


#python imports
import sys
import logging

#900supersport imports
import KitchenConfig
import rominfo

from utils import CheckMakeFolders, GetCWD, logerror
from rkmainmenu import rkmainmenu

# try:
#
# except Exception as e:
# logerror('FreakTabKitchen::mountsystem ',e,1)


def StartKitchen():
'''Set basic config and logging options, reads complete config and start the kitchen
The actual Kitchen Config and if present the rominfo in the current workspace will be read, required folders as per config will be created, and then the rkmainmenu will be displayed.
'''
logmode = logging.INFO
writemode = 'a'
filename = 'kitchen.log'

for arg in sys.argv:
if arg == 'debug':
logmode = logging.DEBUG
elif arg == 'overwrite':
writemode = 'w'


logging.basicConfig(filename= filename,
filemode=writemode,
format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
datefmt='%H:%M:%S',
level=logmode)


try:
logging.info('====================================================================================')
logging.info('Start FreakKitchen')
logging.info(sys.version)

kc = KitchenConfig.KitchenConfig
kc()
kc.cwd = GetCWD()

ri = rominfo.rominfo
ri(KitchenConfig.KitchenConfig.ROMInfoLoc())

CheckMakeFolders(kc.KitchenFolders())

rkmainmenu()
kc.Pickle()
ri.Pickle()
except Exception as e:
logerror('FreakTabKitchen::StartKitchen ',e,1)
finally:
print 'Thankyou for using 900supersport''s FreakTab RK Kitchen'

StartKitchen()

142 changes: 142 additions & 0 deletions KitchenConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/usr/bin/python
#
#
# FreakTabKitchen www.freaktab.com
#
# Copyright 2013 Brian Mahoney brian@mahoneybrian.wanadoo.co.uk
#
############################################################################
#
# FreakTabKitchen 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.
#
# FreakTabKitchen 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 FreakTabKitchen. If not, see <http://www.gnu.org/licenses/>.
#
############################################################################

import os
import logging


import rominfo
from utils import QueryPickleLoad, PickleIt

# try:
#
# except Exception as e:
# logging.error('KitchenConfig::mountsystem ' )
# logging.error(e)
# raise

class KitchenConfig:
'''encapsulate info re the ROM'''
KitchenPath = ''
KitchenConfigFile = ''
initialised = 0
cwd =''

editor = 'gedit'
browser = 'nautilus'
pwidth = 70
maxsystemsize = 0
minsystemsize = 0
defaultsystemsize = 576716800

def __init__(self):
'''initialise Kithchen Config
'''

logging.debug('Initialising KitchenConfig')
try:
KitchenConfig.KitchenPath = os.path.dirname( os.path.abspath(__file__))
KitchenConfig.KitchenConfigFile = os.path.join(KitchenConfig.KitchenPath,'Kitchen.config')

#test here to prevent reentry
if KitchenConfig.initialised == 0:
#prevent re-entry
KitchenConfig.initialised = 1

logging.debug('attemp to pickleload')

#attempt to load a saved config
reader = KitchenConfig()
reader = QueryPickleLoad(reader, reader.KitchenConfigFile)

logging.debug('attemp to pickleload completed')

#copy values back from the reader
KitchenConfig.editor = reader.editor
KitchenConfig.browser = reader.browser
KitchenConfig.pwidth = reader.pwidth
KitchenConfig.maxsystemsize = reader.maxsystemsize
KitchenConfig.minsystemsize = reader.minsystemsize
KitchenConfig.defaultsystemsize = reader.defaultsystemsize

#copy values into self for pickle useage
self.editor = KitchenConfig.editor
self.browser = KitchenConfig.browser
self.pwidth = KitchenConfig.pwidth
self.maxsystemsize = KitchenConfig.maxsystemsize
self.minsystemsize = KitchenConfig.minsystemsize
self.defaultsystemsize = KitchenConfig.defaultsystemsize

except Exception as e:
logging.error('KitchenConfig::__init__ ' )
logging.error(e)
raise

#Static methods
@staticmethod
def KitchenFolders():
'''static list of required folders for kitchen
'''

folders = [ 'localdeploy'
,'working/mntsystem'
,'working/mntsystem_ext4'
,'working/boot'
,'working/brand'
,'working/removed'
,'KitchenPrivate'
,'read'
]
return folders


@staticmethod
def ROMInfoLoc():
'''static location of rominfo file
'''
return 'KitchenPrivate/ROMInfo.rtb'


@staticmethod
def SourceROMLoc():
'''static location of source ROM
'''
return os.path.join('sources',rominfo.rominfo.romname)


@staticmethod
def SourceROMUnpackedLoc():
'''static location of unpacked source ROM
'''
return os.path.join(KitchenConfig.SourceROMLoc(),'unpacked')


@staticmethod
def Pickle():
'''static pickle the KitchenConfig
'''
reader = KitchenConfig()
PickleIt(reader, KitchenConfig.KitchenConfigFile)

19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,22 @@ rkKitchen
=========

900supersport's FreakTab RK ROM Kitchen

FreakTabKitchen www.freaktab.com

Copyright 2013 Brian Mahoney brian@mahoneybrian.wanadoo.co.uk
=============================================================
This program 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.

This program 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 this program. If not, see <http://www.gnu.org/licenses/>.


Loading

0 comments on commit 178b946

Please sign in to comment.