pymoul-svn Mailing List for pyMoul (Page 10)
Status: Alpha
Brought to you by:
tiran
You can subscribe to this list here.
2007 |
Jan
(89) |
Feb
(108) |
Mar
(62) |
Apr
(8) |
May
(9) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <ti...@us...> - 2007-01-25 13:50:47
|
Revision: 74 http://pymoul.svn.sourceforge.net/pymoul/?rev=74&view=rev Author: tiran Date: 2007-01-25 05:50:46 -0800 (Thu, 25 Jan 2007) Log Message: ----------- Logging improvements: Now logs to a file, too Modified Paths: -------------- pymoul/trunk/src/moul/config/__init__.py pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/log.py pymoul/trunk/src/moul/osdependent/darwin/__init__.py pymoul/trunk/src/moul/osdependent/linux/__init__.py pymoul/trunk/src/moul/osdependent/win32/__init__.py Modified: pymoul/trunk/src/moul/config/__init__.py =================================================================== --- pymoul/trunk/src/moul/config/__init__.py 2007-01-25 04:05:27 UTC (rev 73) +++ pymoul/trunk/src/moul/config/__init__.py 2007-01-25 13:50:46 UTC (rev 74) @@ -39,30 +39,48 @@ if __WIN32__: from moul.osdependent.win32 import ( getMoulUserDataDir, - getPyMoulIniDir, + getPyMoulDataDir as _getPyMoulDataDir, _startMOUL, EXEC_NAME ) elif __LINUX__: from moul.osdependent.linux import ( getMoulUserDataDir, - getPyMoulIniDir, + getPyMoulDataDir as _getPyMoulDataDir, _startMOUL, EXEC_NAME ) elif __MACOSX__: from moul.osdependent.darwin import ( getMoulUserDataDir, - getPyMoulIniDir, + getPyMoulDataDir as _getPyMoulDataDir, _startMOUL, EXEC_NAME ) else: raise RuntimeError('platform %s not supported' % sys.platform) +def getPyMoulDataDir(check=False): + """Get pyMoul data directory + + The directory contains log files, ini files and other local stuff + """ + datadir = _getPyMoulDataDir() + if check: + if os.path.abspath(datadir) != datadir: + raise ValueError("Datadir is not absolute %s" % datadir) + if not os.path.isdir(datadir): + parent = os.path.abspath(os.path.join(datadir, os.pardir)) + if not os.path.isdir(parent): + raise ValueError("Datadir's parent dir does not exist: %s" + % par) + else: + LOG.debug("Creating pyMoul data dir %s" % datadir) + os.mkdir(datadir, 0750) + LOG.debug("Using pyMoul data dir %s" % datadir) + return datadir + ## configuration - - class Configuration(dict): def __new__(cls, *args, **kwargs): self = dict.__new__(cls, *args, **kwargs) @@ -161,8 +179,8 @@ def getMoulUserDataDir(self): return getMoulUserDataDir() - def getPyMoulIniDir(self): - return getPyMoulIniDir() + def getPyMoulDataDir(self): + return getPyMoulDataDir() def lookupDir(self, name): """Lookup MOUL directory @@ -174,7 +192,7 @@ path = path.replace('/', os.sep) map = {'installdir' : self.getMoulInstallDir(), 'datadir' : self.getMoulUserDataDir(), - 'pymouldir' : self.getPyMoulIniDir(), + 'pymouldir' : self.getPyMoulDataDir(), } fullpath = path % map #self._cache[name] = fullpath Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-01-25 04:05:27 UTC (rev 73) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-01-25 13:50:46 UTC (rev 74) @@ -335,6 +335,8 @@ """ if self._fpath is not None: raise ValueError("File already open") + if not os.path.isdir(path): + raise OSError("Directory not found %s" % path) self._fpath = os.path.join(path, self._filename) self.parseEncFile(self._fpath) Modified: pymoul/trunk/src/moul/log.py =================================================================== --- pymoul/trunk/src/moul/log.py 2007-01-25 04:05:27 UTC (rev 73) +++ pymoul/trunk/src/moul/log.py 2007-01-25 13:50:46 UTC (rev 74) @@ -24,27 +24,65 @@ __all__ = ['LOG', 'getLogger', 'signalLogDecorator'] import logging +from logging import Formatter +from logging import handlers import os import sys from moul.metadata import __version__ as moul_version +# alias +getLogger = logging.getLogger + # copied from moul.config to prevent circular imports __FROZEN__ = bool(getattr(sys, 'frozen', False)) __LOG_SIGNALS__ = not __FROZEN__ - if __FROZEN__: level = logging.ERROR else: level = logging.DEBUG -logging.basicConfig(level=level, - format='%(asctime)s %(name)-10s %(levelname)-7s %(message)s', - #datefmt='%a, %d %b %Y %H:%M:%S' - datefmt='%m-%d %H:%M:%S' - ) -LOG = logging.getLogger('pyMoul') -getLogger = logging.getLogger +format = Formatter('%(asctime)s %(name)-8s %(levelname)-7s %(message)s', + #'%a, %d %b %Y %H:%M:%S' + '%m-%d %H:%M:%S') +root = getLogger() +root.setLevel(level) +# Add streaming handler for sys.stderr +shdlr = logging.StreamHandler(sys.stderr) +shdlr.setFormatter(format) +shdlr.setLevel(level) +root.addHandler(shdlr) + +# setup a memory handler to store records before we have the infrastructure +# to log events to a file +mhdlr = handlers.MemoryHandler(capacity=16*1024) # MemoryHandler doesn't flush w/o a target +mhdlr.setFormatter(format) +mhdlr.setLevel(logging.DEBUG) +root.addHandler(mhdlr) + +# DEBUG system infos +LOG = getLogger('pyMoul') +LOG.debug("pyMoul version: %s" % moul_version) +LOG.debug("Python: %s" % repr(sys.version_info)) +LOG.debug("Python: %s" % sys.version.replace('\n', ' ')) +LOG.debug("Platform: %s, OS name: %s" % (sys.platform, os.name)) + +# now get the pymoul userdata dir +from moul.config import getPyMoulDataDir +logFile = os.path.join(getPyMoulDataDir(check=True), 'pymoul.log') +LOG.debug("Adding file logger: %s" % logFile) +fhdlr = handlers.RotatingFileHandler(logFile, backupCount=9) +fhdlr.setFormatter(format) +fhdlr.setLevel(logging.DEBUG) +root.addHandler(fhdlr) +fhdlr.doRollover() + +# flush and remove remove memory handler +mhdlr.setTarget(fhdlr) +mhdlr.flush() +root.removeHandler(mhdlr) +del mhdlr + def signalLogDecorator(__logger__): """Decorator to log signals @@ -65,10 +103,3 @@ else: return func return wrapper - -# DEBUG system infos -LOG.debug("pyMoul version: %s" % moul_version) -LOG.debug("Python: %s" % repr(sys.version_info)) -LOG.debug("Python: %s" % sys.version.replace('\n', ' ')) -LOG.debug("Platform: %s, OS name: %s" % (sys.platform, os.name)) - Modified: pymoul/trunk/src/moul/osdependent/darwin/__init__.py =================================================================== --- pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-01-25 04:05:27 UTC (rev 73) +++ pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-01-25 13:50:46 UTC (rev 74) @@ -37,7 +37,7 @@ """ moul_data = os.path.join(HOME, MOUL_DIR) -def getPyMoulIniDir(): +def getPyMoulDataDir(): """Get path to the pyMoul ini directory """ inidir= os.path.join(HOME, '.pymoul') Modified: pymoul/trunk/src/moul/osdependent/linux/__init__.py =================================================================== --- pymoul/trunk/src/moul/osdependent/linux/__init__.py 2007-01-25 04:05:27 UTC (rev 73) +++ pymoul/trunk/src/moul/osdependent/linux/__init__.py 2007-01-25 13:50:46 UTC (rev 74) @@ -36,9 +36,9 @@ The MOUL data directory contains log files, chatlogs, KI images and many more things. """ - moul_data = os.path.join(HOME, MOUL_DIR) + return os.path.join(HOME, MOUL_DIR) -def getPyMoulIniDir(): +def getPyMoulDataDir(): """Get path to the pyMoul ini directory """ inidir= os.path.join(HOME, '.pymoul') Modified: pymoul/trunk/src/moul/osdependent/win32/__init__.py =================================================================== --- pymoul/trunk/src/moul/osdependent/win32/__init__.py 2007-01-25 04:05:27 UTC (rev 73) +++ pymoul/trunk/src/moul/osdependent/win32/__init__.py 2007-01-25 13:50:46 UTC (rev 74) @@ -41,7 +41,7 @@ moul_data = os.path.join(mydoc, MOUL_DIR) return moul_data -def getPyMoulIniDir(): +def getPyMoulDataDir(): """Get path to the pyMoul ini file """ app_data = get_appdata() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-25 04:05:26
|
Revision: 73 http://pymoul.svn.sourceforge.net/pymoul/?rev=73&view=rev Author: tiran Date: 2007-01-24 20:05:27 -0800 (Wed, 24 Jan 2007) Log Message: ----------- Log some version infos Modified Paths: -------------- pymoul/trunk/INSTALL.txt pymoul/trunk/src/moul/config/__init__.py pymoul/trunk/src/moul/log.py pymoul/trunk/src/moul/qt/__init__.py Modified: pymoul/trunk/INSTALL.txt =================================================================== --- pymoul/trunk/INSTALL.txt 2007-01-24 23:17:08 UTC (rev 72) +++ pymoul/trunk/INSTALL.txt 2007-01-25 04:05:27 UTC (rev 73) @@ -165,7 +165,7 @@ o $ cd QScintilla.../Python o $ python2.5 configure.py o $ make - o $ make install + o $ sudo make install o Adjust permissions Modified: pymoul/trunk/src/moul/config/__init__.py =================================================================== --- pymoul/trunk/src/moul/config/__init__.py 2007-01-24 23:17:08 UTC (rev 72) +++ pymoul/trunk/src/moul/config/__init__.py 2007-01-25 04:05:27 UTC (rev 73) @@ -20,6 +20,8 @@ import os import sys +from moul.log import LOG + # a program under py2exe is sys.frozen __FROZEN__ = bool(getattr(sys, 'frozen', False)) # OS stuff @@ -28,6 +30,10 @@ __MACOSX__ = sys.platform.startswith('darwin') __UNIX__ = __LINUX__ or __MACOSX__ +LOG.debug("sys.frozen status: %s" % __FROZEN__) +LOG.debug("OS detected: win32: %s, Linux: %s, Mac: %s, Un*x: %s" % + (__WIN32__, __LINUX__, __MACOSX__, __UNIX__)) + _marker=object() # XXX: what about cygwin, bsd and others? if __WIN32__: Modified: pymoul/trunk/src/moul/log.py =================================================================== --- pymoul/trunk/src/moul/log.py 2007-01-24 23:17:08 UTC (rev 72) +++ pymoul/trunk/src/moul/log.py 2007-01-25 04:05:27 UTC (rev 73) @@ -24,7 +24,9 @@ __all__ = ['LOG', 'getLogger', 'signalLogDecorator'] import logging +import os import sys +from moul.metadata import __version__ as moul_version # copied from moul.config to prevent circular imports __FROZEN__ = bool(getattr(sys, 'frozen', False)) @@ -36,8 +38,9 @@ level = logging.DEBUG logging.basicConfig(level=level, - format='%(asctime)s %(levelname)-8s %(message)s', - datefmt='%a, %d %b %Y %H:%M:%S' + format='%(asctime)s %(name)-10s %(levelname)-7s %(message)s', + #datefmt='%a, %d %b %Y %H:%M:%S' + datefmt='%m-%d %H:%M:%S' ) LOG = logging.getLogger('pyMoul') getLogger = logging.getLogger @@ -62,3 +65,10 @@ else: return func return wrapper + +# DEBUG system infos +LOG.debug("pyMoul version: %s" % moul_version) +LOG.debug("Python: %s" % repr(sys.version_info)) +LOG.debug("Python: %s" % sys.version.replace('\n', ' ')) +LOG.debug("Platform: %s, OS name: %s" % (sys.platform, os.name)) + Modified: pymoul/trunk/src/moul/qt/__init__.py =================================================================== --- pymoul/trunk/src/moul/qt/__init__.py 2007-01-24 23:17:08 UTC (rev 72) +++ pymoul/trunk/src/moul/qt/__init__.py 2007-01-25 04:05:27 UTC (rev 73) @@ -20,3 +20,11 @@ __author__ = "Christian Heimes" __version__ = "$Id$" __revision__ = "$Revision$" + +import PyQt4.QtCore + +from moul.log import LOG + +# DEBUG system infos +LOG.debug("PyQt: %s" % PyQt4.QtCore.PYQT_VERSION_STR) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-24 23:17:08
|
Revision: 72 http://pymoul.svn.sourceforge.net/pymoul/?rev=72&view=rev Author: tiran Date: 2007-01-24 15:17:08 -0800 (Wed, 24 Jan 2007) Log Message: ----------- Fixed bug in wdys crypt module. It failed when the data was aligned at 8 bytes. First version that actually writes graphics and audio ini Modified Paths: -------------- pymoul/trunk/src/moul/crypt/whatdoyousee.py pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/qt/mainwindow.py Modified: pymoul/trunk/src/moul/crypt/whatdoyousee.py =================================================================== --- pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-01-24 22:11:48 UTC (rev 71) +++ pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-01-24 23:17:08 UTC (rev 72) @@ -32,12 +32,15 @@ from moul.crypt.xtea import xtea_decrypt from moul.crypt.xtea import xtea_encrypt +from moul.log import getLogger HEADER = "whatdoyousee" CROSS_REF = (0x6c0a5452, 0x03827d0f, 0x3a170b92, 0x16db7fc2) CROSS_KEY = struct.pack("<4L", *CROSS_REF) ENDIAN="<" # little endian (not network/big endian) +LOG = getLogger('moul.crypt.whatdoyousee') + def decryptWDYS(fin): """Decrypt whatdoyousee files @@ -54,9 +57,15 @@ out = [] pos = 0 - while fin: + while True: block = fin.read(8) - block = xtea_decrypt(CROSS_KEY, block, endian=ENDIAN) + if not block: + break + try: + block = xtea_decrypt(CROSS_KEY, block, endian=ENDIAN) + except: + LOG.exception("xTEA failure at block %r" % block) + raise if length - pos < 8: out.append(block[:length-pos]) break @@ -91,6 +100,10 @@ if len(block) < 8: block = block + '\0' * (8-len(block)) assert len(block) == 8 - block = xtea_encrypt(CROSS_KEY, block, endian=ENDIAN) + try: + block = xtea_encrypt(CROSS_KEY, block, endian=ENDIAN) + except: + LOG.exception("xTEA failure at block %r" % block) + raise fout.write(block) pos += 8 Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-01-24 22:11:48 UTC (rev 71) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-01-24 23:17:08 UTC (rev 72) @@ -168,7 +168,7 @@ def __init__(self, *args, **kwargs): pass - def __call__(self, value): + def __call__(self, value, debug="unknown"): return value class MinMax(Constrain): @@ -197,13 +197,13 @@ self._min = min self._max = max - def __call__(self, value): + def __call__(self, value, debug="unknown"): if not isinstance(value, (int, float)): - raise ConstrainError(type(value)) + raise ConstrainError("%s: %s" % (debug,type(value))) if value < self._min: - raise ConstrainError("%s < min %s" % (value, self._min)) + raise ConstrainError("%s: %s < min %s" % (debug, value, self._min)) if value > self._max: - raise ConstrainError("%s > max %s" % (value, self._max)) + raise ConstrainError("%s: %s > max %s" % (debug, value, self._max)) return value class VideoConstrain(MinMax): @@ -240,9 +240,10 @@ def __init__(self, values): self._values = values - def __call__(self, value): + def __call__(self, value, debug="unknown"): if not value in self._values: - raise ConstrainError("%s not in %s" % (value, str(self._values))) + raise ConstrainError("%s: %s not in %s" % + (debug, value, str(self._values))) return value class _VideoModes(object): @@ -312,7 +313,6 @@ self._filedata = {} self._newdata = {} self._order = [] - self.clear() self._fpath = None def clear(self): @@ -353,10 +353,13 @@ raise ValueError("Full path not set") bak = orig + ".bak" new = orig + ".new" - shutils.copyfile(orig, bak) # make backup + shutil.copyfile(orig, bak) # make backup self.writeEncFile(new) # write new os.unlink(orig) # stupid windows can't perform an atomic rename os.rename(new, orig) # move new to orig + + # reread the file again + self.parseEncFile(self._fpath) def parseEncFile(self, fd_name): """Read and parse file (fd or file name) @@ -395,7 +398,11 @@ newkey = key self._order.append(newkey) value = line[len(key)+1:].strip() - value = constrain(convert(value)) + try: + value = constrain(convert(value), debug=key) + except: # catch all + LOG.exception("convert/constrain error") + raise self._filedata[newkey] = value break if not found: @@ -427,7 +434,11 @@ #key = newkey.replace('__', ' ') #key = key.replace('_', '.') convert, constrain = self._options[key] - value = constrain(convert(value)) + try: + value = constrain(convert(value), debug=key) + except: # catch all + LOG.exception("convert/constrain error") + raise out.append("%s %s" % (key, value)) out.append('') # new line at EOF return '\n'.join(out) @@ -445,6 +456,9 @@ encryptWDYS(data, fd) if close: fd.close() + else: + fd.flush() + fd.seek(0) def _get(self, name): """get descriptor helper @@ -467,6 +481,11 @@ """set descriptor helper for % sliders """ self._newdata[name] = float(value / 100.0) + + def _setboolint(self, name, value): + """ + """ + self._newdata[name] = int(bool(value)) class AudioIni(ConfFile): _filename = 'audio.ini' @@ -484,7 +503,7 @@ 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), # 0-100%, no ui # microphon missing -> OS mixer } - _devices = ['Generic Software', 'Generic Hardware'] + _devices = ['"Generic Software"', '"Generic Hardware"'] # plus maybe a custom OpenAL v1.1 device def parserDoneHook(self): @@ -533,13 +552,13 @@ lambda self, v: self._set('Audio.UseEAX', v), ) mute = property(lambda self: self._get('Audio.MuteAll'), - lambda self, v: self._set('Audio.MuteAll', v), + lambda self, v: self._setboolint('Audio.MuteAll', v), ) priority = property(lambda self: self._get('Audio.SetPriorityCutoff'), lambda self, v: self._set('Audio.SetPriorityCutoff', v), ) enablevoice = property(lambda self: self._get('Audio.EnableVoiceRecording'), - lambda self, v: self._set('Audio.EnableVoiceRecording', v), + lambda self, v: self._setboolint('Audio.EnableVoiceRecording', v), ) device = property(_getDevice, _setDevice) fx = property(lambda self: self._getp('Audio.SetChannelVolume SoundFX'), @@ -600,7 +619,7 @@ lambda self, v: self._set('Quality.Level', v), ) shadow_enabled = property(lambda self: self._get('Graphics.Shadow.Enable'), - lambda self, v: self._set('Graphics.Shadow.Enable', v), + lambda self, v: self._setboolint('Graphics.Shadow.Enable', v), ) shadow = property(lambda self: self._getp('Graphics.Shadow.VisibleDistance'), lambda self, v: self._setp('Graphics.Shadow.VisibleDistance', v), Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-24 22:11:48 UTC (rev 71) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-24 23:17:08 UTC (rev 72) @@ -79,9 +79,9 @@ @param event close event (QCloseEvent) """ - if self._dirty: - event.reject() - return False + #if self._dirty: + # event.reject() + # return False self._systray_close() event.accept() @@ -158,7 +158,9 @@ def on_graphicsini_save(self): """SIGNAL graphicsini_save() """ - self._notimplemented() + #self._notimplemented() + self._graphics_ini.write() + self.setDirty(False) def _graphicsini_setstate(self): """Set sliders according to graphics ini settings @@ -185,6 +187,7 @@ # XXX: fixme txt = videoModes.getVidModeHuman(idx) self.lb_screenres.setText(QtCore.QString(txt)) + self._graphics_ini.screenres = idx @signalLogDecorator(LOG) @pyqtSignature("int") @@ -199,47 +202,56 @@ def on_sl_gra_quality_valueChanged(self, idx): """SIGNAL: valueChanged (int) """ + self._graphics_ini.quality = idx @signalLogDecorator(LOG) @pyqtSignature("int") def on_sl_gra_texture_valueChanged(self, idx): """SIGNAL: valueChanged (int) """ + self._graphics_ini.texture = idx @signalLogDecorator(LOG) @pyqtSignature("int") def on_sl_gra_antialias_valueChanged(self, idx): """SIGNAL: valueChanged (int) """ + self._graphics_ini.antialias = idx @signalLogDecorator(LOG) @pyqtSignature("int") def on_sl_gra_anisotropic_valueChanged(self, idx): """SIGNAL: valueChanged (int) """ + self._graphics_ini.anisotropic = idx @signalLogDecorator(LOG) @pyqtSignature("int") def on_sl_gra_shadow_valueChanged(self, idx): """SIGNAL: valueChanged (int) """ + self._graphics_ini.shadow = idx + @signalLogDecorator(LOG) @pyqtSignature("int") - def on_cb_gra_windowed_stateChanged (self, state): + def on_cb_gra_windowed_stateChanged(self, state): """SIGNAL: stateChanged(int) """ + self._graphics_ini.windowed = state @signalLogDecorator(LOG) @pyqtSignature("int") def on_cb_gra_vsync_stateChanged (self, state): """SIGNAL: stateChanged(int) """ + self._graphics_ini.vsync = state @signalLogDecorator(LOG) @pyqtSignature("int") def on_cb_gra_shadow_stateChanged (self, state): """SIGNAL: stateChanged(int) """ + self._graphics_ini.shadow_enabled = state # ************************************************************************ # audio settings @@ -281,13 +293,16 @@ def on_audioini_save(self): """SIGNAL audioini_save() """ - self._notimplemented() + #self._notimplemented() + self._audio_ini.write() + self.setDirty(False) # urks def _audioini_setstate(self): """Set sliders according to audio ini settings """ aini = self._audio_ini self.sl_aud_device.setMaximum(aini.numberOfDevices()-1) + self.sl_aud_npc.setValue(aini.npc) self.sl_aud_music.setValue(aini.music) self.sl_aud_fx.setValue(aini.fx) @@ -303,18 +318,74 @@ def on_sl_aud_device_valueChanged(self, idx): """SIGNAL: valueChanged (int) """ - # TODO: fixme + self._audio_ini.device = idx txt = self._audio_ini.getDeviceName(idx) - self.lb_aud_device.setText(QtCore.QString(txt)) - + self.lb_aud_device.setText(QtCore.QString(txt[1:-1])) + @signalLogDecorator(LOG) @pyqtSignature("int") def on_sl_aud_device_sliderMoved(self, idx): """SIGNAL: sliderMoved(int) """ txt = self._audio_ini.getDeviceName(idx) - self.lb_aud_device.setText(QtCore.QString(txt)) + self.lb_aud_device.setText(QtCore.QString(txt[1:-1])) + @signalLogDecorator(LOG) + @pyqtSignature("int") + def on_sl_aud_npc_valueChanged(self, idx): + """SIGNAL: valueChanged (int) + """ + self._audio_ini.npc = idx + + @signalLogDecorator(LOG) + @pyqtSignature("int") + def on_sl_aud_music_valueChanged(self, idx): + """SIGNAL: valueChanged (int) + """ + self._audio_ini.music = idx + + @signalLogDecorator(LOG) + @pyqtSignature("int") + def on_sl_aud_fx_valueChanged(self, idx): + """SIGNAL: valueChanged (int) + """ + self._audio_ini.fx = idx + + @signalLogDecorator(LOG) + @pyqtSignature("int") + def on_sl_aud_ambience_valueChanged(self, idx): + """SIGNAL: valueChanged (int) + """ + self._audio_ini.ambience = idx + + @signalLogDecorator(LOG) + @pyqtSignature("int") + def on_sl_aud_priority_valueChanged(self, idx): + """SIGNAL: valueChanged (int) + """ + self._audio_ini.priority = idx + + @signalLogDecorator(LOG) + @pyqtSignature("int") + def on_cb_aud_eax_stateChanged (self, state): + """SIGNAL: stateChanged(int) + """ + self._audio_ini.eax = state + + @signalLogDecorator(LOG) + @pyqtSignature("int") + def on_cb_aud_mute_stateChanged (self, state): + """SIGNAL: stateChanged(int) + """ + self._audio_ini.mute = state + + @signalLogDecorator(LOG) + @pyqtSignature("int") + def on_cb_aud_voicechat_stateChanged (self, state): + """SIGNAL: stateChanged(int) + """ + self._audio_ini.voicechat = state + # ************************************************************************ # time zones This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-24 22:11:48
|
Revision: 71 http://pymoul.svn.sourceforge.net/pymoul/?rev=71&view=rev Author: tiran Date: 2007-01-24 14:11:48 -0800 (Wed, 24 Jan 2007) Log Message: ----------- More signal handlers: reset and save Modified Paths: -------------- pymoul/trunk/src/moul/qt/mainwindow.py Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-24 20:40:47 UTC (rev 70) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-24 22:11:48 UTC (rev 71) @@ -66,8 +66,14 @@ self._audio_init() self._ping_init() self._systray_init() + + def _notimplemented(self): + """TODO: remove me + """ + QtGui.QMessageBox.information(self, + self.trUtf8("Not Implemented"), + self.trUtf8("""Sorry, this feature is not implemented yet!""")) - def closeEvent(self, event): """Close event handler @@ -96,8 +102,10 @@ """Sets the save state """ self._dirty = bool(boolean) - self.main_buttonbox_reset.setEnabled(boolean) - self.main_buttonbox_save.setEnabled(boolean) + #self.main_buttonbox_reset.setEnabled(boolean) + #self.main_buttonbox_save.setEnabled(boolean) + self.main_buttonbox_save.setEnabled(True) + self.main_buttonbox_reset.setEnabled(True) # ************************************************************************ # system tray @@ -116,6 +124,17 @@ def _graphics_init(self): """init graphics tab """ + self.connect(self, SIGNAL("graphicsini_loaded()"), self.on_graphicsini_loaded) + self.connect(self, SIGNAL("graphicsini_reset()"), self.on_graphicsini_reset) + self.connect(self, SIGNAL("graphicsini_save()"), self.on_graphicsini_save) + self.connect(self.main_buttonbox_reset, SIGNAL("clicked()"), self.on_graphicsini_reset) + self.connect(self.main_buttonbox_save, SIGNAL("clicked()"), self.on_graphicsini_save) + self.emit(SIGNAL("graphicsini_loaded()")) # XXX: hard coded emit + + @signalLogDecorator(LOG) + def on_graphicsini_loaded(self): + """SIGNAL graphicsini_loaded() + """ inipath = lookupDir('ini') self._graphics_ini = gini = GraphicsIni() try: @@ -126,23 +145,34 @@ self.trUtf8("Error opening graphics.ini"), self.trUtf8("""Something bad happend while opening the graphics.ini\n%s""" % msg)) return + self._graphicsini_setstate() + @signalLogDecorator(LOG) + def on_graphicsini_reset(self): + """SIGNAL graphicsini_reset() + """ + self._graphics_ini.reset() + self._graphicsini_setstate() + + @signalLogDecorator(LOG) + def on_graphicsini_save(self): + """SIGNAL graphicsini_save() + """ + self._notimplemented() + + def _graphicsini_setstate(self): + """Set sliders according to graphics ini settings + """ + gini = self._graphics_ini length = len(videoModes) - 1 self.sl_gra_screenres.setMaximum(length) - self.on_graphicsini_loaded(gini) # XXX: hard coded for testing purpose - - @signalLogDecorator(LOG) - def on_graphicsini_loaded(self, gini): - """SIGNAL: graphicsIniLoaded(file) - """ self.sl_gra_screenres.setValue(gini.screenres) self.sl_gra_quality.setValue(gini.quality) self.sl_gra_texture.setValue(gini.texture) self.sl_gra_antialias.setValue(gini.antialias) self.sl_gra_anisotropic.setValue(gini.anisotropic) self.sl_gra_shadow.setValue(gini.shadow) - print gini.shadow self.cb_gra_windowed.setChecked(gini.windowed) self.cb_gra_vsync.setChecked(gini.vsync) self.cb_gra_shadow.setChecked(gini.shadow_enabled) @@ -217,6 +247,17 @@ def _audio_init(self): """init graphics tab """ + self.connect(self, SIGNAL("audioini_loaded()"), self.on_audioini_loaded) + self.connect(self, SIGNAL("audiini_reset()"), self.on_audioini_reset) + self.connect(self, SIGNAL("audiini_save()"), self.on_audioini_save) + self.connect(self.main_buttonbox_reset, SIGNAL("clicked()"), self.on_audioini_reset) + self.connect(self.main_buttonbox_save, SIGNAL("clicked()"), self.on_audioini_save) + self.emit(SIGNAL("audioini_loaded()")) # XXX: hard coded emit + + @signalLogDecorator(LOG) + def on_audioini_loaded(self): + """SIGNAL: audioini_loaded() + """ inipath = lookupDir('ini') self._audio_ini = aini = AudioIni() try: @@ -227,15 +268,26 @@ self.trUtf8("Error opening audio.ini"), self.trUtf8("""Something bad happend while opening the audio.ini\n%s""" % msg)) return + self._audioini_setstate() - self.sl_aud_device.setMaximum(aini.numberOfDevices()-1) + @signalLogDecorator(LOG) + def on_audioini_reset(self): + """SIGNAL audioini_reset() + """ + self._audio_ini.reset() + self._audioini_setstate() - self.on_audioini_loaded(aini) # XXX: hard coded for testing purpose - @signalLogDecorator(LOG) - def on_audioini_loaded(self, aini): - """SIGNAL: graphicsIniLoaded(file) + def on_audioini_save(self): + """SIGNAL audioini_save() """ + self._notimplemented() + + def _audioini_setstate(self): + """Set sliders according to audio ini settings + """ + aini = self._audio_ini + self.sl_aud_device.setMaximum(aini.numberOfDevices()-1) self.sl_aud_npc.setValue(aini.npc) self.sl_aud_music.setValue(aini.music) self.sl_aud_fx.setValue(aini.fx) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-24 20:40:50
|
Revision: 70 http://pymoul.svn.sourceforge.net/pymoul/?rev=70&view=rev Author: tiran Date: 2007-01-24 12:40:47 -0800 (Wed, 24 Jan 2007) Log Message: ----------- Minor fixes for brain bug Modified Paths: -------------- pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.py Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-01-24 18:26:59 UTC (rev 69) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-01-24 20:40:47 UTC (rev 70) @@ -309,14 +309,27 @@ _filename = None def __init__(self): + self._filedata = {} + self._newdata = {} + self._order = [] self.clear() self._fpath = None def clear(self): - self._filedata = {} - self._newdata = {} - self._order = [] + """Clear all informations + """ + self._filedata.clear() + self._newdata.clear() + self._order[:] = [] + def reset(self): + """Reset state of the ini parser + + Copies file data to new data + """ + self._newdata.clear() + self._newdata.update(self._filedata.copy()) + def open(self, path): """Open encrypted file at 'path' """ @@ -388,14 +401,14 @@ if not found: raise ValueError(line) - self._newdata = self._filedata.copy() + self.reset() self.parserDoneHook() def parserDoneHook(self): """Hook called after the data is read and parsed """ pass - + def isChanged(self): """Check if the data was changed """ Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-24 18:26:59 UTC (rev 69) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-24 20:40:47 UTC (rev 70) @@ -132,6 +132,7 @@ self.on_graphicsini_loaded(gini) # XXX: hard coded for testing purpose + @signalLogDecorator(LOG) def on_graphicsini_loaded(self, gini): """SIGNAL: graphicsIniLoaded(file) """ @@ -231,6 +232,7 @@ self.on_audioini_loaded(aini) # XXX: hard coded for testing purpose + @signalLogDecorator(LOG) def on_audioini_loaded(self, aini): """SIGNAL: graphicsIniLoaded(file) """ Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-24 18:26:59 UTC (rev 69) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-24 20:40:47 UTC (rev 70) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Wed Jan 24 19:25:53 2007 +# Created: Wed Jan 24 19:26:57 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-24 18:27:03
|
Revision: 69 http://pymoul.svn.sourceforge.net/pymoul/?rev=69&view=rev Author: tiran Date: 2007-01-24 10:26:59 -0800 (Wed, 24 Jan 2007) Log Message: ----------- Some UI cleanup Modified Paths: -------------- pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-24 17:01:15 UTC (rev 68) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-24 18:26:59 UTC (rev 69) @@ -50,8 +50,15 @@ # Set up the user interface from Designer. self.setupUi(self) + # hook up main buttonbox + but = self.main_buttonbox.button + self.main_buttonbox_reset = but(QtGui.QDialogButtonBox.Reset) + self.main_buttonbox_save = but(QtGui.QDialogButtonBox.Save) + self.main_buttonbox_close = but(QtGui.QDialogButtonBox.Close) + # dirty flag: unsaved changes self._dirty = False + self.setDirty(False) # init handlers self._timezone_init() @@ -60,6 +67,7 @@ self._ping_init() self._systray_init() + def closeEvent(self, event): """Close event handler @@ -84,6 +92,13 @@ # event.accept() event.ignore() + def setDirty(self, boolean): + """Sets the save state + """ + self._dirty = bool(boolean) + self.main_buttonbox_reset.setEnabled(boolean) + self.main_buttonbox_save.setEnabled(boolean) + # ************************************************************************ # system tray def _systray_init(self): Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-24 17:01:15 UTC (rev 68) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-24 18:26:59 UTC (rev 69) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Wed Jan 24 17:55:00 2007 +# Created: Wed Jan 24 19:25:53 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -27,12 +27,12 @@ self.centralwidget.setEnabled(True) self.centralwidget.setObjectName("centralwidget") - self.label = QtGui.QLabel(self.centralwidget) - self.label.setGeometry(QtCore.QRect(15,10,430,58)) - self.label.setFrameShape(QtGui.QFrame.StyledPanel) - self.label.setFrameShadow(QtGui.QFrame.Sunken) - self.label.setPixmap(QtGui.QPixmap(":/resources/moul_logo.png")) - self.label.setObjectName("label") + self.lb_top_image = QtGui.QLabel(self.centralwidget) + self.lb_top_image.setGeometry(QtCore.QRect(15,10,430,58)) + self.lb_top_image.setFrameShape(QtGui.QFrame.StyledPanel) + self.lb_top_image.setFrameShadow(QtGui.QFrame.Sunken) + self.lb_top_image.setPixmap(QtGui.QPixmap(":/resources/moul_logo.png")) + self.lb_top_image.setObjectName("lb_top_image") self.horizontalLayout = QtGui.QWidget(self.centralwidget) self.horizontalLayout.setGeometry(QtCore.QRect(60,70,341,31)) @@ -44,6 +44,7 @@ self.hboxlayout.setObjectName("hboxlayout") self.comboBox = QtGui.QComboBox(self.horizontalLayout) + self.comboBox.setEnabled(False) font = QtGui.QFont(self.comboBox.font()) font.setPointSize(6) @@ -52,12 +53,15 @@ self.hboxlayout.addWidget(self.comboBox) self.pushButton = QtGui.QPushButton(self.horizontalLayout) + self.pushButton.setEnabled(False) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth()) self.pushButton.setSizePolicy(sizePolicy) + self.pushButton.setMaximumSize(QtCore.QSize(16777215,20)) + self.pushButton.setBaseSize(QtCore.QSize(0,20)) font = QtGui.QFont(self.pushButton.font()) font.setPointSize(8) @@ -65,72 +69,47 @@ self.pushButton.setObjectName("pushButton") self.hboxlayout.addWidget(self.pushButton) - self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) - self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) - self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) - self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") + self.main_buttonbox = QtGui.QDialogButtonBox(self.centralwidget) + self.main_buttonbox.setGeometry(QtCore.QRect(10,480,441,32)) + self.main_buttonbox.setOrientation(QtCore.Qt.Horizontal) + self.main_buttonbox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.main_buttonbox.setObjectName("main_buttonbox") - self.tab_graphics = QtGui.QTabWidget(self.centralwidget) - self.tab_graphics.setGeometry(QtCore.QRect(5,100,450,375)) - self.tab_graphics.setTabPosition(QtGui.QTabWidget.North) + self.tabwidget = QtGui.QTabWidget(self.centralwidget) + self.tabwidget.setGeometry(QtCore.QRect(5,100,450,375)) + self.tabwidget.setTabPosition(QtGui.QTabWidget.North) + self.tabwidget.setObjectName("tabwidget") + + self.tab_graphics = QtGui.QWidget() self.tab_graphics.setObjectName("tab_graphics") - self.tab_graphics1 = QtGui.QWidget() - self.tab_graphics1.setObjectName("tab_graphics1") - - self.groupBox_gra_checkboxes = QtGui.QGroupBox(self.tab_graphics1) + self.groupBox_gra_checkboxes = QtGui.QGroupBox(self.tab_graphics) self.groupBox_gra_checkboxes.setEnabled(True) self.groupBox_gra_checkboxes.setGeometry(QtCore.QRect(240,10,201,71)) self.groupBox_gra_checkboxes.setObjectName("groupBox_gra_checkboxes") - self.groupBox_4 = QtGui.QGroupBox(self.groupBox_gra_checkboxes) - self.groupBox_4.setGeometry(QtCore.QRect(250,100,201,71)) - self.groupBox_4.setObjectName("groupBox_4") + self.verticalLayout = QtGui.QWidget(self.groupBox_gra_checkboxes) + self.verticalLayout.setGeometry(QtCore.QRect(10,0,160,71)) + self.verticalLayout.setObjectName("verticalLayout") - self.verticalLayout_4 = QtGui.QWidget(self.groupBox_4) - self.verticalLayout_4.setGeometry(QtCore.QRect(10,0,160,71)) - self.verticalLayout_4.setObjectName("verticalLayout_4") - - self.vboxlayout = QtGui.QVBoxLayout(self.verticalLayout_4) + self.vboxlayout = QtGui.QVBoxLayout(self.verticalLayout) self.vboxlayout.setMargin(0) self.vboxlayout.setSpacing(6) self.vboxlayout.setObjectName("vboxlayout") - self.checkBox_4 = QtGui.QCheckBox(self.verticalLayout_4) - self.checkBox_4.setObjectName("checkBox_4") - self.vboxlayout.addWidget(self.checkBox_4) - - self.checkBox_5 = QtGui.QCheckBox(self.verticalLayout_4) - self.checkBox_5.setObjectName("checkBox_5") - self.vboxlayout.addWidget(self.checkBox_5) - - self.checkBox_6 = QtGui.QCheckBox(self.verticalLayout_4) - self.checkBox_6.setObjectName("checkBox_6") - self.vboxlayout.addWidget(self.checkBox_6) - - self.verticalLayout = QtGui.QWidget(self.groupBox_gra_checkboxes) - self.verticalLayout.setGeometry(QtCore.QRect(10,0,160,71)) - self.verticalLayout.setObjectName("verticalLayout") - - self.vboxlayout1 = QtGui.QVBoxLayout(self.verticalLayout) - self.vboxlayout1.setMargin(0) - self.vboxlayout1.setSpacing(6) - self.vboxlayout1.setObjectName("vboxlayout1") - self.cb_gra_windowed = QtGui.QCheckBox(self.verticalLayout) self.cb_gra_windowed.setObjectName("cb_gra_windowed") - self.vboxlayout1.addWidget(self.cb_gra_windowed) + self.vboxlayout.addWidget(self.cb_gra_windowed) self.cb_gra_vsync = QtGui.QCheckBox(self.verticalLayout) self.cb_gra_vsync.setObjectName("cb_gra_vsync") - self.vboxlayout1.addWidget(self.cb_gra_vsync) + self.vboxlayout.addWidget(self.cb_gra_vsync) self.cb_gra_shadow = QtGui.QCheckBox(self.verticalLayout) self.cb_gra_shadow.setObjectName("cb_gra_shadow") - self.vboxlayout1.addWidget(self.cb_gra_shadow) + self.vboxlayout.addWidget(self.cb_gra_shadow) - self.groupBox_screenres = QtGui.QGroupBox(self.tab_graphics1) + self.groupBox_screenres = QtGui.QGroupBox(self.tab_graphics) self.groupBox_screenres.setGeometry(QtCore.QRect(10,0,220,81)) self.groupBox_screenres.setObjectName("groupBox_screenres") @@ -138,10 +117,10 @@ self.verticalLayout_2.setGeometry(QtCore.QRect(20,20,181,51)) self.verticalLayout_2.setObjectName("verticalLayout_2") - self.vboxlayout2 = QtGui.QVBoxLayout(self.verticalLayout_2) - self.vboxlayout2.setMargin(0) - self.vboxlayout2.setSpacing(6) - self.vboxlayout2.setObjectName("vboxlayout2") + self.vboxlayout1 = QtGui.QVBoxLayout(self.verticalLayout_2) + self.vboxlayout1.setMargin(0) + self.vboxlayout1.setSpacing(6) + self.vboxlayout1.setObjectName("vboxlayout1") self.sl_gra_screenres = QtGui.QSlider(self.verticalLayout_2) self.sl_gra_screenres.setMaximum(10) @@ -152,14 +131,14 @@ self.sl_gra_screenres.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_gra_screenres.setTickInterval(1) self.sl_gra_screenres.setObjectName("sl_gra_screenres") - self.vboxlayout2.addWidget(self.sl_gra_screenres) + self.vboxlayout1.addWidget(self.sl_gra_screenres) self.lb_screenres = QtGui.QLabel(self.verticalLayout_2) self.lb_screenres.setAlignment(QtCore.Qt.AlignCenter) self.lb_screenres.setObjectName("lb_screenres") - self.vboxlayout2.addWidget(self.lb_screenres) + self.vboxlayout1.addWidget(self.lb_screenres) - self.groupBox_gra_quality = QtGui.QGroupBox(self.tab_graphics1) + self.groupBox_gra_quality = QtGui.QGroupBox(self.tab_graphics) self.groupBox_gra_quality.setEnabled(True) self.groupBox_gra_quality.setGeometry(QtCore.QRect(10,79,430,261)) self.groupBox_gra_quality.setObjectName("groupBox_gra_quality") @@ -168,15 +147,15 @@ self.verticalLayout_7.setGeometry(QtCore.QRect(230,20,179,71)) self.verticalLayout_7.setObjectName("verticalLayout_7") - self.vboxlayout3 = QtGui.QVBoxLayout(self.verticalLayout_7) - self.vboxlayout3.setMargin(0) - self.vboxlayout3.setSpacing(6) - self.vboxlayout3.setObjectName("vboxlayout3") + self.vboxlayout2 = QtGui.QVBoxLayout(self.verticalLayout_7) + self.vboxlayout2.setMargin(0) + self.vboxlayout2.setSpacing(6) + self.vboxlayout2.setObjectName("vboxlayout2") - self.label_20 = QtGui.QLabel(self.verticalLayout_7) - self.label_20.setAlignment(QtCore.Qt.AlignCenter) - self.label_20.setObjectName("label_20") - self.vboxlayout3.addWidget(self.label_20) + self.lb_gra_tq = QtGui.QLabel(self.verticalLayout_7) + self.lb_gra_tq.setAlignment(QtCore.Qt.AlignCenter) + self.lb_gra_tq.setObjectName("lb_gra_tq") + self.vboxlayout2.addWidget(self.lb_gra_tq) self.sl_gra_texture = QtGui.QSlider(self.verticalLayout_7) self.sl_gra_texture.setMinimum(0) @@ -189,36 +168,36 @@ self.sl_gra_texture.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_gra_texture.setTickInterval(1) self.sl_gra_texture.setObjectName("sl_gra_texture") - self.vboxlayout3.addWidget(self.sl_gra_texture) + self.vboxlayout2.addWidget(self.sl_gra_texture) self.hboxlayout1 = QtGui.QHBoxLayout() self.hboxlayout1.setMargin(0) self.hboxlayout1.setSpacing(6) self.hboxlayout1.setObjectName("hboxlayout1") - self.label_21 = QtGui.QLabel(self.verticalLayout_7) - self.label_21.setObjectName("label_21") - self.hboxlayout1.addWidget(self.label_21) + self.lb_gra_tq_low = QtGui.QLabel(self.verticalLayout_7) + self.lb_gra_tq_low.setObjectName("lb_gra_tq_low") + self.hboxlayout1.addWidget(self.lb_gra_tq_low) - self.label_22 = QtGui.QLabel(self.verticalLayout_7) - self.label_22.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.label_22.setObjectName("label_22") - self.hboxlayout1.addWidget(self.label_22) - self.vboxlayout3.addLayout(self.hboxlayout1) + self.lb_gra_tq_high = QtGui.QLabel(self.verticalLayout_7) + self.lb_gra_tq_high.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.lb_gra_tq_high.setObjectName("lb_gra_tq_high") + self.hboxlayout1.addWidget(self.lb_gra_tq_high) + self.vboxlayout2.addLayout(self.hboxlayout1) self.verticalLayout_5 = QtGui.QWidget(self.groupBox_gra_quality) self.verticalLayout_5.setGeometry(QtCore.QRect(20,100,179,71)) self.verticalLayout_5.setObjectName("verticalLayout_5") - self.vboxlayout4 = QtGui.QVBoxLayout(self.verticalLayout_5) - self.vboxlayout4.setMargin(0) - self.vboxlayout4.setSpacing(6) - self.vboxlayout4.setObjectName("vboxlayout4") + self.vboxlayout3 = QtGui.QVBoxLayout(self.verticalLayout_5) + self.vboxlayout3.setMargin(0) + self.vboxlayout3.setSpacing(6) + self.vboxlayout3.setObjectName("vboxlayout3") - self.label_13 = QtGui.QLabel(self.verticalLayout_5) - self.label_13.setAlignment(QtCore.Qt.AlignCenter) - self.label_13.setObjectName("label_13") - self.vboxlayout4.addWidget(self.label_13) + self.lb_gra_aa = QtGui.QLabel(self.verticalLayout_5) + self.lb_gra_aa.setAlignment(QtCore.Qt.AlignCenter) + self.lb_gra_aa.setObjectName("lb_gra_aa") + self.vboxlayout3.addWidget(self.lb_gra_aa) self.sl_gra_antialias = QtGui.QSlider(self.verticalLayout_5) self.sl_gra_antialias.setMinimum(0) @@ -232,36 +211,36 @@ self.sl_gra_antialias.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_gra_antialias.setTickInterval(2) self.sl_gra_antialias.setObjectName("sl_gra_antialias") - self.vboxlayout4.addWidget(self.sl_gra_antialias) + self.vboxlayout3.addWidget(self.sl_gra_antialias) self.hboxlayout2 = QtGui.QHBoxLayout() self.hboxlayout2.setMargin(0) self.hboxlayout2.setSpacing(6) self.hboxlayout2.setObjectName("hboxlayout2") - self.label_14 = QtGui.QLabel(self.verticalLayout_5) - self.label_14.setObjectName("label_14") - self.hboxlayout2.addWidget(self.label_14) + self.lb_gra_aa_low = QtGui.QLabel(self.verticalLayout_5) + self.lb_gra_aa_low.setObjectName("lb_gra_aa_low") + self.hboxlayout2.addWidget(self.lb_gra_aa_low) - self.label_16 = QtGui.QLabel(self.verticalLayout_5) - self.label_16.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.label_16.setObjectName("label_16") - self.hboxlayout2.addWidget(self.label_16) - self.vboxlayout4.addLayout(self.hboxlayout2) + self.lb_gra_aa_low1 = QtGui.QLabel(self.verticalLayout_5) + self.lb_gra_aa_low1.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.lb_gra_aa_low1.setObjectName("lb_gra_aa_low1") + self.hboxlayout2.addWidget(self.lb_gra_aa_low1) + self.vboxlayout3.addLayout(self.hboxlayout2) self.verticalLayout_3 = QtGui.QWidget(self.groupBox_gra_quality) self.verticalLayout_3.setGeometry(QtCore.QRect(20,20,179,71)) self.verticalLayout_3.setObjectName("verticalLayout_3") - self.vboxlayout5 = QtGui.QVBoxLayout(self.verticalLayout_3) - self.vboxlayout5.setMargin(0) - self.vboxlayout5.setSpacing(6) - self.vboxlayout5.setObjectName("vboxlayout5") + self.vboxlayout4 = QtGui.QVBoxLayout(self.verticalLayout_3) + self.vboxlayout4.setMargin(0) + self.vboxlayout4.setSpacing(6) + self.vboxlayout4.setObjectName("vboxlayout4") - self.label_2 = QtGui.QLabel(self.verticalLayout_3) - self.label_2.setAlignment(QtCore.Qt.AlignCenter) - self.label_2.setObjectName("label_2") - self.vboxlayout5.addWidget(self.label_2) + self.lb_gra_quality = QtGui.QLabel(self.verticalLayout_3) + self.lb_gra_quality.setAlignment(QtCore.Qt.AlignCenter) + self.lb_gra_quality.setObjectName("lb_gra_quality") + self.vboxlayout4.addWidget(self.lb_gra_quality) self.sl_gra_quality = QtGui.QSlider(self.verticalLayout_3) self.sl_gra_quality.setMinimum(0) @@ -274,46 +253,46 @@ self.sl_gra_quality.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_gra_quality.setTickInterval(1) self.sl_gra_quality.setObjectName("sl_gra_quality") - self.vboxlayout5.addWidget(self.sl_gra_quality) + self.vboxlayout4.addWidget(self.sl_gra_quality) self.hboxlayout3 = QtGui.QHBoxLayout() self.hboxlayout3.setMargin(0) self.hboxlayout3.setSpacing(6) self.hboxlayout3.setObjectName("hboxlayout3") - self.label_8 = QtGui.QLabel(self.verticalLayout_3) - self.label_8.setObjectName("label_8") - self.hboxlayout3.addWidget(self.label_8) + self.lb_gra_quality_low = QtGui.QLabel(self.verticalLayout_3) + self.lb_gra_quality_low.setObjectName("lb_gra_quality_low") + self.hboxlayout3.addWidget(self.lb_gra_quality_low) - self.label_9 = QtGui.QLabel(self.verticalLayout_3) - self.label_9.setAlignment(QtCore.Qt.AlignCenter) - self.label_9.setObjectName("label_9") - self.hboxlayout3.addWidget(self.label_9) + self.lb_gra_quality_medium = QtGui.QLabel(self.verticalLayout_3) + self.lb_gra_quality_medium.setAlignment(QtCore.Qt.AlignCenter) + self.lb_gra_quality_medium.setObjectName("lb_gra_quality_medium") + self.hboxlayout3.addWidget(self.lb_gra_quality_medium) - self.label_10 = QtGui.QLabel(self.verticalLayout_3) - self.label_10.setAlignment(QtCore.Qt.AlignCenter) - self.label_10.setObjectName("label_10") - self.hboxlayout3.addWidget(self.label_10) + self.lb_gra_quality_high = QtGui.QLabel(self.verticalLayout_3) + self.lb_gra_quality_high.setAlignment(QtCore.Qt.AlignCenter) + self.lb_gra_quality_high.setObjectName("lb_gra_quality_high") + self.hboxlayout3.addWidget(self.lb_gra_quality_high) - self.label_7 = QtGui.QLabel(self.verticalLayout_3) - self.label_7.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.label_7.setObjectName("label_7") - self.hboxlayout3.addWidget(self.label_7) - self.vboxlayout5.addLayout(self.hboxlayout3) + self.lb_gra_quality_ultra = QtGui.QLabel(self.verticalLayout_3) + self.lb_gra_quality_ultra.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.lb_gra_quality_ultra.setObjectName("lb_gra_quality_ultra") + self.hboxlayout3.addWidget(self.lb_gra_quality_ultra) + self.vboxlayout4.addLayout(self.hboxlayout3) self.verticalLayout_8 = QtGui.QWidget(self.groupBox_gra_quality) self.verticalLayout_8.setGeometry(QtCore.QRect(20,180,179,71)) self.verticalLayout_8.setObjectName("verticalLayout_8") - self.vboxlayout6 = QtGui.QVBoxLayout(self.verticalLayout_8) - self.vboxlayout6.setMargin(0) - self.vboxlayout6.setSpacing(6) - self.vboxlayout6.setObjectName("vboxlayout6") + self.vboxlayout5 = QtGui.QVBoxLayout(self.verticalLayout_8) + self.vboxlayout5.setMargin(0) + self.vboxlayout5.setSpacing(6) + self.vboxlayout5.setObjectName("vboxlayout5") - self.label_15 = QtGui.QLabel(self.verticalLayout_8) - self.label_15.setAlignment(QtCore.Qt.AlignCenter) - self.label_15.setObjectName("label_15") - self.vboxlayout6.addWidget(self.label_15) + self.lb_gra_sq = QtGui.QLabel(self.verticalLayout_8) + self.lb_gra_sq.setAlignment(QtCore.Qt.AlignCenter) + self.lb_gra_sq.setObjectName("lb_gra_sq") + self.vboxlayout5.addWidget(self.lb_gra_sq) self.sl_gra_shadow = QtGui.QSlider(self.verticalLayout_8) self.sl_gra_shadow.setMinimum(0) @@ -326,36 +305,36 @@ self.sl_gra_shadow.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_gra_shadow.setTickInterval(25) self.sl_gra_shadow.setObjectName("sl_gra_shadow") - self.vboxlayout6.addWidget(self.sl_gra_shadow) + self.vboxlayout5.addWidget(self.sl_gra_shadow) self.hboxlayout4 = QtGui.QHBoxLayout() self.hboxlayout4.setMargin(0) self.hboxlayout4.setSpacing(6) self.hboxlayout4.setObjectName("hboxlayout4") - self.label_23 = QtGui.QLabel(self.verticalLayout_8) - self.label_23.setObjectName("label_23") - self.hboxlayout4.addWidget(self.label_23) + self.lb_gra_sq_low = QtGui.QLabel(self.verticalLayout_8) + self.lb_gra_sq_low.setObjectName("lb_gra_sq_low") + self.hboxlayout4.addWidget(self.lb_gra_sq_low) - self.label_24 = QtGui.QLabel(self.verticalLayout_8) - self.label_24.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.label_24.setObjectName("label_24") - self.hboxlayout4.addWidget(self.label_24) - self.vboxlayout6.addLayout(self.hboxlayout4) + self.lb_gra_sq_high = QtGui.QLabel(self.verticalLayout_8) + self.lb_gra_sq_high.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.lb_gra_sq_high.setObjectName("lb_gra_sq_high") + self.hboxlayout4.addWidget(self.lb_gra_sq_high) + self.vboxlayout5.addLayout(self.hboxlayout4) self.verticalLayout_6 = QtGui.QWidget(self.groupBox_gra_quality) self.verticalLayout_6.setGeometry(QtCore.QRect(230,100,179,73)) self.verticalLayout_6.setObjectName("verticalLayout_6") - self.vboxlayout7 = QtGui.QVBoxLayout(self.verticalLayout_6) - self.vboxlayout7.setMargin(0) - self.vboxlayout7.setSpacing(6) - self.vboxlayout7.setObjectName("vboxlayout7") + self.vboxlayout6 = QtGui.QVBoxLayout(self.verticalLayout_6) + self.vboxlayout6.setMargin(0) + self.vboxlayout6.setSpacing(6) + self.vboxlayout6.setObjectName("vboxlayout6") - self.label_17 = QtGui.QLabel(self.verticalLayout_6) - self.label_17.setAlignment(QtCore.Qt.AlignCenter) - self.label_17.setObjectName("label_17") - self.vboxlayout7.addWidget(self.label_17) + self.lb_gra_af = QtGui.QLabel(self.verticalLayout_6) + self.lb_gra_af.setAlignment(QtCore.Qt.AlignCenter) + self.lb_gra_af.setObjectName("lb_gra_af") + self.vboxlayout6.addWidget(self.lb_gra_af) self.sl_gra_anisotropic = QtGui.QSlider(self.verticalLayout_6) self.sl_gra_anisotropic.setMinimum(1) @@ -368,23 +347,23 @@ self.sl_gra_anisotropic.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_gra_anisotropic.setTickInterval(5) self.sl_gra_anisotropic.setObjectName("sl_gra_anisotropic") - self.vboxlayout7.addWidget(self.sl_gra_anisotropic) + self.vboxlayout6.addWidget(self.sl_gra_anisotropic) self.hboxlayout5 = QtGui.QHBoxLayout() self.hboxlayout5.setMargin(0) self.hboxlayout5.setSpacing(6) self.hboxlayout5.setObjectName("hboxlayout5") - self.label_18 = QtGui.QLabel(self.verticalLayout_6) - self.label_18.setObjectName("label_18") - self.hboxlayout5.addWidget(self.label_18) + self.lb_gra_af_low = QtGui.QLabel(self.verticalLayout_6) + self.lb_gra_af_low.setObjectName("lb_gra_af_low") + self.hboxlayout5.addWidget(self.lb_gra_af_low) - self.label_19 = QtGui.QLabel(self.verticalLayout_6) - self.label_19.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.label_19.setObjectName("label_19") - self.hboxlayout5.addWidget(self.label_19) - self.vboxlayout7.addLayout(self.hboxlayout5) - self.tab_graphics.addTab(self.tab_graphics1,"") + self.lb_gra_af_high = QtGui.QLabel(self.verticalLayout_6) + self.lb_gra_af_high.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.lb_gra_af_high.setObjectName("lb_gra_af_high") + self.hboxlayout5.addWidget(self.lb_gra_af_high) + self.vboxlayout6.addLayout(self.hboxlayout5) + self.tabwidget.addTab(self.tab_graphics,"") self.tab_audio = QtGui.QWidget() self.tab_audio.setObjectName("tab_audio") @@ -398,15 +377,15 @@ self.verticalLayout_12.setGeometry(QtCore.QRect(230,80,179,43)) self.verticalLayout_12.setObjectName("verticalLayout_12") - self.vboxlayout8 = QtGui.QVBoxLayout(self.verticalLayout_12) - self.vboxlayout8.setMargin(0) - self.vboxlayout8.setSpacing(6) - self.vboxlayout8.setObjectName("vboxlayout8") + self.vboxlayout7 = QtGui.QVBoxLayout(self.verticalLayout_12) + self.vboxlayout7.setMargin(0) + self.vboxlayout7.setSpacing(6) + self.vboxlayout7.setObjectName("vboxlayout7") - self.label_31 = QtGui.QLabel(self.verticalLayout_12) - self.label_31.setAlignment(QtCore.Qt.AlignCenter) - self.label_31.setObjectName("label_31") - self.vboxlayout8.addWidget(self.label_31) + self.lb_aud_npc = QtGui.QLabel(self.verticalLayout_12) + self.lb_aud_npc.setAlignment(QtCore.Qt.AlignCenter) + self.lb_aud_npc.setObjectName("lb_aud_npc") + self.vboxlayout7.addWidget(self.lb_aud_npc) self.sl_aud_npc = QtGui.QSlider(self.verticalLayout_12) self.sl_aud_npc.setMinimum(0) @@ -419,21 +398,21 @@ self.sl_aud_npc.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_aud_npc.setTickInterval(25) self.sl_aud_npc.setObjectName("sl_aud_npc") - self.vboxlayout8.addWidget(self.sl_aud_npc) + self.vboxlayout7.addWidget(self.sl_aud_npc) self.verticalLayout_9 = QtGui.QWidget(self.groupBox_aud_level) self.verticalLayout_9.setGeometry(QtCore.QRect(20,30,179,43)) self.verticalLayout_9.setObjectName("verticalLayout_9") - self.vboxlayout9 = QtGui.QVBoxLayout(self.verticalLayout_9) - self.vboxlayout9.setMargin(0) - self.vboxlayout9.setSpacing(6) - self.vboxlayout9.setObjectName("vboxlayout9") + self.vboxlayout8 = QtGui.QVBoxLayout(self.verticalLayout_9) + self.vboxlayout8.setMargin(0) + self.vboxlayout8.setSpacing(6) + self.vboxlayout8.setObjectName("vboxlayout8") - self.label_28 = QtGui.QLabel(self.verticalLayout_9) - self.label_28.setAlignment(QtCore.Qt.AlignCenter) - self.label_28.setObjectName("label_28") - self.vboxlayout9.addWidget(self.label_28) + self.lb_aud_fx = QtGui.QLabel(self.verticalLayout_9) + self.lb_aud_fx.setAlignment(QtCore.Qt.AlignCenter) + self.lb_aud_fx.setObjectName("lb_aud_fx") + self.vboxlayout8.addWidget(self.lb_aud_fx) self.sl_aud_fx = QtGui.QSlider(self.verticalLayout_9) self.sl_aud_fx.setMinimum(0) @@ -446,21 +425,21 @@ self.sl_aud_fx.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_aud_fx.setTickInterval(25) self.sl_aud_fx.setObjectName("sl_aud_fx") - self.vboxlayout9.addWidget(self.sl_aud_fx) + self.vboxlayout8.addWidget(self.sl_aud_fx) self.verticalLayout_10 = QtGui.QWidget(self.groupBox_aud_level) self.verticalLayout_10.setGeometry(QtCore.QRect(230,30,179,43)) self.verticalLayout_10.setObjectName("verticalLayout_10") - self.vboxlayout10 = QtGui.QVBoxLayout(self.verticalLayout_10) - self.vboxlayout10.setMargin(0) - self.vboxlayout10.setSpacing(6) - self.vboxlayout10.setObjectName("vboxlayout10") + self.vboxlayout9 = QtGui.QVBoxLayout(self.verticalLayout_10) + self.vboxlayout9.setMargin(0) + self.vboxlayout9.setSpacing(6) + self.vboxlayout9.setObjectName("vboxlayout9") - self.label_29 = QtGui.QLabel(self.verticalLayout_10) - self.label_29.setAlignment(QtCore.Qt.AlignCenter) - self.label_29.setObjectName("label_29") - self.vboxlayout10.addWidget(self.label_29) + self.lb_aud_ambience = QtGui.QLabel(self.verticalLayout_10) + self.lb_aud_ambience.setAlignment(QtCore.Qt.AlignCenter) + self.lb_aud_ambience.setObjectName("lb_aud_ambience") + self.vboxlayout9.addWidget(self.lb_aud_ambience) self.sl_aud_ambience = QtGui.QSlider(self.verticalLayout_10) self.sl_aud_ambience.setMinimum(0) @@ -473,21 +452,21 @@ self.sl_aud_ambience.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_aud_ambience.setTickInterval(25) self.sl_aud_ambience.setObjectName("sl_aud_ambience") - self.vboxlayout10.addWidget(self.sl_aud_ambience) + self.vboxlayout9.addWidget(self.sl_aud_ambience) self.verticalLayout_11 = QtGui.QWidget(self.groupBox_aud_level) self.verticalLayout_11.setGeometry(QtCore.QRect(20,80,179,43)) self.verticalLayout_11.setObjectName("verticalLayout_11") - self.vboxlayout11 = QtGui.QVBoxLayout(self.verticalLayout_11) - self.vboxlayout11.setMargin(0) - self.vboxlayout11.setSpacing(6) - self.vboxlayout11.setObjectName("vboxlayout11") + self.vboxlayout10 = QtGui.QVBoxLayout(self.verticalLayout_11) + self.vboxlayout10.setMargin(0) + self.vboxlayout10.setSpacing(6) + self.vboxlayout10.setObjectName("vboxlayout10") - self.label_30 = QtGui.QLabel(self.verticalLayout_11) - self.label_30.setAlignment(QtCore.Qt.AlignCenter) - self.label_30.setObjectName("label_30") - self.vboxlayout11.addWidget(self.label_30) + self.lb_aud_music = QtGui.QLabel(self.verticalLayout_11) + self.lb_aud_music.setAlignment(QtCore.Qt.AlignCenter) + self.lb_aud_music.setObjectName("lb_aud_music") + self.vboxlayout10.addWidget(self.lb_aud_music) self.sl_aud_music = QtGui.QSlider(self.verticalLayout_11) self.sl_aud_music.setMinimum(0) @@ -500,7 +479,7 @@ self.sl_aud_music.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_aud_music.setTickInterval(25) self.sl_aud_music.setObjectName("sl_aud_music") - self.vboxlayout11.addWidget(self.sl_aud_music) + self.vboxlayout10.addWidget(self.sl_aud_music) self.cb_aud_mute = QtGui.QCheckBox(self.groupBox_aud_level) self.cb_aud_mute.setGeometry(QtCore.QRect(180,10,70,19)) @@ -515,15 +494,15 @@ self.verticalLayout_14.setGeometry(QtCore.QRect(230,40,179,43)) self.verticalLayout_14.setObjectName("verticalLayout_14") - self.vboxlayout12 = QtGui.QVBoxLayout(self.verticalLayout_14) - self.vboxlayout12.setMargin(0) - self.vboxlayout12.setSpacing(6) - self.vboxlayout12.setObjectName("vboxlayout12") + self.vboxlayout11 = QtGui.QVBoxLayout(self.verticalLayout_14) + self.vboxlayout11.setMargin(0) + self.vboxlayout11.setSpacing(6) + self.vboxlayout11.setObjectName("vboxlayout11") - self.label_34 = QtGui.QLabel(self.verticalLayout_14) - self.label_34.setAlignment(QtCore.Qt.AlignCenter) - self.label_34.setObjectName("label_34") - self.vboxlayout12.addWidget(self.label_34) + self.lb_aud_priority = QtGui.QLabel(self.verticalLayout_14) + self.lb_aud_priority.setAlignment(QtCore.Qt.AlignCenter) + self.lb_aud_priority.setObjectName("lb_aud_priority") + self.vboxlayout11.addWidget(self.lb_aud_priority) self.sl_aud_priority = QtGui.QSlider(self.verticalLayout_14) self.sl_aud_priority.setMaximum(9) @@ -534,26 +513,26 @@ self.sl_aud_priority.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_aud_priority.setTickInterval(3) self.sl_aud_priority.setObjectName("sl_aud_priority") - self.vboxlayout12.addWidget(self.sl_aud_priority) + self.vboxlayout11.addWidget(self.sl_aud_priority) self.verticalLayout_15 = QtGui.QWidget(self.groupBox_aud_hardware) self.verticalLayout_15.setGeometry(QtCore.QRect(20,20,179,63)) self.verticalLayout_15.setObjectName("verticalLayout_15") - self.vboxlayout13 = QtGui.QVBoxLayout(self.verticalLayout_15) - self.vboxlayout13.setMargin(0) - self.vboxlayout13.setSpacing(6) - self.vboxlayout13.setObjectName("vboxlayout13") + self.vboxlayout12 = QtGui.QVBoxLayout(self.verticalLayout_15) + self.vboxlayout12.setMargin(0) + self.vboxlayout12.setSpacing(6) + self.vboxlayout12.setObjectName("vboxlayout12") - self.label_35 = QtGui.QLabel(self.verticalLayout_15) - self.label_35.setAlignment(QtCore.Qt.AlignCenter) - self.label_35.setObjectName("label_35") - self.vboxlayout13.addWidget(self.label_35) + self.lb_aud_device_modes = QtGui.QLabel(self.verticalLayout_15) + self.lb_aud_device_modes.setAlignment(QtCore.Qt.AlignCenter) + self.lb_aud_device_modes.setObjectName("lb_aud_device_modes") + self.vboxlayout12.addWidget(self.lb_aud_device_modes) self.lb_aud_device = QtGui.QLabel(self.verticalLayout_15) self.lb_aud_device.setAlignment(QtCore.Qt.AlignCenter) self.lb_aud_device.setObjectName("lb_aud_device") - self.vboxlayout13.addWidget(self.lb_aud_device) + self.vboxlayout12.addWidget(self.lb_aud_device) self.sl_aud_device = QtGui.QSlider(self.verticalLayout_15) self.sl_aud_device.setMaximum(2) @@ -564,7 +543,7 @@ self.sl_aud_device.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_aud_device.setTickInterval(1) self.sl_aud_device.setObjectName("sl_aud_device") - self.vboxlayout13.addWidget(self.sl_aud_device) + self.vboxlayout12.addWidget(self.sl_aud_device) self.cb_aud_eax = QtGui.QCheckBox(self.groupBox_aud_hardware) self.cb_aud_eax.setGeometry(QtCore.QRect(260,10,111,19)) @@ -583,16 +562,16 @@ self.verticalLayout_13.setGeometry(QtCore.QRect(20,20,179,43)) self.verticalLayout_13.setObjectName("verticalLayout_13") - self.vboxlayout14 = QtGui.QVBoxLayout(self.verticalLayout_13) - self.vboxlayout14.setMargin(0) - self.vboxlayout14.setSpacing(6) - self.vboxlayout14.setObjectName("vboxlayout14") + self.vboxlayout13 = QtGui.QVBoxLayout(self.verticalLayout_13) + self.vboxlayout13.setMargin(0) + self.vboxlayout13.setSpacing(6) + self.vboxlayout13.setObjectName("vboxlayout13") - self.label_33 = QtGui.QLabel(self.verticalLayout_13) - self.label_33.setEnabled(False) - self.label_33.setAlignment(QtCore.Qt.AlignCenter) - self.label_33.setObjectName("label_33") - self.vboxlayout14.addWidget(self.label_33) + self.lb_aud_microphon = QtGui.QLabel(self.verticalLayout_13) + self.lb_aud_microphon.setEnabled(False) + self.lb_aud_microphon.setAlignment(QtCore.Qt.AlignCenter) + self.lb_aud_microphon.setObjectName("lb_aud_microphon") + self.vboxlayout13.addWidget(self.lb_aud_microphon) self.sl_aud_microphon = QtGui.QSlider(self.verticalLayout_13) self.sl_aud_microphon.setEnabled(False) @@ -606,12 +585,17 @@ self.sl_aud_microphon.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_aud_microphon.setTickInterval(25) self.sl_aud_microphon.setObjectName("sl_aud_microphon") - self.vboxlayout14.addWidget(self.sl_aud_microphon) - self.tab_graphics.addTab(self.tab_audio,"") + self.vboxlayout13.addWidget(self.sl_aud_microphon) + self.tabwidget.addTab(self.tab_audio,"") self.tab_time = QtGui.QWidget() self.tab_time.setObjectName("tab_time") + self.gb_dnitime = QtGui.QGroupBox(self.tab_time) + self.gb_dnitime.setEnabled(True) + self.gb_dnitime.setGeometry(QtCore.QRect(10,120,431,221)) + self.gb_dnitime.setObjectName("gb_dnitime") + self.gb_caverntime = QtGui.QGroupBox(self.tab_time) self.gb_caverntime.setGeometry(QtCore.QRect(10,10,431,101)) self.gb_caverntime.setObjectName("gb_caverntime") @@ -677,13 +661,8 @@ self.label_12 = QtGui.QLabel(self.gridLayout) self.label_12.setObjectName("label_12") self.gridlayout.addWidget(self.label_12,1,3,1,1) + self.tabwidget.addTab(self.tab_time,"") - self.gb_dnitime = QtGui.QGroupBox(self.tab_time) - self.gb_dnitime.setEnabled(True) - self.gb_dnitime.setGeometry(QtCore.QRect(10,120,431,221)) - self.gb_dnitime.setObjectName("gb_dnitime") - self.tab_graphics.addTab(self.tab_time,"") - self.tab_ping = QtGui.QWidget() self.tab_ping.setObjectName("tab_ping") @@ -691,18 +670,18 @@ self.gb_servers.setGeometry(QtCore.QRect(10,0,421,341)) self.gb_servers.setObjectName("gb_servers") + self.button_ping = QtGui.QPushButton(self.gb_servers) + self.button_ping.setGeometry(QtCore.QRect(330,310,75,24)) + self.button_ping.setObjectName("button_ping") + self.text_ping = QtGui.QTextEdit(self.gb_servers) self.text_ping.setGeometry(QtCore.QRect(10,20,401,281)) self.text_ping.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.text_ping.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.text_ping.setReadOnly(True) self.text_ping.setObjectName("text_ping") + self.tabwidget.addTab(self.tab_ping,"") - self.button_ping = QtGui.QPushButton(self.gb_servers) - self.button_ping.setGeometry(QtCore.QRect(330,310,75,24)) - self.button_ping.setObjectName("button_ping") - self.tab_graphics.addTab(self.tab_ping,"") - self.tab_about = QtGui.QWidget() self.tab_about.setObjectName("tab_about") @@ -710,7 +689,7 @@ self.label_6.setGeometry(QtCore.QRect(120,170,181,20)) self.label_6.setAlignment(QtCore.Qt.AlignCenter) self.label_6.setObjectName("label_6") - self.tab_graphics.addTab(self.tab_about,"") + self.tabwidget.addTab(self.tab_about,"") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) @@ -718,55 +697,53 @@ MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) - self.tab_graphics.setCurrentIndex(0) - QtCore.QObject.connect(self.buttonbox_rresavcl,QtCore.SIGNAL("rejected()"),MainWindow.close) + self.tabwidget.setCurrentIndex(0) + QtCore.QObject.connect(self.main_buttonbox,QtCore.SIGNAL("rejected()"),MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Tool for Myst Online", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Configure", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_4.setText(QtGui.QApplication.translate("MainWindow", "CheckBox", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_5.setText(QtGui.QApplication.translate("MainWindow", "CheckBox", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_6.setText(QtGui.QApplication.translate("MainWindow", "CheckBox", None, QtGui.QApplication.UnicodeUTF8)) self.cb_gra_windowed.setText(QtGui.QApplication.translate("MainWindow", "Windowed", None, QtGui.QApplication.UnicodeUTF8)) self.cb_gra_vsync.setText(QtGui.QApplication.translate("MainWindow", "Vertical Sync", None, QtGui.QApplication.UnicodeUTF8)) self.cb_gra_shadow.setText(QtGui.QApplication.translate("MainWindow", "Display Shadows", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_screenres.setTitle(QtGui.QApplication.translate("MainWindow", "Screen Resolution", None, QtGui.QApplication.UnicodeUTF8)) self.lb_screenres.setText(QtGui.QApplication.translate("MainWindow", "800x600 (4:3)", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_gra_quality.setTitle(QtGui.QApplication.translate("MainWindow", "Quality", None, QtGui.QApplication.UnicodeUTF8)) - self.label_20.setText(QtGui.QApplication.translate("MainWindow", "Texture Quality", None, QtGui.QApplication.UnicodeUTF8)) - self.label_21.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) - self.label_22.setText(QtGui.QApplication.translate("MainWindow", "High", None, QtGui.QApplication.UnicodeUTF8)) - self.label_13.setText(QtGui.QApplication.translate("MainWindow", "Anti-Aliasing", None, QtGui.QApplication.UnicodeUTF8)) - self.label_14.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) - self.label_16.setText(QtGui.QApplication.translate("MainWindow", "High", None, QtGui.QApplication.UnicodeUTF8)) - self.label_2.setText(QtGui.QApplication.translate("MainWindow", "Graphics Quality", None, QtGui.QApplication.UnicodeUTF8)) - self.label_8.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) - self.label_9.setText(QtGui.QApplication.translate("MainWindow", "Med.", None, QtGui.QApplication.UnicodeUTF8)) - self.label_10.setText(QtGui.QApplication.translate("MainWindow", "High", None, QtGui.QApplication.UnicodeUTF8)) - self.label_7.setText(QtGui.QApplication.translate("MainWindow", "Ultra", None, QtGui.QApplication.UnicodeUTF8)) - self.label_15.setText(QtGui.QApplication.translate("MainWindow", "Shadow Quality", None, QtGui.QApplication.UnicodeUTF8)) - self.label_23.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) - self.label_24.setText(QtGui.QApplication.translate("MainWindow", "High", None, QtGui.QApplication.UnicodeUTF8)) - self.label_17.setText(QtGui.QApplication.translate("MainWindow", "Anisotropic-Filtering", None, QtGui.QApplication.UnicodeUTF8)) - self.label_18.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) - self.label_19.setText(QtGui.QApplication.translate("MainWindow", "High", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_graphics.setTabText(self.tab_graphics.indexOf(self.tab_graphics1), QtGui.QApplication.translate("MainWindow", "Graphics", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_tq.setText(QtGui.QApplication.translate("MainWindow", "Texture Quality", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_tq_low.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_tq_high.setText(QtGui.QApplication.translate("MainWindow", "High", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_aa.setText(QtGui.QApplication.translate("MainWindow", "Anti-Aliasing", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_aa_low.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_aa_low1.setText(QtGui.QApplication.translate("MainWindow", "High", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_quality.setText(QtGui.QApplication.translate("MainWindow", "Graphics Quality", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_quality_low.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_quality_medium.setText(QtGui.QApplication.translate("MainWindow", "Med.", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_quality_high.setText(QtGui.QApplication.translate("MainWindow", "High", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_quality_ultra.setText(QtGui.QApplication.translate("MainWindow", "Ultra", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_sq.setText(QtGui.QApplication.translate("MainWindow", "Shadow Quality", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_sq_low.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_sq_high.setText(QtGui.QApplication.translate("MainWindow", "High", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_af.setText(QtGui.QApplication.translate("MainWindow", "Anisotropic-Filtering", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_af_low.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_gra_af_high.setText(QtGui.QApplication.translate("MainWindow", "High", None, QtGui.QApplication.UnicodeUTF8)) + self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_graphics), QtGui.QApplication.translate("MainWindow", "Graphics", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_aud_level.setTitle(QtGui.QApplication.translate("MainWindow", "Level", None, QtGui.QApplication.UnicodeUTF8)) - self.label_31.setText(QtGui.QApplication.translate("MainWindow", "NPC Voices", None, QtGui.QApplication.UnicodeUTF8)) - self.label_28.setText(QtGui.QApplication.translate("MainWindow", "Sound FX", None, QtGui.QApplication.UnicodeUTF8)) - self.label_29.setText(QtGui.QApplication.translate("MainWindow", "Ambience Sound", None, QtGui.QApplication.UnicodeUTF8)) - self.label_30.setText(QtGui.QApplication.translate("MainWindow", "Music", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_aud_npc.setText(QtGui.QApplication.translate("MainWindow", "NPC Voices", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_aud_fx.setText(QtGui.QApplication.translate("MainWindow", "Sound FX", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_aud_ambience.setText(QtGui.QApplication.translate("MainWindow", "Ambience Sound", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_aud_music.setText(QtGui.QApplication.translate("MainWindow", "Music", None, QtGui.QApplication.UnicodeUTF8)) self.cb_aud_mute.setText(QtGui.QApplication.translate("MainWindow", "Mute all", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_aud_hardware.setTitle(QtGui.QApplication.translate("MainWindow", "Hardware", None, QtGui.QApplication.UnicodeUTF8)) - self.label_34.setText(QtGui.QApplication.translate("MainWindow", "Sound Priority", None, QtGui.QApplication.UnicodeUTF8)) - self.label_35.setText(QtGui.QApplication.translate("MainWindow", "Audio Modes", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_aud_priority.setText(QtGui.QApplication.translate("MainWindow", "Sound Priority", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_aud_device_modes.setText(QtGui.QApplication.translate("MainWindow", "Audio Modes", None, QtGui.QApplication.UnicodeUTF8)) self.lb_aud_device.setText(QtGui.QApplication.translate("MainWindow", "Generic Software", None, QtGui.QApplication.UnicodeUTF8)) self.cb_aud_eax.setText(QtGui.QApplication.translate("MainWindow", "Enable EAX", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_voicechat.setTitle(QtGui.QApplication.translate("MainWindow", "Voice chat", None, QtGui.QApplication.UnicodeUTF8)) self.cb_aud_voicechat.setText(QtGui.QApplication.translate("MainWindow", "Enable Voice Chat", None, QtGui.QApplication.UnicodeUTF8)) - self.label_33.setText(QtGui.QApplication.translate("MainWindow", "Microphon Level", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_graphics.setTabText(self.tab_graphics.indexOf(self.tab_audio), QtGui.QApplication.translate("MainWindow", "Audio", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_aud_microphon.setText(QtGui.QApplication.translate("MainWindow", "Microphon Level", None, QtGui.QApplication.UnicodeUTF8)) + self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_audio), QtGui.QApplication.translate("MainWindow", "Audio", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_dnitime.setTitle(QtGui.QApplication.translate("MainWindow", "D\'ni time", None, QtGui.QApplication.UnicodeUTF8)) self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Time zones", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Cyan time:", None, QtGui.QApplication.UnicodeUTF8)) @@ -774,17 +751,16 @@ self.lb_cavern_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC -0", None, QtGui.QApplication.UnicodeUTF8)) self.label_11.setText(QtGui.QApplication.translate("MainWindow", "(Mountain Standard Time)", None, QtGui.QApplication.UnicodeUTF8)) self.label_12.setText(QtGui.QApplication.translate("MainWindow", "(Pacific Standard Time)", None, QtGui.QApplication.UnicodeUTF8)) - self.gb_dnitime.setTitle(QtGui.QApplication.translate("MainWindow", "D\'ni time", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_graphics.setTabText(self.tab_graphics.indexOf(self.tab_time), QtGui.QApplication.translate("MainWindow", "Time", None, QtGui.QApplication.UnicodeUTF8)) + self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_time), QtGui.QApplication.translate("MainWindow", "Time", None, QtGui.QApplication.UnicodeUTF8)) self.gb_servers.setTitle(QtGui.QApplication.translate("MainWindow", "Ping servers", None, QtGui.QApplication.UnicodeUTF8)) + self.button_ping.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) self.text_ping.setHtml(QtGui.QApplication.translate("MainWindow", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) - self.button_ping.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_graphics.setTabText(self.tab_graphics.indexOf(self.tab_ping), QtGui.QApplication.translate("MainWindow", "Servers", None, QtGui.QApplication.UnicodeUTF8)) + self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_ping), QtGui.QApplication.translate("MainWindow", "Servers", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setText(QtGui.QApplication.translate("MainWindow", "pyMoul tools", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_graphics.setTabText(self.tab_graphics.indexOf(self.tab_about), QtGui.QApplication.translate("MainWindow", "About", None, QtGui.QApplication.UnicodeUTF8)) + self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_about), QtGui.QApplication.translate("MainWindow", "About", None, QtGui.QApplication.UnicodeUTF8)) from moul.qt.ui import moulqt_rc Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-24 17:01:15 UTC (rev 68) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-24 18:26:59 UTC (rev 69) @@ -31,7 +31,7 @@ <property name="enabled" > <bool>true</bool> </property> - <widget class="QLabel" name="label" > + <widget class="QLabel" name="lb_top_image" > <property name="geometry" > <rect> <x>15</x> @@ -71,6 +71,9 @@ </property> <item> <widget class="QComboBox" name="comboBox" > + <property name="enabled" > + <bool>false</bool> + </property> <property name="font" > <font> <pointsize>6</pointsize> @@ -80,6 +83,9 @@ </item> <item> <widget class="QPushButton" name="pushButton" > + <property name="enabled" > + <bool>false</bool> + </property> <property name="sizePolicy" > <sizepolicy> <hsizetype>0</hsizetype> @@ -88,6 +94,18 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="maximumSize" > + <size> + <width>16777215</width> + <height>20</height> + </size> + </property> + <property name="baseSize" > + <size> + <width>0</width> + <height>20</height> + </size> + </property> <property name="font" > <font> <pointsize>8</pointsize> @@ -100,7 +118,7 @@ </item> </layout> </widget> - <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > + <widget class="QDialogButtonBox" name="main_buttonbox" > <property name="geometry" > <rect> <x>10</x> @@ -116,7 +134,7 @@ <set>QDialogButtonBox::Close|QDialogButtonBox::NoButton|QDialogButtonBox::Reset|QDialogButtonBox::Save</set> </property> </widget> - <widget class="QTabWidget" name="tab_graphics" > + <widget class="QTabWidget" name="tabwidget" > <property name="geometry" > <rect> <x>5</x> @@ -150,58 +168,6 @@ <property name="title" > <string/> </property> - <widget class="QGroupBox" name="groupBox_4" > - <property name="geometry" > - <rect> - <x>250</x> - <y>100</y> - <width>201</width> - <height>71</height> - </rect> - </property> - <property name="title" > - <string/> - </property> - <widget class="QWidget" name="verticalLayout_4" > - <property name="geometry" > - <rect> - <x>10</x> - <y>0</y> - <width>160</width> - <height>71</height> - </rect> - </property> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QCheckBox" name="checkBox_4" > - <property name="text" > - <string>CheckBox</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkBox_5" > - <property name="text" > - <string>CheckBox</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkBox_6" > - <property name="text" > - <string>CheckBox</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> <widget class="QWidget" name="verticalLayout" > <property name="geometry" > <rect> @@ -340,7 +306,7 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_20" > + <widget class="QLabel" name="lb_gra_tq" > <property name="text" > <string>Texture Quality</string> </property> @@ -389,14 +355,14 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_21" > + <widget class="QLabel" name="lb_gra_tq_low" > <property name="text" > <string>Low</string> </property> </widget> </item> <item> - <widget class="QLabel" name="label_22" > + <widget class="QLabel" name="lb_gra_tq_high" > <property name="text" > <string>High</string> </property> @@ -426,7 +392,7 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_13" > + <widget class="QLabel" name="lb_gra_aa" > <property name="text" > <string>Anti-Aliasing</string> </property> @@ -478,14 +444,14 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_14" > + <widget class="QLabel" name="lb_gra_aa_low" > <property name="text" > <string>Low</string> </property> </widget> </item> <item> - <widget class="QLabel" name="label_16" > + <widget class="QLabel" name="lb_gra_aa_low" > <property name="text" > <string>High</string> </property> @@ -515,7 +481,7 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_2" > + <widget class="QLabel" name="lb_gra_quality" > <property name="text" > <string>Graphics Quality</string> </property> @@ -564,14 +530,14 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_8" > + <widget class="QLabel" name="lb_gra_quality_low" > <property name="text" > <string>Low</string> </property> </widget> </item> <item> - <widget class="QLabel" name="label_9" > + <widget class="QLabel" name="lb_gra_quality_medium" > <property name="text" > <string>Med.</string> </property> @@ -581,7 +547,7 @@ </widget> </item> <item> - <widget class="QLabel" name="label_10" > + <widget class="QLabel" name="lb_gra_quality_high" > <property name="text" > <string>High</string> </property> @@ -591,7 +557,7 @@ </widget> </item> <item> - <widget class="QLabel" name="label_7" > + <widget class="QLabel" name="lb_gra_quality_ultra" > <property name="text" > <string>Ultra</string> </property> @@ -621,7 +587,7 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_15" > + <widget class="QLabel" name="lb_gra_sq" > <property name="text" > <string>Shadow Quality</string> </property> @@ -670,14 +636,14 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_23" > + <widget class="QLabel" name="lb_gra_sq_low" > <property name="text" > <string>Low</string> </property> </widget> </item> <item> - <widget class="QLabel" name="label_24" > + <widget class="QLabel" name="lb_gra_sq_high" > <property name="text" > <string>High</string> </property> @@ -707,7 +673,7 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_17" > + <widget class="QLabel" name="lb_gra_af" > <property name="text" > <string>Anisotropic-Filtering</string> </property> @@ -756,14 +722,14 @@ <number>6</number> ... [truncated message content] |
From: <ti...@us...> - 2007-01-24 17:01:22
|
Revision: 68 http://pymoul.svn.sourceforge.net/pymoul/?rev=68&view=rev Author: tiran Date: 2007-01-24 09:01:15 -0800 (Wed, 24 Jan 2007) Log Message: ----------- Fixed some min/max values for sliders Added some useful comments about values Modified Paths: -------------- pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-01-24 16:16:39 UTC (rev 67) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-01-24 17:01:15 UTC (rev 68) @@ -458,17 +458,18 @@ class AudioIni(ConfFile): _filename = 'audio.ini' _options = { - 'Audio.Initialize' : (BoolString, Constrain()), - 'Audio.UseEAX' : (BoolString, Constrain()), - 'Audio.SetPriorityCutoff' : (int, Constrain()), - 'Audio.MuteAll' : (int, MinMax(0, 1)), - 'Audio.SetChannelVolume SoundFX' : (FloatString, MinMax(0.0, 1.0)), - 'Audio.SetChannelVolume BgndMusic' : (FloatString, MinMax(0.0, 1.0)), - 'Audio.SetChannelVolume Ambience' : (FloatString, MinMax(0.0, 1.0)), - 'Audio.SetChannelVolume NPCVoice' : (FloatString, MinMax(0.0, 1.0)), - 'Audio.EnableVoiceRecording' : (int, MinMax(0, 1)), + 'Audio.Initialize' : (BoolString, Constrain()), # true/false, no ui + 'Audio.UseEAX' : (BoolString, Constrain()), # true/false + 'Audio.SetPriorityCutoff' : (int, Constrain()), # ??? + 'Audio.MuteAll' : (int, MinMax(0, 1)), # 0, 1 + 'Audio.SetChannelVolume SoundFX' : (FloatString, MinMax(0.0, 1.0)), # 0-100% + 'Audio.SetChannelVolume BgndMusic' : (FloatString, MinMax(0.0, 1.0)), # 0-100% + 'Audio.SetChannelVolume Ambience' : (FloatString, MinMax(0.0, 1.0)), # 0-100% + 'Audio.SetChannelVolume NPCVoice' : (FloatString, MinMax(0.0, 1.0)), # 0-100% + 'Audio.EnableVoiceRecording' : (int, MinMax(0, 1)), # 0, 1 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check - 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), + 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), # 0-100%, no ui + # microphon missing -> OS mixer } _devices = ['Generic Software', 'Generic Hardware'] # plus maybe a custom OpenAL v1.1 device @@ -547,16 +548,16 @@ _options = { 'Graphics.Width' : (int, Contains(videoModes.widths())), 'Graphics.Height' : (int, Contains(videoModes.heights())), - 'Graphics.ColorDepth' : (int, Constrain()), # no ui - 'Graphics.Windowed' : (BoolString, Constrain()), - 'Graphics.AntiAliasAmount' : (int, MinMax(1,4)), - 'Graphics.AnisotropicLevel' : (int, MinMax(1,5)), - 'Graphics.TextureQuality' : (int, MinMax(1,3)), - 'Quality.Level' : (int, MinMax(1,4)), - 'Graphics.Shadow.Enable' : (int, MinMax(0, 1)), - 'Graphics.EnablePlanarReflections' : (int, MinMax(0, 1)), # no ui - 'Graphics.EnableVSync' : (BoolString, Constrain()), - 'Graphics.Shadow.VisibleDistance' : (FloatString, MinMax(0.0, 1.0)), + 'Graphics.ColorDepth' : (int, Constrain()), # no ui, 32 + 'Graphics.Windowed' : (BoolString, Constrain()), # true/false + 'Graphics.AntiAliasAmount' : (int, MinMax(0,6)), # 0 - 6; 4 + 'Graphics.AnisotropicLevel' : (int, MinMax(1,16)), # 1 - 16; 5 + 'Graphics.TextureQuality' : (int, MinMax(0,2)), # 0-2, 3 + 'Quality.Level' : (int, MinMax(0,3)), # 0-3, 4 + 'Graphics.Shadow.Enable' : (int, MinMax(0, 1)), # 0, 1 + 'Graphics.EnablePlanarReflections' : (int, MinMax(0, 1)), # 0,1; no ui + 'Graphics.EnableVSync' : (BoolString, Constrain()), # true/false + 'Graphics.Shadow.VisibleDistance' : (FloatString, MinMax(0.0, 1.0)), # 0-1, 0-100% } def _getScreenRes(self): Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-24 16:16:39 UTC (rev 67) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-24 17:01:15 UTC (rev 68) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Wed Jan 24 16:49:25 2007 +# Created: Wed Jan 24 17:55:00 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -79,6 +79,86 @@ self.tab_graphics1 = QtGui.QWidget() self.tab_graphics1.setObjectName("tab_graphics1") + self.groupBox_gra_checkboxes = QtGui.QGroupBox(self.tab_graphics1) + self.groupBox_gra_checkboxes.setEnabled(True) + self.groupBox_gra_checkboxes.setGeometry(QtCore.QRect(240,10,201,71)) + self.groupBox_gra_checkboxes.setObjectName("groupBox_gra_checkboxes") + + self.groupBox_4 = QtGui.QGroupBox(self.groupBox_gra_checkboxes) + self.groupBox_4.setGeometry(QtCore.QRect(250,100,201,71)) + self.groupBox_4.setObjectName("groupBox_4") + + self.verticalLayout_4 = QtGui.QWidget(self.groupBox_4) + self.verticalLayout_4.setGeometry(QtCore.QRect(10,0,160,71)) + self.verticalLayout_4.setObjectName("verticalLayout_4") + + self.vboxlayout = QtGui.QVBoxLayout(self.verticalLayout_4) + self.vboxlayout.setMargin(0) + self.vboxlayout.setSpacing(6) + self.vboxlayout.setObjectName("vboxlayout") + + self.checkBox_4 = QtGui.QCheckBox(self.verticalLayout_4) + self.checkBox_4.setObjectName("checkBox_4") + self.vboxlayout.addWidget(self.checkBox_4) + + self.checkBox_5 = QtGui.QCheckBox(self.verticalLayout_4) + self.checkBox_5.setObjectName("checkBox_5") + self.vboxlayout.addWidget(self.checkBox_5) + + self.checkBox_6 = QtGui.QCheckBox(self.verticalLayout_4) + self.checkBox_6.setObjectName("checkBox_6") + self.vboxlayout.addWidget(self.checkBox_6) + + self.verticalLayout = QtGui.QWidget(self.groupBox_gra_checkboxes) + self.verticalLayout.setGeometry(QtCore.QRect(10,0,160,71)) + self.verticalLayout.setObjectName("verticalLayout") + + self.vboxlayout1 = QtGui.QVBoxLayout(self.verticalLayout) + self.vboxlayout1.setMargin(0) + self.vboxlayout1.setSpacing(6) + self.vboxlayout1.setObjectName("vboxlayout1") + + self.cb_gra_windowed = QtGui.QCheckBox(self.verticalLayout) + self.cb_gra_windowed.setObjectName("cb_gra_windowed") + self.vboxlayout1.addWidget(self.cb_gra_windowed) + + self.cb_gra_vsync = QtGui.QCheckBox(self.verticalLayout) + self.cb_gra_vsync.setObjectName("cb_gra_vsync") + self.vboxlayout1.addWidget(self.cb_gra_vsync) + + self.cb_gra_shadow = QtGui.QCheckBox(self.verticalLayout) + self.cb_gra_shadow.setObjectName("cb_gra_shadow") + self.vboxlayout1.addWidget(self.cb_gra_shadow) + + self.groupBox_screenres = QtGui.QGroupBox(self.tab_graphics1) + self.groupBox_screenres.setGeometry(QtCore.QRect(10,0,220,81)) + self.groupBox_screenres.setObjectName("groupBox_screenres") + + self.verticalLayout_2 = QtGui.QWidget(self.groupBox_screenres) + self.verticalLayout_2.setGeometry(QtCore.QRect(20,20,181,51)) + self.verticalLayout_2.setObjectName("verticalLayout_2") + + self.vboxlayout2 = QtGui.QVBoxLayout(self.verticalLayout_2) + self.vboxlayout2.setMargin(0) + self.vboxlayout2.setSpacing(6) + self.vboxlayout2.setObjectName("vboxlayout2") + + self.sl_gra_screenres = QtGui.QSlider(self.verticalLayout_2) + self.sl_gra_screenres.setMaximum(10) + self.sl_gra_screenres.setPageStep(1) + self.sl_gra_screenres.setSliderPosition(0) + self.sl_gra_screenres.setTracking(False) + self.sl_gra_screenres.setOrientation(QtCore.Qt.Horizontal) + self.sl_gra_screenres.setTickPosition(QtGui.QSlider.TicksBelow) + self.sl_gra_screenres.setTickInterval(1) + self.sl_gra_screenres.setObjectName("sl_gra_screenres") + self.vboxlayout2.addWidget(self.sl_gra_screenres) + + self.lb_screenres = QtGui.QLabel(self.verticalLayout_2) + self.lb_screenres.setAlignment(QtCore.Qt.AlignCenter) + self.lb_screenres.setObjectName("lb_screenres") + self.vboxlayout2.addWidget(self.lb_screenres) + self.groupBox_gra_quality = QtGui.QGroupBox(self.tab_graphics1) self.groupBox_gra_quality.setEnabled(True) self.groupBox_gra_quality.setGeometry(QtCore.QRect(10,79,430,261)) @@ -88,27 +168,28 @@ self.verticalLayout_7.setGeometry(QtCore.QRect(230,20,179,71)) self.verticalLayout_7.setObjectName("verticalLayout_7") - self.vboxlayout = QtGui.QVBoxLayout(self.verticalLayout_7) - self.vboxlayout.setMargin(0) - self.vboxlayout.setSpacing(6) - self.vboxlayout.setObjectName("vboxlayout") + self.vboxlayout3 = QtGui.QVBoxLayout(self.verticalLayout_7) + self.vboxlayout3.setMargin(0) + self.vboxlayout3.setSpacing(6) + self.vboxlayout3.setObjectName("vboxlayout3") self.label_20 = QtGui.QLabel(self.verticalLayout_7) self.label_20.setAlignment(QtCore.Qt.AlignCenter) self.label_20.setObjectName("label_20") - self.vboxlayout.addWidget(self.label_20) + self.vboxlayout3.addWidget(self.label_20) self.sl_gra_texture = QtGui.QSlider(self.verticalLayout_7) - self.sl_gra_texture.setMinimum(1) - self.sl_gra_texture.setMaximum(3) + self.sl_gra_texture.setMinimum(0) + self.sl_gra_texture.setMaximum(2) self.sl_gra_texture.setPageStep(1) - self.sl_gra_texture.setSliderPosition(1) + self.sl_gra_texture.setProperty("value",QtCore.QVariant(0)) + self.sl_gra_texture.setSliderPosition(0) self.sl_gra_texture.setTracking(False) self.sl_gra_texture.setOrientation(QtCore.Qt.Horizontal) self.sl_gra_texture.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_gra_texture.setTickInterval(1) self.sl_gra_texture.setObjectName("sl_gra_texture") - self.vboxlayout.addWidget(self.sl_gra_texture) + self.vboxlayout3.addWidget(self.sl_gra_texture) self.hboxlayout1 = QtGui.QHBoxLayout() self.hboxlayout1.setMargin(0) @@ -123,33 +204,35 @@ self.label_22.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_22.setObjectName("label_22") self.hboxlayout1.addWidget(self.label_22) - self.vboxlayout.addLayout(self.hboxlayout1) + self.vboxlayout3.addLayout(self.hboxlayout1) self.verticalLayout_5 = QtGui.QWidget(self.groupBox_gra_quality) self.verticalLayout_5.setGeometry(QtCore.QRect(20,100,179,71)) self.verticalLayout_5.setObjectName("verticalLayout_5") - self.vboxlayout1 = QtGui.QVBoxLayout(self.verticalLayout_5) - self.vboxlayout1.setMargin(0) - self.vboxlayout1.setSpacing(6) - self.vboxlayout1.setObjectName("vboxlayout1") + self.vboxlayout4 = QtGui.QVBoxLayout(self.verticalLayout_5) + self.vboxlayout4.setMargin(0) + self.vboxlayout4.setSpacing(6) + self.vboxlayout4.setObjectName("vboxlayout4") self.label_13 = QtGui.QLabel(self.verticalLayout_5) self.label_13.setAlignment(QtCore.Qt.AlignCenter) self.label_13.setObjectName("label_13") - self.vboxlayout1.addWidget(self.label_13) + self.vboxlayout4.addWidget(self.label_13) self.sl_gra_antialias = QtGui.QSlider(self.verticalLayout_5) - self.sl_gra_antialias.setMinimum(1) - self.sl_gra_antialias.setMaximum(4) - self.sl_gra_antialias.setPageStep(1) - self.sl_gra_antialias.setSliderPosition(1) + self.sl_gra_antialias.setMinimum(0) + self.sl_gra_antialias.setMaximum(6) + self.sl_gra_antialias.setSingleStep(2) + self.sl_gra_antialias.setPageStep(2) + self.sl_gra_antialias.setProperty("value",QtCore.QVariant(0)) + self.sl_gra_antialias.setSliderPosition(0) self.sl_gra_antialias.setTracking(False) self.sl_gra_antialias.setOrientation(QtCore.Qt.Horizontal) self.sl_gra_antialias.setTickPosition(QtGui.QSlider.TicksBelow) - self.sl_gra_antialias.setTickInterval(1) + self.sl_gra_antialias.setTickInterval(2) self.sl_gra_antialias.setObjectName("sl_gra_antialias") - self.vboxlayout1.addWidget(self.sl_gra_antialias) + self.vboxlayout4.addWidget(self.sl_gra_antialias) self.hboxlayout2 = QtGui.QHBoxLayout() self.hboxlayout2.setMargin(0) @@ -164,33 +247,34 @@ self.label_16.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_16.setObjectName("label_16") self.hboxlayout2.addWidget(self.label_16) - self.vboxlayout1.addLayout(self.hboxlayout2) + self.vboxlayout4.addLayout(self.hboxlayout2) self.verticalLayout_3 = QtGui.QWidget(self.groupBox_gra_quality) self.verticalLayout_3.setGeometry(QtCore.QRect(20,20,179,71)) self.verticalLayout_3.setObjectName("verticalLayout_3") - self.vboxlayout2 = QtGui.QVBoxLayout(self.verticalLayout_3) - self.vboxlayout2.setMargin(0) - self.vboxlayout2.setSpacing(6) - self.vboxlayout2.setObjectName("vboxlayout2") + self.vboxlayout5 = QtGui.QVBoxLayout(self.verticalLayout_3) + self.vboxlayout5.setMargin(0) + self.vboxlayout5.setSpacing(6) + self.vboxlayout5.setObjectName("vboxlayout5") self.label_2 = QtGui.QLabel(self.verticalLayout_3) self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName("label_2") - self.vboxlayout2.addWidget(self.label_2) + self.vboxlayout5.addWidget(self.label_2) self.sl_gra_quality = QtGui.QSlider(self.verticalLayout_3) - self.sl_gra_quality.setMinimum(1) - self.sl_gra_quality.setMaximum(4) + self.sl_gra_quality.setMinimum(0) + self.sl_gra_quality.setMaximum(3) self.sl_gra_quality.setPageStep(1) - self.sl_gra_quality.setSliderPosition(1) + self.sl_gra_quality.setProperty("value",QtCore.QVariant(0)) + self.sl_gra_quality.setSliderPosition(0) self.sl_gra_quality.setTracking(False) self.sl_gra_quality.setOrientation(QtCore.Qt.Horizontal) self.sl_gra_quality.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_gra_quality.setTickInterval(1) self.sl_gra_quality.setObjectName("sl_gra_quality") - self.vboxlayout2.addWidget(self.sl_gra_quality) + self.vboxlayout5.addWidget(self.sl_gra_quality) self.hboxlayout3 = QtGui.QHBoxLayout() self.hboxlayout3.setMargin(0) @@ -215,21 +299,21 @@ self.label_7.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_7.setObjectName("label_7") self.hboxlayout3.addWidget(self.label_7) - self.vboxlayout2.addLayout(self.hboxlayout3) + self.vboxlayout5.addLayout(self.hboxlayout3) self.verticalLayout_8 = QtGui.QWidget(self.groupBox_gra_quality) self.verticalLayout_8.setGeometry(QtCore.QRect(20,180,179,71)) self.verticalLayout_8.setObjectName("verticalLayout_8") - self.vboxlayout3 = QtGui.QVBoxLayout(self.verticalLayout_8) - self.vboxlayout3.setMargin(0) - self.vboxlayout3.setSpacing(6) - self.vboxlayout3.setObjectName("vboxlayout3") + self.vboxlayout6 = QtGui.QVBoxLayout(self.verticalLayout_8) + self.vboxlayout6.setMargin(0) + self.vboxlayout6.setSpacing(6) + self.vboxlayout6.setObjectName("vboxlayout6") self.label_15 = QtGui.QLabel(self.verticalLayout_8) self.label_15.setAlignment(QtCore.Qt.AlignCenter) self.label_15.setObjectName("label_15") - self.vboxlayout3.addWidget(self.label_15) + self.vboxlayout6.addWidget(self.label_15) self.sl_gra_shadow = QtGui.QSlider(self.verticalLayout_8) self.sl_gra_shadow.setMinimum(0) @@ -242,7 +326,7 @@ self.sl_gra_shadow.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_gra_shadow.setTickInterval(25) self.sl_gra_shadow.setObjectName("sl_gra_shadow") - self.vboxlayout3.addWidget(self.sl_gra_shadow) + self.vboxlayout6.addWidget(self.sl_gra_shadow) self.hboxlayout4 = QtGui.QHBoxLayout() self.hboxlayout4.setMargin(0) @@ -257,33 +341,34 @@ self.label_24.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_24.setObjectName("label_24") self.hboxlayout4.addWidget(self.label_24) - self.vboxlayout3.addLayout(self.hboxlayout4) + self.vboxlayout6.addLayout(self.hboxlayout4) self.verticalLayout_6 = QtGui.QWidget(self.groupBox_gra_quality) self.verticalLayout_6.setGeometry(QtCore.QRect(230,100,179,73)) self.verticalLayout_6.setObjectName("verticalLayout_6") - self.vboxlayout4 = QtGui.QVBoxLayout(self.verticalLayout_6) - self.vboxlayout4.setMargin(0) - self.vboxlayout4.setSpacing(6) - self.vboxlayout4.setObjectName("vboxlayout4") + self.vboxlayout7 = QtGui.QVBoxLayout(self.verticalLayout_6) + self.vboxlayout7.setMargin(0) + self.vboxlayout7.setSpacing(6) + self.vboxlayout7.setObjectName("vboxlayout7") self.label_17 = QtGui.QLabel(self.verticalLayout_6) self.label_17.setAlignment(QtCore.Qt.AlignCenter) self.label_17.setObjectName("label_17") - self.vboxlayout4.addWidget(self.label_17) + self.vboxlayout7.addWidget(self.label_17) self.sl_gra_anisotropic = QtGui.QSlider(self.verticalLayout_6) self.sl_gra_anisotropic.setMinimum(1) - self.sl_gra_anisotropic.setMaximum(5) - self.sl_gra_anisotropic.setPageStep(1) + self.sl_gra_anisotropic.setMaximum(16) + self.sl_gra_anisotropic.setSingleStep(3) + self.sl_gra_anisotropic.setPageStep(3) self.sl_gra_anisotropic.setSliderPosition(1) self.sl_gra_anisotropic.setTracking(False) self.sl_gra_anisotropic.setOrientation(QtCore.Qt.Horizontal) self.sl_gra_anisotropic.setTickPosition(QtGui.QSlider.TicksBelow) - self.sl_gra_anisotropic.setTickInterval(1) + self.sl_gra_anisotropic.setTickInterval(5) self.sl_gra_anisotropic.setObjectName("sl_gra_anisotropic") - self.vboxlayout4.addWidget(self.sl_gra_anisotropic) + self.vboxlayout7.addWidget(self.sl_gra_anisotropic) self.hboxlayout5 = QtGui.QHBoxLayout() self.hboxlayout5.setMargin(0) @@ -298,87 +383,7 @@ self.label_19.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_19.setObjectName("label_19") self.hboxlayout5.addWidget(self.label_19) - self.vboxlayout4.addLayout(self.hboxlayout5) - - self.groupBox_gra_checkboxes = QtGui.QGroupBox(self.tab_graphics1) - self.groupBox_gra_checkboxes.setEnabled(True) - self.groupBox_gra_checkboxes.setGeometry(QtCore.QRect(240,10,201,71)) - self.groupBox_gra_checkboxes.setObjectName("groupBox_gra_checkboxes") - - self.groupBox_4 = QtGui.QGroupBox(self.groupBox_gra_checkboxes) - self.groupBox_4.setGeometry(QtCore.QRect(250,100,201,71)) - self.groupBox_4.setObjectName("groupBox_4") - - self.verticalLayout_4 = QtGui.QWidget(self.groupBox_4) - self.verticalLayout_4.setGeometry(QtCore.QRect(10,0,160,71)) - self.verticalLayout_4.setObjectName("verticalLayout_4") - - self.vboxlayout5 = QtGui.QVBoxLayout(self.verticalLayout_4) - self.vboxlayout5.setMargin(0) - self.vboxlayout5.setSpacing(6) - self.vboxlayout5.setObjectName("vboxlayout5") - - self.checkBox_4 = QtGui.QCheckBox(self.verticalLayout_4) - self.checkBox_4.setObjectName("checkBox_4") - self.vboxlayout5.addWidget(self.checkBox_4) - - self.checkBox_5 = QtGui.QCheckBox(self.verticalLayout_4) - self.checkBox_5.setObjectName("checkBox_5") - self.vboxlayout5.addWidget(self.checkBox_5) - - self.checkBox_6 = QtGui.QCheckBox(self.verticalLayout_4) - self.checkBox_6.setObjectName("checkBox_6") - self.vboxlayout5.addWidget(self.checkBox_6) - - self.verticalLayout = QtGui.QWidget(self.groupBox_gra_checkboxes) - self.verticalLayout.setGeometry(QtCore.QRect(10,0,160,71)) - self.verticalLayout.setObjectName("verticalLayout") - - self.vboxlayout6 = QtGui.QVBoxLayout(self.verticalLayout) - self.vboxlayout6.setMargin(0) - self.vboxlayout6.setSpacing(6) - self.vboxlayout6.setObjectName("vboxlayout6") - - self.cb_gra_windowed = QtGui.QCheckBox(self.verticalLayout) - self.cb_gra_windowed.setObjectName("cb_gra_windowed") - self.vboxlayout6.addWidget(self.cb_gra_windowed) - - self.cb_gra_vsync = QtGui.QCheckBox(self.verticalLayout) - self.cb_gra_vsync.setObjectName("cb_gra_vsync") - self.vboxlayout6.addWidget(self.cb_gra_vsync) - - self.cb_gra_shadow = QtGui.QCheckBox(self.verticalLayout) - self.cb_gra_shadow.setObjectName("cb_gra_shadow") - self.vboxlayout6.addWidget(self.cb_gra_shadow) - - self.groupBox_screenres = QtGui.QGroupBox(self.tab_graphics1) - self.groupBox_screenres.setGeometry(QtCore.QRect(10,0,220,81)) - self.groupBox_screenres.setObjectName("groupBox_screenres") - - self.verticalLayout_2 = QtGui.QWidget(self.groupBox_screenres) - self.verticalLayout_2.setGeometry(QtCore.QRect(20,20,181,51)) - self.verticalLayout_2.setObjectName("verticalLayout_2") - - self.vboxlayout7 = QtGui.QVBoxLayout(self.verticalLayout_2) - self.vboxlayout7.setMargin(0) - self.vboxlayout7.setSpacing(6) - self.vboxlayout7.setObjectName("vboxlayout7") - - self.sl_gra_screenres = QtGui.QSlider(self.verticalLayout_2) - self.sl_gra_screenres.setMaximum(10) - self.sl_gra_screenres.setPageStep(1) - self.sl_gra_screenres.setSliderPosition(0) - self.sl_gra_screenres.setTracking(False) - self.sl_gra_screenres.setOrientation(QtCore.Qt.Horizontal) - self.sl_gra_screenres.setTickPosition(QtGui.QSlider.TicksBelow) - self.sl_gra_screenres.setTickInterval(1) - self.sl_gra_screenres.setObjectName("sl_gra_screenres") - self.vboxlayout7.addWidget(self.sl_gra_screenres) - - self.lb_screenres = QtGui.QLabel(self.verticalLayout_2) - self.lb_screenres.setAlignment(QtCore.Qt.AlignCenter) - self.lb_screenres.setObjectName("lb_screenres") - self.vboxlayout7.addWidget(self.lb_screenres) + self.vboxlayout7.addLayout(self.hboxlayout5) self.tab_graphics.addTab(self.tab_graphics1,"") self.tab_audio = QtGui.QWidget() @@ -720,6 +725,14 @@ def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Tool for Myst Online", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Configure", None, QtGui.QApplication.UnicodeUTF8)) + self.checkBox_4.setText(QtGui.QApplication.translate("MainWindow", "CheckBox", None, QtGui.QApplication.UnicodeUTF8)) + self.checkBox_5.setText(QtGui.QApplication.translate("MainWindow", "CheckBox", None, QtGui.QApplication.UnicodeUTF8)) + self.checkBox_6.setText(QtGui.QApplication.translate("MainWindow", "CheckBox", None, QtGui.QApplication.UnicodeUTF8)) + self.cb_gra_windowed.setText(QtGui.QApplication.translate("MainWindow", "Windowed", None, QtGui.QApplication.UnicodeUTF8)) + self.cb_gra_vsync.setText(QtGui.QApplication.translate("MainWindow", "Vertical Sync", None, QtGui.QApplication.UnicodeUTF8)) + self.cb_gra_shadow.setText(QtGui.QApplication.translate("MainWindow", "Display Shadows", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox_screenres.setTitle(QtGui.QApplication.translate("MainWindow", "Screen Resolution", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_screenres.setText(QtGui.QApplication.translate("MainWindow", "800x600 (4:3)", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_gra_quality.setTitle(QtGui.QApplication.translate("MainWindow", "Quality", None, QtGui.QApplication.UnicodeUTF8)) self.label_20.setText(QtGui.QApplication.translate("MainWindow", "Texture Quality", None, QtGui.QApplication.UnicodeUTF8)) self.label_21.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) @@ -738,14 +751,6 @@ self.label_17.setText(QtGui.QApplication.translate("MainWindow", "Anisotropic-Filtering", None, QtGui.QApplication.UnicodeUTF8)) self.label_18.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) self.label_19.setText(QtGui.QApplication.translate("MainWindow", "High", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_4.setText(QtGui.QApplication.translate("MainWindow", "CheckBox", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_5.setText(QtGui.QApplication.translate("MainWindow", "CheckBox", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_6.setText(QtGui.QApplication.translate("MainWindow", "CheckBox", None, QtGui.QApplication.UnicodeUTF8)) - self.cb_gra_windowed.setText(QtGui.QApplication.translate("MainWindow", "Windowed", None, QtGui.QApplication.UnicodeUTF8)) - self.cb_gra_vsync.setText(QtGui.QApplication.translate("MainWindow", "Vertical Sync", None, QtGui.QApplication.UnicodeUTF8)) - self.cb_gra_shadow.setText(QtGui.QApplication.translate("MainWindow", "Display Shadows", None, QtGui.QApplication.UnicodeUTF8)) - self.groupBox_screenres.setTitle(QtGui.QApplication.translate("MainWindow", "Screen Resolution", None, QtGui.QApplication.UnicodeUTF8)) - self.lb_screenres.setText(QtGui.QApplication.translate("MainWindow", "800x600 (4:3)", None, QtGui.QApplication.UnicodeUTF8)) self.tab_graphics.setTabText(self.tab_graphics.indexOf(self.tab_graphics1), QtGui.QApplication.translate("MainWindow", "Graphics", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_aud_level.setTitle(QtGui.QApplication.translate("MainWindow", "Level", None, QtGui.QApplication.UnicodeUTF8)) self.label_31.setText(QtGui.QApplication.translate("MainWindow", "NPC Voices", None, QtGui.QApplication.UnicodeUTF8)) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-24 16:16:39 UTC (rev 67) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-24 17:01:15 UTC (rev 68) @@ -135,6 +135,179 @@ <attribute name="title" > <string>Graphics</string> </attribute> + <widget class="QGroupBox" name="groupBox_gra_checkboxes" > + <property name="enabled" > + <bool>true</bool> + </property> + <property name="geometry" > + <rect> + <x>240</x> + <y>10</y> + <width>201</width> + <height>71</height> + </rect> + </property> + <property name="title" > + <string/> + </property> + <widget class="QGroupBox" name="groupBox_4" > + <property name="geometry" > + <rect> + <x>250</x> + <y>100</y> + <width>201</width> + <height>71</height> + </rect> + </property> + <property name="title" > + <string/> + </property> + <widget class="QWidget" name="verticalLayout_4" > + <property name="geometry" > + <rect> + <x>10</x> + <y>0</y> + <width>160</width> + <height>71</height> + </rect> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QCheckBox" name="checkBox_4" > + <property name="text" > + <string>CheckBox</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkBox_5" > + <property name="text" > + <string>CheckBox</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkBox_6" > + <property name="text" > + <string>CheckBox</string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + <widget class="QWidget" name="verticalLayout" > + <property name="geometry" > + <rect> + <x>10</x> + <y>0</y> + <width>160</width> + <height>71</height> + </rect> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QCheckBox" name="cb_gra_windowed" > + <property name="text" > + <string>Windowed</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cb_gra_vsync" > + <property name="text" > + <string>Vertical Sync</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cb_gra_shadow" > + <property name="text" > + <string>Display Shadows</string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_screenres" > + <property name="geometry" > + <rect> + <x>10</x> + <y>0</y> + <width>220</width> + <height>81</height> + </rect> + </property> + <property name="title" > + <string>Screen Resolution</string> + </property> + <widget class="QWidget" name="verticalLayout_2" > + <property name="geometry" > + <rect> + <x>20</x> + <y>20</y> + <width>181</width> + <height>51</height> + </rect> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QSlider" name="sl_gra_screenres" > + <property name="maximum" > + <number>10</number> + </property> + <property name="pageStep" > + <number>1</number> + </property> + <property name="sliderPosition" > + <number>0</number> + </property> + <property name="tracking" > + <bool>false</bool> + </property> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition" > + <enum>QSlider::TicksBelow</enum> + </property> + <property name="tickInterval" > + <number>1</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="lb_screenres" > + <property name="text" > + <string>800x600 (4:3)</string> + </property> + <property name="alignment" > + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </widget> <widget class="QGroupBox" name="groupBox_gra_quality" > <property name="enabled" > <bool>true</bool> @@ -179,16 +352,19 @@ <item> <widget class="QSlider" name="sl_gra_texture" > <property name="minimum" > - <number>1</number> + <number>0</number> </property> <property name="maximum" > - <number>3</number> + <number>2</number> </property> <property name="pageStep" > <number>1</number> </property> + <property name="value" > + <number>0</number> + </property> <property name="sliderPosition" > - <number>1</number> + <number>0</number> </property> <property name="tracking" > <bool>false</bool> @@ -262,16 +438,22 @@ <item> <widget class="QSlider" name="sl_gra_antialias" > <property name="minimum" > - <number>1</number> + <number>0</number> </property> <property name="maximum" > - <number>4</number> + <number>6</number> </property> + <property name="singleStep" > + <number>2</number> + </property> <property name="pageStep" > - <number>1</number> + <number>2</number> </property> + <property name="value" > + <number>0</number> + </property> <property name="sliderPosition" > - <number>1</number> + <number>0</number> </property> <property name="tracking" > <bool>false</bool> @@ -283,7 +465,7 @@ <enum>QSlider::TicksBelow</enum> </property> <property name="tickInterval" > - <number>1</number> + <number>2</number> </property> </widget> </item> @@ -345,16 +527,19 @@ <item> <widget class="QSlider" name="sl_gra_quality" > <property name="minimum" > - <number>1</number> + <number>0</number> </property> <property name="maximum" > - <number>4</number> + <number>3</number> </property> <property name="pageStep" > <number>1</number> </property> + <property name="value" > + <number>0</number> + </property> <property name="sliderPosition" > - <number>1</number> + <number>0</number> </property> <property name="tracking" > <bool>false</bool> @@ -537,10 +722,13 @@ <number>1</number> </property> <property name="maximum" > - <number>5</number> + <number>16</number> </property> + <property name="singleStep" > + <number>3</number> + </property> <property name="pageStep" > - <number>1</number> + <number>3</number> </property> <property name="sliderPosition" > <number>1</number> @@ -555,7 +743,7 @@ <enum>QSlider::TicksBelow</enum> </property> <property name="tickInterval" > - <number>1</number> + <number>5</number> </property> </widget> </item> @@ -589,179 +777,6 @@ </layout> </widget> </widget> - <widget class="QGroupBox" name="groupBox_gra_checkboxes" > - <property name="enabled" > - <bool>true</bool> - </property> - <property name="geometry" > - <rect> - <x>240</x> - <y>10</y> - <width>201</width> - <height>71</height> - </rect> - </property> - <property name="title" > - <string/> - </property> - <widget class="QGroupBox" name="groupBox_4" > - <property name="geometry" > - <rect> - <x>250</x> - <y>100</y> - <width>201</width> - <height>71</height> - </rect> - </property> - <property name="title" > - <string/> - </property> - <widget class="QWidget" name="verticalLayout_4" > - <property name="geometry" > - <rect> - <x>10</x> - <y>0</y> - <width>160</width> - <height>71</height> - </rect> - </property> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QCheckBox" name="checkBox_4" > - <property name="text" > - <string>CheckBox</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkBox_5" > - <property name="text" > - <string>CheckBox</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkBox_6" > - <property name="text" > - <string>CheckBox</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - <widget class="QWidget" name="verticalLayout" > - <property name="geometry" > - <rect> - <x>10</x> - <y>0</y> - <width>160</width> - <height>71</height> - </rect> - </property> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QCheckBox" name="cb_gra_windowed" > - <property name="text" > - <string>Windowed</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="cb_gra_vsync" > - <property name="text" > - <string>Vertical Sync</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="cb_gra_shadow" > - <property name="text" > - <string>Display Shadows</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - <widget class="QGroupBox" name="groupBox_screenres" > - <property name="geometry" > - <rect> - <x>10</x> - <y>0</y> - <width>220</width> - <height>81</height> - </rect> - </property> - <property name="title" > - <string>Screen Resolution</string> - </property> - <widget class="QWidget" name="verticalLayout_2" > - <property name="geometry" > - <rect> - <x>20</x> - <y>20</y> - <width>181</width> - <height>51</height> - </rect> - </property> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QSlider" name="sl_gra_screenres" > - <property name="maximum" > - <number>10</number> - </property> - <property name="pageStep" > - <number>1</number> - </property> - <property name="sliderPosition" > - <number>0</number> - </property> - <property name="tracking" > - <bool>false</bool> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition" > - <enum>QSlider::TicksBelow</enum> - </property> - <property name="tickInterval" > - <number>1</number> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="lb_screenres" > - <property name="text" > - <string>800x600 (4:3)</string> - </property> - <property name="alignment" > - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </widget> </widget> <widget class="QWidget" name="tab_audio" > <attribute name="title" > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-24 16:16:44
|
Revision: 67 http://pymoul.svn.sourceforge.net/pymoul/?rev=67&view=rev Author: tiran Date: 2007-01-24 08:16:39 -0800 (Wed, 24 Jan 2007) Log Message: ----------- Don't include _ssl.pyd. It's imported by socket but not required for MOUL Modified Paths: -------------- pymoul/trunk/setup_win32.py Modified: pymoul/trunk/setup_win32.py =================================================================== --- pymoul/trunk/setup_win32.py 2007-01-24 16:16:05 UTC (rev 66) +++ pymoul/trunk/setup_win32.py 2007-01-24 16:16:39 UTC (rev 67) @@ -69,6 +69,8 @@ pexe['compressed'] = 100 # compress zip file pexe['optimize'] = 0 # 0,1,2 pexe['includes'] = ['sip', 'PyQt4', 'encodings', 'encodings.*'] + # SSL currently not in use but imported by socket + pexe['excludes'] = ['_ssl'] # UPX pexe['upx'] = True pexe['upx_args'] = '--mono --best' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-24 16:16:20
|
Revision: 66 http://pymoul.svn.sourceforge.net/pymoul/?rev=66&view=rev Author: tiran Date: 2007-01-24 08:16:05 -0800 (Wed, 24 Jan 2007) Log Message: ----------- Now parses audio.ini and displays shadow setting Modified Paths: -------------- pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/log.py pymoul/trunk/src/moul/osdependent/win32/__init__.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-01-24 00:42:26 UTC (rev 65) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-01-24 16:16:05 UTC (rev 66) @@ -26,7 +26,10 @@ from moul.crypt.whatdoyousee import decryptWDYS from moul.crypt.whatdoyousee import encryptWDYS +from moul.log import getLogger +LOG = getLogger('moul.file.wdysini') + class BoolStringError(ValueError): pass @@ -147,6 +150,12 @@ def __repr__(self): return str(self) +class QuotedString(str): + """String with extra quotes around it + """ + # TODO: write me + pass + class Constrain(object): """Constrain for configuration values @@ -342,6 +351,7 @@ self.clear() if isinstance(fd_name, basestring): fd = open(fd_name, 'rb') + LOG.debug("Parsing encrypted file %s" % fd_name) close = True else: fd = fd_name @@ -379,7 +389,13 @@ raise ValueError(line) self._newdata = self._filedata.copy() - + self.parserDoneHook() + + def parserDoneHook(self): + """Hook called after the data is read and parsed + """ + pass + def isChanged(self): """Check if the data was changed """ @@ -418,7 +434,7 @@ fd.close() def _get(self, name): - """get descriptor helper + """get descriptor helper """ return self._newdata[name] @@ -426,7 +442,19 @@ """set descriptor helper """ self._newdata[name] = value + + def _getp(self, name): + """get descriptor helper for % sliders + + The slider must have values between 0 and 100 + """ + return int(self._newdata[name] * 100.0) + def _setp(self, name, value): + """set descriptor helper for % sliders + """ + self._newdata[name] = float(value / 100.0) + class AudioIni(ConfFile): _filename = 'audio.ini' _options = { @@ -439,10 +467,81 @@ 'Audio.SetChannelVolume Ambience' : (FloatString, MinMax(0.0, 1.0)), 'Audio.SetChannelVolume NPCVoice' : (FloatString, MinMax(0.0, 1.0)), 'Audio.EnableVoiceRecording' : (int, MinMax(0, 1)), - 'Audio.SetDeviceName' : (str, Constrain()), + 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), } + _devices = ['Generic Software', 'Generic Hardware'] + # plus maybe a custom OpenAL v1.1 device + + def parserDoneHook(self): + """Hook called after the data is read and parsed + """ + # check for OpenAL device + name = self._get('Audio.SetDeviceName') + if name not in self._devices: + LOG.debug("Device added: %s" % name) + self._devices.append(name) + + def getDeviceIdx(self, name): + """Get index by device name + """ + return self._devices.index(name) + def getDeviceName(self, idx): + """Get index by device name + """ + return self._devices[idx] + + def _setFx(self, value): + """Set property helper: SoundFX also changes GUI + """ + self._setp('Audio.SetChannelVolume SoundFX', value) + self._setp('Audio.SetChannelVolume GUI', value) + + def _getDevice(self): + """Get property helpe for device + """ + name = self._get('Audio.SetDeviceName') + return self.getDeviceIdx(name) + + def _setDevice(self, idx): + """Set property helpe for device + """ + name = self.getDeviceName(idx) + self._set('Audio.SetDeviceName', name) + + def numberOfDevices(self): + """Number of devices + """ + return len(self._devices) + + eax = property(lambda self: self._get('Audio.UseEAX'), + lambda self, v: self._set('Audio.UseEAX', v), + ) + mute = property(lambda self: self._get('Audio.MuteAll'), + lambda self, v: self._set('Audio.MuteAll', v), + ) + priority = property(lambda self: self._get('Audio.SetPriorityCutoff'), + lambda self, v: self._set('Audio.SetPriorityCutoff', v), + ) + enablevoice = property(lambda self: self._get('Audio.EnableVoiceRecording'), + lambda self, v: self._set('Audio.EnableVoiceRecording', v), + ) + device = property(_getDevice, _setDevice) + fx = property(lambda self: self._getp('Audio.SetChannelVolume SoundFX'), + _setFx, + ) + music = property(lambda self: self._getp('Audio.SetChannelVolume BgndMusic'), + lambda self, v: self._setp('Audio.SetChannelVolume BgndMusic', v), + ) + ambience = property(lambda self: self._getp('Audio.SetChannelVolume Ambience'), + lambda self, v: self._setp('Audio.SetChannelVolume Ambience', v), + ) + npc = property(lambda self: self._getp('Audio.SetChannelVolume NPCVoice'), + lambda self, v: self._setp('Audio.SetChannelVolume NPCVoice', v), + ) + # TODO: microphon needs an extra handler. The mic slider changes the OS mixer. + class GraphicsIni(ConfFile): _filename = 'graphics.ini' _options = { @@ -489,10 +588,9 @@ shadow_enabled = property(lambda self: self._get('Graphics.Shadow.Enable'), lambda self, v: self._set('Graphics.Shadow.Enable', v), ) - # XXX: shadows - #shadow = property(lambda self: self._get('Graphics.Shadow.VisibleDistance'), - # lambda self, v: self._set('Graphics.Shadow.VisibleDistance', v), - # ) + shadow = property(lambda self: self._getp('Graphics.Shadow.VisibleDistance'), + lambda self, v: self._setp('Graphics.Shadow.VisibleDistance', v), + ) vsync = property(lambda self: self._get('Graphics.EnableVSync'), lambda self, v: self._set('Graphics.EnableVSync', v), ) Modified: pymoul/trunk/src/moul/log.py =================================================================== --- pymoul/trunk/src/moul/log.py 2007-01-24 00:42:26 UTC (rev 65) +++ pymoul/trunk/src/moul/log.py 2007-01-24 16:16:05 UTC (rev 66) @@ -57,6 +57,7 @@ repr(args[1:]), repr(kwargs))) return func(*args, **kwargs) logwrapper.__name__ = func.__name__ + logwrapper.__doc__ = func.__doc__ return logwrapper else: return func Modified: pymoul/trunk/src/moul/osdependent/win32/__init__.py =================================================================== --- pymoul/trunk/src/moul/osdependent/win32/__init__.py 2007-01-24 00:42:26 UTC (rev 65) +++ pymoul/trunk/src/moul/osdependent/win32/__init__.py 2007-01-24 16:16:05 UTC (rev 66) @@ -24,7 +24,6 @@ import os #from moul.osdependent.win32.miniwinshell import my_documents #from moul.osdependent.win32.miniwinshell import application_data -#from win32com.directsound import directsound from moul.osdependent.win32.winpath import get_homedir from moul.osdependent.win32.winpath import get_appdata @@ -52,18 +51,10 @@ def _startMOUL(installdir, *args): """Start MOUL """ + # TODO: use subprocess module # P_DETACH is similar to P_NOWAIT, but the new process is detached from # the console of the calling process. mode = os.P_DETACH path = os.path.join(installdir, EXEC_NAME) args = (EXEC_NAME,) + args return os.spawnv(mode, path, args) - -#def enumSoundDevices(): -# """ -# """ -# names = [] -# for iid, name, driver in directsound.DirectSoundEnumerate(): -# if iid is not None: -# names.append(name) -# return names Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-24 00:42:26 UTC (rev 65) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-24 16:16:05 UTC (rev 66) @@ -33,7 +33,7 @@ from moul.qt.ui.mainwindow import Ui_MainWindow from moul.config import lookupDir -#from moul.file.wdysini import AudioIni +from moul.file.wdysini import AudioIni from moul.file.wdysini import GraphicsIni from moul.file.wdysini import videoModes from moul.log import getLogger @@ -56,6 +56,7 @@ # init handlers self._timezone_init() self._graphics_init() + self._audio_init() self._ping_init() self._systray_init() @@ -95,7 +96,8 @@ self.systemtray.setVisible(False) # ************************************************************************ - # graphics + # graphics settings + def _graphics_init(self): """init graphics tab """ @@ -123,7 +125,8 @@ self.sl_gra_texture.setValue(gini.texture) self.sl_gra_antialias.setValue(gini.antialias) self.sl_gra_anisotropic.setValue(gini.anisotropic) - # TODO: self.sl_gra_shadow.setValue(gini.shadow) + self.sl_gra_shadow.setValue(gini.shadow) + print gini.shadow self.cb_gra_windowed.setChecked(gini.windowed) self.cb_gra_vsync.setChecked(gini.vsync) self.cb_gra_shadow.setChecked(gini.shadow_enabled) @@ -193,6 +196,57 @@ """ # ************************************************************************ + # audio settings + + def _audio_init(self): + """init graphics tab + """ + inipath = lookupDir('ini') + self._audio_ini = aini = AudioIni() + try: + aini.open(inipath) + except Exception, msg: + LOG.exception("Something bad happened while parsing the audio.ini file") + QtGui.QMessageBox.critical(None, + self.trUtf8("Error opening audio.ini"), + self.trUtf8("""Something bad happend while opening the audio.ini\n%s""" % msg)) + return + + self.sl_aud_device.setMaximum(aini.numberOfDevices()-1) + + self.on_audioini_loaded(aini) # XXX: hard coded for testing purpose + + def on_audioini_loaded(self, aini): + """SIGNAL: graphicsIniLoaded(file) + """ + self.sl_aud_npc.setValue(aini.npc) + self.sl_aud_music.setValue(aini.music) + self.sl_aud_fx.setValue(aini.fx) + self.sl_aud_ambience.setValue(aini.ambience) + self.sl_aud_priority.setValue(aini.priority) + self.sl_aud_device.setValue(aini.device) + self.cb_aud_eax.setChecked(aini.eax) + self.cb_aud_mute.setChecked(aini.mute) + self.cb_aud_voicechat.setChecked(aini.enablevoice) + + @signalLogDecorator(LOG) + @pyqtSignature("int") + def on_sl_aud_device_valueChanged(self, idx): + """SIGNAL: valueChanged (int) + """ + # TODO: fixme + txt = self._audio_ini.getDeviceName(idx) + self.lb_aud_device.setText(QtCore.QString(txt)) + + @signalLogDecorator(LOG) + @pyqtSignature("int") + def on_sl_aud_device_sliderMoved(self, idx): + """SIGNAL: sliderMoved(int) + """ + txt = self._audio_ini.getDeviceName(idx) + self.lb_aud_device.setText(QtCore.QString(txt)) + + # ************************************************************************ # time zones def _timezone_init(self): Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-24 00:42:26 UTC (rev 65) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-24 16:16:05 UTC (rev 66) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Wed Jan 24 01:37:39 2007 +# Created: Wed Jan 24 16:49:25 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -232,14 +232,15 @@ self.vboxlayout3.addWidget(self.label_15) self.sl_gra_shadow = QtGui.QSlider(self.verticalLayout_8) - self.sl_gra_shadow.setMinimum(1) - self.sl_gra_shadow.setMaximum(3) - self.sl_gra_shadow.setPageStep(1) - self.sl_gra_shadow.setSliderPosition(1) + self.sl_gra_shadow.setMinimum(0) + self.sl_gra_shadow.setMaximum(100) + self.sl_gra_shadow.setPageStep(10) + self.sl_gra_shadow.setProperty("value",QtCore.QVariant(0)) + self.sl_gra_shadow.setSliderPosition(0) self.sl_gra_shadow.setTracking(False) self.sl_gra_shadow.setOrientation(QtCore.Qt.Horizontal) self.sl_gra_shadow.setTickPosition(QtGui.QSlider.TicksBelow) - self.sl_gra_shadow.setTickInterval(1) + self.sl_gra_shadow.setTickInterval(25) self.sl_gra_shadow.setObjectName("sl_gra_shadow") self.vboxlayout3.addWidget(self.sl_gra_shadow) @@ -415,46 +416,19 @@ self.sl_aud_npc.setObjectName("sl_aud_npc") self.vboxlayout8.addWidget(self.sl_aud_npc) - self.verticalLayout_11 = QtGui.QWidget(self.groupBox_aud_level) - self.verticalLayout_11.setGeometry(QtCore.QRect(20,80,179,43)) - self.verticalLayout_11.setObjectName("verticalLayout_11") + self.verticalLayout_9 = QtGui.QWidget(self.groupBox_aud_level) + self.verticalLayout_9.setGeometry(QtCore.QRect(20,30,179,43)) + self.verticalLayout_9.setObjectName("verticalLayout_9") - self.vboxlayout9 = QtGui.QVBoxLayout(self.verticalLayout_11) + self.vboxlayout9 = QtGui.QVBoxLayout(self.verticalLayout_9) self.vboxlayout9.setMargin(0) self.vboxlayout9.setSpacing(6) self.vboxlayout9.setObjectName("vboxlayout9") - self.label_30 = QtGui.QLabel(self.verticalLayout_11) - self.label_30.setAlignment(QtCore.Qt.AlignCenter) - self.label_30.setObjectName("label_30") - self.vboxlayout9.addWidget(self.label_30) - - self.sl_aud_music = QtGui.QSlider(self.verticalLayout_11) - self.sl_aud_music.setMinimum(0) - self.sl_aud_music.setMaximum(100) - self.sl_aud_music.setPageStep(10) - self.sl_aud_music.setProperty("value",QtCore.QVariant(0)) - self.sl_aud_music.setSliderPosition(0) - self.sl_aud_music.setTracking(False) - self.sl_aud_music.setOrientation(QtCore.Qt.Horizontal) - self.sl_aud_music.setTickPosition(QtGui.QSlider.TicksBelow) - self.sl_aud_music.setTickInterval(25) - self.sl_aud_music.setObjectName("sl_aud_music") - self.vboxlayout9.addWidget(self.sl_aud_music) - - self.verticalLayout_9 = QtGui.QWidget(self.groupBox_aud_level) - self.verticalLayout_9.setGeometry(QtCore.QRect(20,30,179,43)) - self.verticalLayout_9.setObjectName("verticalLayout_9") - - self.vboxlayout10 = QtGui.QVBoxLayout(self.verticalLayout_9) - self.vboxlayout10.setMargin(0) - self.vboxlayout10.setSpacing(6) - self.vboxlayout10.setObjectName("vboxlayout10") - self.label_28 = QtGui.QLabel(self.verticalLayout_9) self.label_28.setAlignment(QtCore.Qt.AlignCenter) self.label_28.setObjectName("label_28") - self.vboxlayout10.addWidget(self.label_28) + self.vboxlayout9.addWidget(self.label_28) self.sl_aud_fx = QtGui.QSlider(self.verticalLayout_9) self.sl_aud_fx.setMinimum(0) @@ -467,75 +441,66 @@ self.sl_aud_fx.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_aud_fx.setTickInterval(25) self.sl_aud_fx.setObjectName("sl_aud_fx") - self.vboxlayout10.addWidget(self.sl_aud_fx) + self.vboxlayout9.addWidget(self.sl_aud_fx) self.verticalLayout_10 = QtGui.QWidget(self.groupBox_aud_level) self.verticalLayout_10.setGeometry(QtCore.QRect(230,30,179,43)) self.verticalLayout_10.setObjectName("verticalLayout_10") - self.vboxlayout11 = QtGui.QVBoxLayout(self.verticalLayout_10) - self.vboxlayout11.setMargin(0) - self.vboxlayout11.setSpacing(6) - self.vboxlayout11.setObjectName("vboxlayout11") + self.vboxlayout10 = QtGui.QVBoxLayout(self.verticalLayout_10) + self.vboxlayout10.setMargin(0) + self.vboxlayout10.setSpacing(6) + self.vboxlayout10.setObjectName("vboxlayout10") self.label_29 = QtGui.QLabel(self.verticalLayout_10) self.label_29.setAlignment(QtCore.Qt.AlignCenter) self.label_29.setObjectName("label_29") - self.vboxlayout11.addWidget(self.label_29) + self.vboxlayout10.addWidget(self.label_29) - self.sl_aud_ambient = QtGui.QSlider(self.verticalLayout_10) - self.sl_aud_ambient.setMinimum(0) - self.sl_aud_ambient.setMaximum(100) - self.sl_aud_ambient.setPageStep(10) - self.sl_aud_ambient.setProperty("value",QtCore.QVariant(0)) - self.sl_aud_ambient.setSliderPosition(0) - self.sl_aud_ambient.setTracking(False) - self.sl_aud_ambient.setOrientation(QtCore.Qt.Horizontal) - self.sl_aud_ambient.setTickPosition(QtGui.QSlider.TicksBelow) - self.sl_aud_ambient.setTickInterval(25) - self.sl_aud_ambient.setObjectName("sl_aud_ambient") - self.vboxlayout11.addWidget(self.sl_aud_ambient) + self.sl_aud_ambience = QtGui.QSlider(self.verticalLayout_10) + self.sl_aud_ambience.setMinimum(0) + self.sl_aud_ambience.setMaximum(100) + self.sl_aud_ambience.setPageStep(10) + self.sl_aud_ambience.setProperty("value",QtCore.QVariant(0)) + self.sl_aud_ambience.setSliderPosition(0) + self.sl_aud_ambience.setTracking(False) + self.sl_aud_ambience.setOrientation(QtCore.Qt.Horizontal) + self.sl_aud_ambience.setTickPosition(QtGui.QSlider.TicksBelow) + self.sl_aud_ambience.setTickInterval(25) + self.sl_aud_ambience.setObjectName("sl_aud_ambience") + self.vboxlayout10.addWidget(self.sl_aud_ambience) - self.cb_aud_mute = QtGui.QCheckBox(self.groupBox_aud_level) - self.cb_aud_mute.setGeometry(QtCore.QRect(180,10,70,19)) - self.cb_aud_mute.setObjectName("cb_aud_mute") + self.verticalLayout_11 = QtGui.QWidget(self.groupBox_aud_level) + self.verticalLayout_11.setGeometry(QtCore.QRect(20,80,179,43)) + self.verticalLayout_11.setObjectName("verticalLayout_11") - self.groupBox_voicechat = QtGui.QGroupBox(self.tab_audio) - self.groupBox_voicechat.setEnabled(True) - self.groupBox_voicechat.setGeometry(QtCore.QRect(10,150,431,71)) - self.groupBox_voicechat.setObjectName("groupBox_voicechat") + self.vboxlayout11 = QtGui.QVBoxLayout(self.verticalLayout_11) + self.vboxlayout11.setMargin(0) + self.vboxlayout11.setSpacing(6) + self.vboxlayout11.setObjectName("vboxlayout11") - self.verticalLayout_13 = QtGui.QWidget(self.groupBox_voicechat) - self.verticalLayout_13.setGeometry(QtCore.QRect(20,20,179,43)) - self.verticalLayout_13.setObjectName("verticalLayout_13") + self.label_30 = QtGui.QLabel(self.verticalLayout_11) + self.label_30.setAlignment(QtCore.Qt.AlignCenter) + self.label_30.setObjectName("label_30") + self.vboxlayout11.addWidget(self.label_30) - self.vboxlayout12 = QtGui.QVBoxLayout(self.verticalLayout_13) - self.vboxlayout12.setMargin(0) - self.vboxlayout12.setSpacing(6) - self.vboxlayout12.setObjectName("vboxlayout12") + self.sl_aud_music = QtGui.QSlider(self.verticalLayout_11) + self.sl_aud_music.setMinimum(0) + self.sl_aud_music.setMaximum(100) + self.sl_aud_music.setPageStep(10) + self.sl_aud_music.setProperty("value",QtCore.QVariant(0)) + self.sl_aud_music.setSliderPosition(0) + self.sl_aud_music.setTracking(False) + self.sl_aud_music.setOrientation(QtCore.Qt.Horizontal) + self.sl_aud_music.setTickPosition(QtGui.QSlider.TicksBelow) + self.sl_aud_music.setTickInterval(25) + self.sl_aud_music.setObjectName("sl_aud_music") + self.vboxlayout11.addWidget(self.sl_aud_music) - self.label_33 = QtGui.QLabel(self.verticalLayout_13) - self.label_33.setAlignment(QtCore.Qt.AlignCenter) - self.label_33.setObjectName("label_33") - self.vboxlayout12.addWidget(self.label_33) + self.cb_aud_mute = QtGui.QCheckBox(self.groupBox_aud_level) + self.cb_aud_mute.setGeometry(QtCore.QRect(180,10,70,19)) + self.cb_aud_mute.setObjectName("cb_aud_mute") - self.sl_aud_voicechat = QtGui.QSlider(self.verticalLayout_13) - self.sl_aud_voicechat.setMinimum(0) - self.sl_aud_voicechat.setMaximum(100) - self.sl_aud_voicechat.setPageStep(10) - self.sl_aud_voicechat.setProperty("value",QtCore.QVariant(0)) - self.sl_aud_voicechat.setSliderPosition(0) - self.sl_aud_voicechat.setTracking(False) - self.sl_aud_voicechat.setOrientation(QtCore.Qt.Horizontal) - self.sl_aud_voicechat.setTickPosition(QtGui.QSlider.TicksBelow) - self.sl_aud_voicechat.setTickInterval(25) - self.sl_aud_voicechat.setObjectName("sl_aud_voicechat") - self.vboxlayout12.addWidget(self.sl_aud_voicechat) - - self.cb_aud_voicechat = QtGui.QCheckBox(self.groupBox_voicechat) - self.cb_aud_voicechat.setGeometry(QtCore.QRect(250,30,111,19)) - self.cb_aud_voicechat.setObjectName("cb_aud_voicechat") - self.groupBox_aud_hardware = QtGui.QGroupBox(self.tab_audio) self.groupBox_aud_hardware.setEnabled(True) self.groupBox_aud_hardware.setGeometry(QtCore.QRect(10,230,431,101)) @@ -545,45 +510,45 @@ self.verticalLayout_14.setGeometry(QtCore.QRect(230,40,179,43)) self.verticalLayout_14.setObjectName("verticalLayout_14") - self.vboxlayout13 = QtGui.QVBoxLayout(self.verticalLayout_14) - self.vboxlayout13.setMargin(0) - self.vboxlayout13.setSpacing(6) - self.vboxlayout13.setObjectName("vboxlayout13") + self.vboxlayout12 = QtGui.QVBoxLayout(self.verticalLayout_14) + self.vboxlayout12.setMargin(0) + self.vboxlayout12.setSpacing(6) + self.vboxlayout12.setObjectName("vboxlayout12") self.label_34 = QtGui.QLabel(self.verticalLayout_14) self.label_34.setAlignment(QtCore.Qt.AlignCenter) self.label_34.setObjectName("label_34") - self.vboxlayout13.addWidget(self.label_34) + self.vboxlayout12.addWidget(self.label_34) self.sl_aud_priority = QtGui.QSlider(self.verticalLayout_14) - self.sl_aud_priority.setMaximum(2) + self.sl_aud_priority.setMaximum(9) self.sl_aud_priority.setPageStep(1) self.sl_aud_priority.setSliderPosition(0) self.sl_aud_priority.setTracking(False) self.sl_aud_priority.setOrientation(QtCore.Qt.Horizontal) self.sl_aud_priority.setTickPosition(QtGui.QSlider.TicksBelow) - self.sl_aud_priority.setTickInterval(1) + self.sl_aud_priority.setTickInterval(3) self.sl_aud_priority.setObjectName("sl_aud_priority") - self.vboxlayout13.addWidget(self.sl_aud_priority) + self.vboxlayout12.addWidget(self.sl_aud_priority) self.verticalLayout_15 = QtGui.QWidget(self.groupBox_aud_hardware) self.verticalLayout_15.setGeometry(QtCore.QRect(20,20,179,63)) self.verticalLayout_15.setObjectName("verticalLayout_15") - self.vboxlayout14 = QtGui.QVBoxLayout(self.verticalLayout_15) - self.vboxlayout14.setMargin(0) - self.vboxlayout14.setSpacing(6) - self.vboxlayout14.setObjectName("vboxlayout14") + self.vboxlayout13 = QtGui.QVBoxLayout(self.verticalLayout_15) + self.vboxlayout13.setMargin(0) + self.vboxlayout13.setSpacing(6) + self.vboxlayout13.setObjectName("vboxlayout13") self.label_35 = QtGui.QLabel(self.verticalLayout_15) self.label_35.setAlignment(QtCore.Qt.AlignCenter) self.label_35.setObjectName("label_35") - self.vboxlayout14.addWidget(self.label_35) + self.vboxlayout13.addWidget(self.label_35) - self.label_3 = QtGui.QLabel(self.verticalLayout_15) - self.label_3.setAlignment(QtCore.Qt.AlignCenter) - self.label_3.setObjectName("label_3") - self.vboxlayout14.addWidget(self.label_3) + self.lb_aud_device = QtGui.QLabel(self.verticalLayout_15) + self.lb_aud_device.setAlignment(QtCore.Qt.AlignCenter) + self.lb_aud_device.setObjectName("lb_aud_device") + self.vboxlayout13.addWidget(self.lb_aud_device) self.sl_aud_device = QtGui.QSlider(self.verticalLayout_15) self.sl_aud_device.setMaximum(2) @@ -594,11 +559,49 @@ self.sl_aud_device.setTickPosition(QtGui.QSlider.TicksBelow) self.sl_aud_device.setTickInterval(1) self.sl_aud_device.setObjectName("sl_aud_device") - self.vboxlayout14.addWidget(self.sl_aud_device) + self.vboxlayout13.addWidget(self.sl_aud_device) self.cb_aud_eax = QtGui.QCheckBox(self.groupBox_aud_hardware) self.cb_aud_eax.setGeometry(QtCore.QRect(260,10,111,19)) self.cb_aud_eax.setObjectName("cb_aud_eax") + + self.groupBox_voicechat = QtGui.QGroupBox(self.tab_audio) + self.groupBox_voicechat.setEnabled(True) + self.groupBox_voicechat.setGeometry(QtCore.QRect(10,150,431,71)) + self.groupBox_voicechat.setObjectName("groupBox_voicechat") + + self.cb_aud_voicechat = QtGui.QCheckBox(self.groupBox_voicechat) + self.cb_aud_voicechat.setGeometry(QtCore.QRect(250,30,111,19)) + self.cb_aud_voicechat.setObjectName("cb_aud_voicechat") + + self.verticalLayout_13 = QtGui.QWidget(self.groupBox_voicechat) + self.verticalLayout_13.setGeometry(QtCore.QRect(20,20,179,43)) + self.verticalLayout_13.setObjectName("verticalLayout_13") + + self.vboxlayout14 = QtGui.QVBoxLayout(self.verticalLayout_13) + self.vboxlayout14.setMargin(0) + self.vboxlayout14.setSpacing(6) + self.vboxlayout14.setObjectName("vboxlayout14") + + self.label_33 = QtGui.QLabel(self.verticalLayout_13) + self.label_33.setEnabled(False) + self.label_33.setAlignment(QtCore.Qt.AlignCenter) + self.label_33.setObjectName("label_33") + self.vboxlayout14.addWidget(self.label_33) + + self.sl_aud_microphon = QtGui.QSlider(self.verticalLayout_13) + self.sl_aud_microphon.setEnabled(False) + self.sl_aud_microphon.setMinimum(0) + self.sl_aud_microphon.setMaximum(100) + self.sl_aud_microphon.setPageStep(10) + self.sl_aud_microphon.setProperty("value",QtCore.QVariant(0)) + self.sl_aud_microphon.setSliderPosition(0) + self.sl_aud_microphon.setTracking(False) + self.sl_aud_microphon.setOrientation(QtCore.Qt.Horizontal) + self.sl_aud_microphon.setTickPosition(QtGui.QSlider.TicksBelow) + self.sl_aud_microphon.setTickInterval(25) + self.sl_aud_microphon.setObjectName("sl_aud_microphon") + self.vboxlayout14.addWidget(self.sl_aud_microphon) self.tab_graphics.addTab(self.tab_audio,"") self.tab_time = QtGui.QWidget() @@ -710,7 +713,7 @@ MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) - self.tab_graphics.setCurrentIndex(2) + self.tab_graphics.setCurrentIndex(0) QtCore.QObject.connect(self.buttonbox_rresavcl,QtCore.SIGNAL("rejected()"),MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) @@ -746,18 +749,18 @@ self.tab_graphics.setTabText(self.tab_graphics.indexOf(self.tab_graphics1), QtGui.QApplication.translate("MainWindow", "Graphics", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_aud_level.setTitle(QtGui.QApplication.translate("MainWindow", "Level", None, QtGui.QApplication.UnicodeUTF8)) self.label_31.setText(QtGui.QApplication.translate("MainWindow", "NPC Voices", None, QtGui.QApplication.UnicodeUTF8)) + self.label_28.setText(QtGui.QApplication.translate("MainWindow", "Sound FX", None, QtGui.QApplication.UnicodeUTF8)) + self.label_29.setText(QtGui.QApplication.translate("MainWindow", "Ambience Sound", None, QtGui.QApplication.UnicodeUTF8)) self.label_30.setText(QtGui.QApplication.translate("MainWindow", "Music", None, QtGui.QApplication.UnicodeUTF8)) - self.label_28.setText(QtGui.QApplication.translate("MainWindow", "Sound FX", None, QtGui.QApplication.UnicodeUTF8)) - self.label_29.setText(QtGui.QApplication.translate("MainWindow", "Ambient Sounds", None, QtGui.QApplication.UnicodeUTF8)) self.cb_aud_mute.setText(QtGui.QApplication.translate("MainWindow", "Mute all", None, QtGui.QApplication.UnicodeUTF8)) - self.groupBox_voicechat.setTitle(QtGui.QApplication.translate("MainWindow", "Voice chat", None, QtGui.QApplication.UnicodeUTF8)) - self.label_33.setText(QtGui.QApplication.translate("MainWindow", "Microphon Level", None, QtGui.QApplication.UnicodeUTF8)) - self.cb_aud_voicechat.setText(QtGui.QApplication.translate("MainWindow", "Enable Voice Chat", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_aud_hardware.setTitle(QtGui.QApplication.translate("MainWindow", "Hardware", None, QtGui.QApplication.UnicodeUTF8)) self.label_34.setText(QtGui.QApplication.translate("MainWindow", "Sound Priority", None, QtGui.QApplication.UnicodeUTF8)) self.label_35.setText(QtGui.QApplication.translate("MainWindow", "Audio Modes", None, QtGui.QApplication.UnicodeUTF8)) - self.label_3.setText(QtGui.QApplication.translate("MainWindow", "Generic Software", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_aud_device.setText(QtGui.QApplication.translate("MainWindow", "Generic Software", None, QtGui.QApplication.UnicodeUTF8)) self.cb_aud_eax.setText(QtGui.QApplication.translate("MainWindow", "Enable EAX", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox_voicechat.setTitle(QtGui.QApplication.translate("MainWindow", "Voice chat", None, QtGui.QApplication.UnicodeUTF8)) + self.cb_aud_voicechat.setText(QtGui.QApplication.translate("MainWindow", "Enable Voice Chat", None, QtGui.QApplication.UnicodeUTF8)) + self.label_33.setText(QtGui.QApplication.translate("MainWindow", "Microphon Level", None, QtGui.QApplication.UnicodeUTF8)) self.tab_graphics.setTabText(self.tab_graphics.indexOf(self.tab_audio), QtGui.QApplication.translate("MainWindow", "Audio", None, QtGui.QApplication.UnicodeUTF8)) self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Time zones", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-24 00:42:26 UTC (rev 65) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-24 16:16:05 UTC (rev 66) @@ -129,7 +129,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex" > - <number>2</number> + <number>0</number> </property> <widget class="QWidget" name="tab_graphics" > <attribute name="title" > @@ -448,16 +448,19 @@ <item> <widget class="QSlider" name="sl_gra_shadow" > <property name="minimum" > - <number>1</number> + <number>0</number> </property> <property name="maximum" > - <number>3</number> + <number>100</number> </property> <property name="pageStep" > - <number>1</number> + <number>10</number> </property> + <property name="value" > + <number>0</number> + </property> <property name="sliderPosition" > - <number>1</number> + <number>0</number> </property> <property name="tracking" > <bool>false</bool> @@ -469,7 +472,7 @@ <enum>QSlider::TicksBelow</enum> </property> <property name="tickInterval" > - <number>1</number> + <number>25</number> </property> </widget> </item> @@ -838,11 +841,11 @@ </item> </layout> </widget> - <widget class="QWidget" name="verticalLayout_11" > + <widget class="QWidget" name="verticalLayout_9" > <property name="geometry" > <rect> <x>20</x> - <y>80</y> + <y>30</y> <width>179</width> <height>43</height> </rect> @@ -855,9 +858,9 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_30" > + <widget class="QLabel" name="label_28" > <property name="text" > - <string>Music</string> + <string>Sound FX</string> </property> <property name="alignment" > <set>Qt::AlignCenter</set> @@ -865,7 +868,7 @@ </widget> </item> <item> - <widget class="QSlider" name="sl_aud_music" > + <widget class="QSlider" name="sl_aud_fx" > <property name="minimum" > <number>0</number> </property> @@ -897,10 +900,10 @@ </item> </layout> </widget> - <widget class="QWidget" name="verticalLayout_9" > + <widget class="QWidget" name="verticalLayout_10" > <property name="geometry" > <rect> - <x>20</x> + <x>230</x> <y>30</y> <width>179</width> <height>43</height> @@ -914,9 +917,9 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_28" > + <widget class="QLabel" name="label_29" > <property name="text" > - <string>Sound FX</string> + <string>Ambience Sound</string> </property> <property name="alignment" > <set>Qt::AlignCenter</set> @@ -924,7 +927,7 @@ </widget> </item> <item> - <widget class="QSlider" name="sl_aud_fx" > + <widget class="QSlider" name="sl_aud_ambience" > <property name="minimum" > <number>0</number> </property> @@ -956,11 +959,11 @@ </item> </layout> </widget> - <widget class="QWidget" name="verticalLayout_10" > + <widget class="QWidget" name="verticalLayout_11" > <property name="geometry" > <rect> - <x>230</x> - <y>30</y> + <x>20</x> + <y>80</y> <width>179</width> <height>43</height> </rect> @@ -973,9 +976,9 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_29" > + <widget class="QLabel" name="label_30" > <property name="text" > - <string>Ambient Sounds</string> + <string>Music</string> </property> <property name="alignment" > <set>Qt::AlignCenter</set> @@ -983,7 +986,7 @@ </widget> </item> <item> - <widget class="QSlider" name="sl_aud_ambient" > + <widget class="QSlider" name="sl_aud_music" > <property name="minimum" > <number>0</number> </property> @@ -1029,26 +1032,26 @@ </property> </widget> </widget> - <widget class="QGroupBox" name="groupBox_voicechat" > + <widget class="QGroupBox" name="groupBox_aud_hardware" > <property name="enabled" > <bool>true</bool> </property> <property name="geometry" > <rect> <x>10</x> - <y>150</y> + <y>230</y> <width>431</width> - <height>71</height> + <height>101</height> </rect> </property> <property name="title" > - <string>Voice chat</string> + <string>Hardware</string> </property> - <widget class="QWidget" name="verticalLayout_13" > + <widget class="QWidget" name="verticalLayout_14" > <property name="geometry" > <rect> - <x>20</x> - <y>20</y> + <x>230</x> + <y>40</y> <width>179</width> <height>43</height> </rect> @@ -1061,9 +1064,9 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_33" > + <widget class="QLabel" name="label_34" > <property name="text" > - <string>Microphon Level</string> + <string>Sound Priority</string> </property> <property name="alignment" > <set>Qt::AlignCenter</set> @@ -1071,19 +1074,13 @@ </widget> </item> <item> - <widget class="QSlider" name="sl_aud_voicechat" > - <property name="minimum" > - <number>0</number> - </property> + <widget class="QSlider" name="sl_aud_priority" > <property name="maximum" > - <number>100</number> + <number>9</number> </property> <property name="pageStep" > - <number>10</number> + <number>1</number> </property> - <property name="value" > - <number>0</number> - </property> <property name="sliderPosition" > <number>0</number> </property> @@ -1097,48 +1094,19 @@ <enum>QSlider::TicksBelow</enum> </property> <property name="tickInterval" > - <number>25</number> + <number>3</number> </property> </widget> </item> </layout> </widget> - <widget class="QCheckBox" name="cb_aud_voicechat" > + <widget class="QWidget" name="verticalLayout_15" > <property name="geometry" > <rect> - <x>250</x> - <y>30</y> - <width>111</width> - <height>19</height> - </rect> - </property> - <property name="text" > - <string>Enable Voice Chat</string> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="groupBox_aud_hardware" > - <property name="enabled" > - <bool>true</bool> - </property> - <property name="geometry" > - <rect> - <x>10</x> - <y>230</y> - <width>431</width> - <height>101</height> - </rect> - </property> - <property name="title" > - <string>Hardware</string> - </property> - <widget class="QWidget" name="verticalLayout_14" > - <property name="geometry" > - <rect> - <x>230</x> - <y>40</y> + <x>20</x> + <y>20</y> <width>179</width> - <height>43</height> + <height>63</height> </rect> </property> <layout class="QVBoxLayout" > @@ -1149,9 +1117,9 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_34" > + <widget class="QLabel" name="label_35" > <property name="text" > - <string>Sound Priority</string> + <string>Audio Modes</string> </property> <property name="alignment" > <set>Qt::AlignCenter</set> @@ -1159,7 +1127,17 @@ </widget> </item> <item> - <widget class="QSlider" name="sl_aud_priority" > + <widget class="QLabel" name="lb_aud_device" > + <property name="text" > + <string>Generic Software</string> + </property> + <property name="alignment" > + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="sl_aud_device" > <property name="maximum" > <number>2</number> </property> @@ -1185,13 +1163,55 @@ </item> </layout> </widget> - <widget class="QWidget" name="verticalLayout_15" > + <widget class="QCheckBox" name="cb_aud_eax" > <property name="geometry" > <rect> + <x>260</x> + <y>10</y> + <width>111</width> + <height>19</height> + </rect> + </property> + <property name="text" > + <string>Enable EAX</string> + </property> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_voicechat" > + <property name="enabled" > + <bool>true</bool> + </property> + <property name="geometry" > + <rect> + <x>10</x> + <y>150</y> + <width>431</width> + <height>71</height> + </rect> + </property> + <property name="title" > + <string>Voice chat</string> + </property> + <widget class="QCheckBox" name="cb_aud_voicechat" > + <property name="geometry" > + <rect> + <x>250</x> + <y>30</y> + <width>111</width> + <height>19</height> + </rect> + </property> + <property name="text" > + <string>Enable Voice Chat</string> + </property> + </widget> + <widget class="QWidget" name="verticalLayout_13" > + <property name="geometry" > + <rect> <x>20</x> <y>20</y> <width>179</width> - <height>63</height> + <height>43</height> </rect> </property> <layout class="QVBoxLayout" > @@ -1202,9 +1222,12 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="label_35" > + <widget class="QLabel" name="label_33" > + <property name="enabled" > + <bool>false</bool> + </property> <property name="text" > - <string>Audio Modes</string> + <string>Microphon Level</string> </property> <property name="alignment" > <set>Qt::AlignCenter</set> @@ -1212,23 +1235,22 @@ </widget> </item> <item> - <widget class="QLabel" name="label_3" > - <property name="text" > - <string>Generic Software</string> + <widget class="QSlider" name="sl_aud_microphon" > + <property name="enabled" > + <bool>false</bool> </property> - <property name="alignment" > - <set>Qt::AlignCenter</set> + <property name="minimum" > + <number>0</number> </property> - </widget> - </item> - <item> - <widget class="QSlider" name="sl_aud_device" > <property name="maximum" > - <number>2</number> + <number>100</number> </property> <property name="pageStep" > - <number>1</number> + <number>10</number> </property> + <property name="value" > + <number>0</number> + </property> <property name="sliderPosition" > <number>0</number> </property> @@ -1242,25 +1264,12 @@ <enum>QSlider::TicksBelow</enum> </property> <property name="tickInterval" > - <number>1</number> + <number>25</number> </property> </widget> </item> </layout> </widget> - <widget class="QCheckBox" name="cb_aud_eax" > - <property name="geometry" > - <rect> - <x>260</x> - <y>10</y> - <width>111</width> - <height>19</height> - </rect> - </property> - <property name="text" > - <string>Enable EAX</string> - </property> - </widget> </widget> </widget> <widget class="QWidget" name="tab_time" > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-23 23:01:31
|
Revision: 64 http://pymoul.svn.sourceforge.net/pymoul/?rev=64&view=rev Author: tiran Date: 2007-01-23 15:01:32 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Some error handlers for the demo Modified Paths: -------------- pymoul/trunk/src/moul/qt/mainwindow.py Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-23 22:53:02 UTC (rev 63) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-23 23:01:32 UTC (rev 64) @@ -101,8 +101,15 @@ """ inipath = lookupDir('ini') self._graphics_ini = gini = GraphicsIni() - gini.open(inipath) - + try: + gini.open(inipath) + except Exception, msg: + LOG.exception("Something bad happened while parsing the graphics.ini file") + QtGui.QMessageBox.critical(None, + self.trUtf8("Error opening graphics.ini"), + self.trUtf8("""Something bad happend while opening the graphics.ini\n%s""" % msg)) + return + length = len(videoModes) - 1 self.sl_gra_screenres.setMaximum(length) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-23 22:53:02
|
Revision: 63 http://pymoul.svn.sourceforge.net/pymoul/?rev=63&view=rev Author: tiran Date: 2007-01-23 14:53:02 -0800 (Tue, 23 Jan 2007) Log Message: ----------- First version that actually parses a real life graphics.ini file TODO: lot's of checks Modified Paths: -------------- pymoul/trunk/src/moul/config/__init__.py pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Modified: pymoul/trunk/src/moul/config/__init__.py =================================================================== --- pymoul/trunk/src/moul/config/__init__.py 2007-01-23 22:52:09 UTC (rev 62) +++ pymoul/trunk/src/moul/config/__init__.py 2007-01-23 22:53:02 UTC (rev 63) @@ -17,11 +17,8 @@ # """Configuration package """ -__all__ = ('setMoulInstallDir', 'startMOUL', 'getMoulDir') - import os import sys -from moul.log import getLogger # a program under py2exe is sys.frozen __FROZEN__ = bool(getattr(sys, 'frozen', False)) Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-01-23 22:52:09 UTC (rev 62) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-01-23 22:53:02 UTC (rev 63) @@ -21,6 +21,9 @@ __version__ = "$Id$" __revision__ = "$Revision$" +import os +import shutil + from moul.crypt.whatdoyousee import decryptWDYS from moul.crypt.whatdoyousee import encryptWDYS @@ -281,23 +284,57 @@ return self._reverse_vm[(w, h)] def widths(self): + """List of available widths + """ return [w for w, h, wr, hr in self._videomodes] def heights(self): + """List of available heights + """ return [h for w, h, wr, hr in self._videomodes] videoModes = _VideoModes() class ConfFile(object): _options = {} + _filename = None def __init__(self): self.clear() + self._fpath = None def clear(self): self._filedata = {} self._newdata = {} self._order = [] + + def open(self, path): + """Open encrypted file at 'path' + """ + if self._fpath is not None: + raise ValueError("File already open") + self._fpath = os.path.join(path, self._filename) + self.parseEncFile(self._fpath) + + def write(self): + """Write data to file + + The write method uses the savest way possible. The old file is backed + up, the new data is written to another file and at last the original + file is replaced with the new file. + + WINDOWS: os.rename() can't replace the file in place under Windows. + The final operation is not atomic. :( + """ + orig = self._fpath + if orig is None: + raise ValueError("Full path not set") + bak = orig + ".bak" + new = orig + ".new" + shutils.copyfile(orig, bak) # make backup + self.writeEncFile(new) # write new + os.unlink(orig) # stupid windows can't perform an atomic rename + os.rename(new, orig) # move new to orig def parseEncFile(self, fd_name): """Read and parse file (fd or file name) @@ -308,7 +345,8 @@ else: fd = fd_name data = decryptWDYS(fd) - return self.parseString(data) + fd.close() + self.parseString(data) def parseString(self, s): """Parse string with file contents @@ -370,9 +408,21 @@ else: fd = fd_name data = self.writeString() - return encryptWDYS(data, fd) + encryptWDYS(data, fd) + fd.close() + def _get(self, name): + """get descriptor helper + """ + return self._newdata[name] + + def _set(self, name, value): + """set descriptor helper + """ + self._newdata[name] = value + class AudioIni(ConfFile): + _filename = 'audio.ini' _options = { 'Audio.Initialize' : (BoolString, Constrain()), 'Audio.UseEAX' : (BoolString, Constrain()), @@ -388,6 +438,7 @@ } class GraphicsIni(ConfFile): + _filename = 'graphics.ini' _options = { 'Graphics.Width' : (int, Contains(videoModes.widths())), 'Graphics.Height' : (int, Contains(videoModes.heights())), @@ -413,12 +464,6 @@ self._newdata['Graphics.Width'] = w self._newdata['Graphics.Height'] = h - def _get(self, name): - return self._newdata[name] - - def _set(self, name, value): - self._newdata[name] = value - screenres = property(_getScreenRes, _setScreenRes, doc="Screen resolution by index") windowed = property(lambda self: self._get('Graphics.Windowed'), lambda self, v: self._set('Graphics.Windowed', v), Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-23 22:52:09 UTC (rev 62) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-23 22:53:02 UTC (rev 63) @@ -32,14 +32,15 @@ from PyQt4.QtCore import SIGNAL from moul.qt.ui.mainwindow import Ui_MainWindow -from moul.time.cavern import CavernTime -from moul.file.wdysini import AudioIni +from moul.config import lookupDir +#from moul.file.wdysini import AudioIni from moul.file.wdysini import GraphicsIni from moul.file.wdysini import videoModes +from moul.log import getLogger +from moul.log import signalLogDecorator from moul.server.ping import ServerList from moul.server.ping import isSocketError -from moul.log import getLogger -from moul.log import signalLogDecorator +from moul.time.cavern import CavernTime LOG = getLogger('moul.qt') @@ -98,19 +99,36 @@ def _graphics_init(self): """init graphics tab """ + inipath = lookupDir('ini') + self._graphics_ini = gini = GraphicsIni() + gini.open(inipath) + length = len(videoModes) - 1 self.sl_gra_screenres.setMaximum(length) + + self.on_graphicsini_loaded(gini) # XXX: hard coded for testing purpose def on_graphicsini_loaded(self, gini): """SIGNAL: graphicsIniLoaded(file) """ self.sl_gra_screenres.setValue(gini.screenres) + self.sl_gra_quality.setValue(gini.quality) + self.sl_gra_texture.setValue(gini.texture) + self.sl_gra_antialias.setValue(gini.antialias) + self.sl_gra_anisotropic.setValue(gini.anisotropic) + # TODO: self.sl_gra_shadow.setValue(gini.shadow) + self.cb_gra_windowed.setChecked(gini.windowed) + self.cb_gra_vsync.setChecked(gini.vsync) + self.cb_gra_shadow.setChecked(gini.shadow_enabled) @signalLogDecorator(LOG) @pyqtSignature("int") def on_sl_gra_screenres_valueChanged(self, idx): """SIGNAL: valueChanged (int) """ + # XXX: fixme + txt = videoModes.getVidModeHuman(idx) + self.lb_screenres.setText(QtCore.QString(txt)) @signalLogDecorator(LOG) @pyqtSignature("int") Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-23 22:52:09 UTC (rev 62) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-23 22:53:02 UTC (rev 63) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Fri Jan 19 17:47:21 2007 +# Created: Tue Jan 23 23:44:34 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -219,17 +219,17 @@ self.label_13.setObjectName("label_13") self.vboxlayout4.addWidget(self.label_13) - self.sl_gra_aa = QtGui.QSlider(self.verticalLayout_5) - self.sl_gra_aa.setMinimum(1) - self.sl_gra_aa.setMaximum(4) - self.sl_gra_aa.setPageStep(1) - self.sl_gra_aa.setSliderPosition(1) - self.sl_gra_aa.setTracking(False) - self.sl_gra_aa.setOrientation(QtCore.Qt.Horizontal) - self.sl_gra_aa.setTickPosition(QtGui.QSlider.TicksBelow) - self.sl_gra_aa.setTickInterval(1) - self.sl_gra_aa.setObjectName("sl_gra_aa") - self.vboxlayout4.addWidget(self.sl_gra_aa) + self.sl_gra_antialias = QtGui.QSlider(self.verticalLayout_5) + self.sl_gra_antialias.setMinimum(1) + self.sl_gra_antialias.setMaximum(4) + self.sl_gra_antialias.setPageStep(1) + self.sl_gra_antialias.setSliderPosition(1) + self.sl_gra_antialias.setTracking(False) + self.sl_gra_antialias.setOrientation(QtCore.Qt.Horizontal) + self.sl_gra_antialias.setTickPosition(QtGui.QSlider.TicksBelow) + self.sl_gra_antialias.setTickInterval(1) + self.sl_gra_antialias.setObjectName("sl_gra_antialias") + self.vboxlayout4.addWidget(self.sl_gra_antialias) self.hboxlayout2 = QtGui.QHBoxLayout() self.hboxlayout2.setMargin(0) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-23 22:52:09 UTC (rev 62) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-23 22:53:02 UTC (rev 63) @@ -433,7 +433,7 @@ </widget> </item> <item> - <widget class="QSlider" name="sl_gra_aa" > + <widget class="QSlider" name="sl_gra_antialias" > <property name="minimum" > <number>1</number> </property> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-23 22:52:09
|
Revision: 62 http://pymoul.svn.sourceforge.net/pymoul/?rev=62&view=rev Author: tiran Date: 2007-01-23 14:52:09 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Cleaned up distutils_upx code Added support for InnoSetup installer Modified Paths: -------------- pymoul/trunk/INSTALL.txt pymoul/trunk/Makefile pymoul/trunk/distutils_upx.py pymoul/trunk/setup_win32.py Modified: pymoul/trunk/INSTALL.txt =================================================================== --- pymoul/trunk/INSTALL.txt 2007-01-23 17:51:37 UTC (rev 61) +++ pymoul/trunk/INSTALL.txt 2007-01-23 22:52:09 UTC (rev 62) @@ -20,6 +20,7 @@ ----- * UPX http://upx.sourceforge.net/#download + * InnoSetup http://www.jrsoftware.org/ ==================== Windows Installation Modified: pymoul/trunk/Makefile =================================================================== --- pymoul/trunk/Makefile 2007-01-23 17:51:37 UTC (rev 61) +++ pymoul/trunk/Makefile 2007-01-23 22:52:09 UTC (rev 62) @@ -41,6 +41,8 @@ egg: bdist_egg +doc: doc_html + clean: find . \( -name '*.o' -o -name '*.c' -o -name '*.so' -o -name '*.py[cod]' -o -name '*.dll' \) -exec rm -f {} \; rm -rf build Modified: pymoul/trunk/distutils_upx.py =================================================================== --- pymoul/trunk/distutils_upx.py 2007-01-23 17:51:37 UTC (rev 61) +++ pymoul/trunk/distutils_upx.py 2007-01-23 22:52:09 UTC (rev 62) @@ -13,22 +13,6 @@ from stat import ST_SIZE from fnmatch import fnmatch -def _call(cmd, silent=False, *args, **kwargs): - """Call silently - redirect stdout to dump - """ - data = None - if silent: - stdout = TemporaryFile() - else: - stdout = None - try: - retcode = subcall(cmd, stdout=stdout, *args, **kwargs) - finally: - if stdout: - data = stdout.read() - stdout.close() - return retcode, data - class UpxCommand: """Upx packer mixin class for distutils @@ -52,7 +36,7 @@ def initialize_options(self): result = self._otherclass().initialize_options(self) self.upx = True - self.upx_args = '--no-color --best' + self.upx_args = '--no-color' self.upx_path = 'upx' self.upx_extensions = [ 'pyd', 'dll', 'exe', # Windows @@ -60,6 +44,10 @@ 'dylib', # Mac OS X ] self.upx_ignore = [] + + self.app_name = '' + self.innosetup = False + return result def finalize_options(self): @@ -69,7 +57,6 @@ return result def copy_file(self, *args, **kwargs): - # Override to UPX copied binaries. result = self._otherclass().copy_file(self, *args, **kwargs) self.upx_packlist.append(result) return result @@ -77,9 +64,16 @@ def run(self, *args, **kwargs): result = self._otherclass().run(self, *args, **kwargs) self._upxPack() + self._createInnoSetup() return result def _upxPack(self): + """Pack files + + At last pack the files. I had some hard to debug errors as I tried to + pack the files inside the copy_file() method. Some dll and exe files + were broken. Perhaps some file handlers weren't closed? + """ if not self.has_upx or not self.upx: return @@ -116,7 +110,7 @@ def _upxPackFile(self, fname): """Pack a file """ - retcode, stdout = _call('%s %s "%s"' % (self.upx_path, self.upx_args, fname), silent=False) + retcode = subcall('%s %s "%s"' % (self.upx_path, self.upx_args, fname)) if retcode == 0: # OK, file packed pass elif retcode == 2: # OK, file already packed @@ -127,8 +121,13 @@ def _upxAvailable(self): """Search for UPX in search path """ + stdout = TemporaryFile() try: - retcode, stdout = _call("%s --version" % self.upx_path, silent=True) + try: + retcode = subcall("%s --version" % self.upx_path, stdout=stdout) + finally: + if stdout: + stdout.close() except OSError: log.debug('UPX not found') return False @@ -151,7 +150,99 @@ return c raise ValueError(cls) + def _createInnoSetup(self): + if not self.innosetup: + return + script = InnoScript(self.app_name, + self.lib_dir, + self.dist_dir, + self.windows_exe_files, + self.lib_files) + print "*** creating the inno setup script***" + script.create() + print "*** compiling the inno setup script***" + try: + script.compile() + except RuntimeError, msg: + print "Failed to create installer:\n%s" % msg + # Note: By default the final setup.exe will be in an Output subdirectory. + +class InnoScript: + """Based on py2exe/samples/extending/setup.py + + Requires http://www.jrsoftware.org + """ + def __init__(self, + name, + lib_dir, + dist_dir, + windows_exe_files = [], + lib_files = [], + version = "1.0"): + self.lib_dir = lib_dir + self.dist_dir = dist_dir + if not self.dist_dir[-1] in "\\/": + self.dist_dir += "\\" + self.name = name + self.version = version + self.windows_exe_files = [self.chop(p) for p in windows_exe_files] + self.lib_files = [self.chop(p) for p in lib_files] + + def chop(self, pathname): + assert pathname.startswith(self.dist_dir) + return pathname[len(self.dist_dir):] + + def create(self, pathname="dist\\test_wx.iss"): + self.pathname = pathname + ofi = self.file = open(pathname, "w") + print >> ofi, "; WARNING: This script has been created by py2exe. Changes to this script" + print >> ofi, "; will be overwritten the next time py2exe is run!" + print >> ofi, r"[Setup]" + print >> ofi, r"AppName=%s" % self.name + print >> ofi, r"AppVerName=%s %s" % (self.name, self.version) + print >> ofi, r"DefaultDirName={pf}\%s" % self.name + print >> ofi, r"DefaultGroupName=%s" % self.name + print >> ofi + + print >> ofi, r"[Files]" + for path in self.windows_exe_files + self.lib_files: + print >> ofi, r'Source: "%s"; DestDir: "{app}\%s"; Flags: ignoreversion' % (path, os.path.dirname(path)) + print >> ofi + + print >> ofi, r"[Icons]" + for path in self.windows_exe_files: + print >> ofi, r'Name: "{group}\%s"; Filename: "{app}\%s"' % \ + (self.name, path) + print >> ofi, 'Name: "{group}\Uninstall %s"; Filename: "{uninstallexe}"' % self.name + + def compile(self): + try: + import ctypes + except ImportError: + try: + import win32api + except ImportError: + import os + os.startfile(self.pathname) + else: + #print "Ok, using win32api." + win32api.ShellExecute(0, "compile", + self.pathname, + None, + None, + 0) + else: + #print "Cool, you have ctypes installed." + res = ctypes.windll.shell32.ShellExecuteA(0, "compile", + self.pathname, + None, + None, + 0) + if res < 32: + raise RuntimeError("ShellExecute failed, error %d" % res) + + try: from py2exe.build_exe import py2exe except ImportError: @@ -159,4 +250,3 @@ else: class UpxPy2exe(UpxCommand, py2exe): pass - Modified: pymoul/trunk/setup_win32.py =================================================================== --- pymoul/trunk/setup_win32.py 2007-01-23 17:51:37 UTC (rev 61) +++ pymoul/trunk/setup_win32.py 2007-01-23 22:52:09 UTC (rev 62) @@ -69,6 +69,12 @@ pexe['compressed'] = 100 # compress zip file pexe['optimize'] = 0 # 0,1,2 pexe['includes'] = ['sip', 'PyQt4', 'encodings', 'encodings.*'] + # UPX + pexe['upx'] = True + pexe['upx_args'] = '--mono --best' + # InnoSetup + pexe['innosetup'] = True + pexe['app_name'] = 'pyMoul' # not required at the moment pexe['includes'].extend(findPyTz()) kw['zipfile'] = 'library.zip' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-23 17:51:37
|
Revision: 61 http://pymoul.svn.sourceforge.net/pymoul/?rev=61&view=rev Author: tiran Date: 2007-01-23 09:51:37 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Modified Paths: -------------- pymoul/trunk/distutils_upx.py Modified: pymoul/trunk/distutils_upx.py =================================================================== --- pymoul/trunk/distutils_upx.py 2007-01-23 13:49:43 UTC (rev 60) +++ pymoul/trunk/distutils_upx.py 2007-01-23 17:51:37 UTC (rev 61) @@ -8,19 +8,11 @@ import sys from inspect import getmro from tempfile import TemporaryFile -from subprocess import call +from subprocess import call as subcall from distutils import log from stat import ST_SIZE +from fnmatch import fnmatch -def inEnvPath(name): - result = [] - for path in os.environ['PATH'].split(';'): - upx = os.path.join(path, name) - if os.path.isfile(upx): - result.append(upx) - if result: - return result[0] - def _call(cmd, silent=False, *args, **kwargs): """Call silently - redirect stdout to dump """ @@ -30,97 +22,136 @@ else: stdout = None try: - retcode = call(cmd, stdout=stdout, *args, **kwargs) + retcode = subcall(cmd, stdout=stdout, *args, **kwargs) finally: if stdout: data = stdout.read() stdout.close() return retcode, data -def _has_upx(upx): - """Search for UPX in search path +class UpxCommand: + """Upx packer mixin class for distutils + + Usage: + class UpxPy2exe(UpxCommand, py2exe): + pass + + setup(..., cmdclass = {'py2exe': UpxPy2exe}) + + The mixin class should work for every distutils Command based class on + every os (Win32, Mac, Linux). + + New options: + o upx - True/False + o upx_args - additional args for upx (e.g. "--no-color --best") + o upx_path - path to upx if not in os.environ['PATH'] + o upx_extensions - list of extensions to packed (e.g. ['dll','pyd','exe']) + o upx_ignore - list of pattern to ignore (e.g. ['python*.dll']= """ - try: - retcode, stdout = _call("%s --version" % upx, silent=True) - except OSError: - log.debug('UPX not found') - return False - else: - if retcode == 0: - log.debug('UPX found') - return True - else: - log.debug('UPX: an error occured %i' % retcode) - return False - -def _upx_compress(upx, args, fname): - """Check file - """ - retcode, stdout = _call('upx %s "%s"' % (args, fname), silent=False) - if retcode == 0: # file packed - pass - elif retcode == 2: # file already packed - pass - else: # something bad has happend - sys.exit(retcode) - -def otherclass(mycls): - for cls in getmro(mycls): - if not issubclass(cls, UpxCommand): - return cls - raise ValueError(mycls) - -class UpxCommand: + def initialize_options(self): - result = otherclass(self.__class__).initialize_options(self) + result = self._otherclass().initialize_options(self) self.upx = True self.upx_args = '--no-color --best' self.upx_path = 'upx' - self.upx_extensions = ( + self.upx_extensions = [ 'pyd', 'dll', 'exe', # Windows '', 'so', # Linux 'dylib', # Mac OS X - ) + ] + self.upx_ignore = [] return result def finalize_options(self): - result = otherclass(self.__class__).finalize_options(self) - self.has_upx = _has_upx(self.upx_path) - self.upx_packed = [] + result = self._otherclass().finalize_options(self) + self.has_upx = self._upxAvailable() + self.upx_packlist = [] return result - + def copy_file(self, *args, **kwargs): # Override to UPX copied binaries. - result = otherclass(self.__class__).copy_file(self, *args, **kwargs) - self._upx_compress(result) + result = self._otherclass().copy_file(self, *args, **kwargs) + self.upx_packlist.append(result) return result - def _upx_compress(self, result): - fname, copied = result - if not self.has_upx or not self.upx or not copied: - return - - basename = os.path.basename(fname) - tmp, ext = os.path.splitext(basename) - ext = ext[1:] # strip leading dot - origsize = os.stat(fname)[ST_SIZE] - if ext in self.upx_extensions: - _upx_compress(self.upx_path, self.upx_args, os.path.normpath(fname)) - newsize = os.stat(fname)[ST_SIZE] - ratio = newsize*100 / origsize - self.upx_packed.append((basename, origsize, newsize, ratio)) - return result - def run(self, *args, **kwargs): - result = otherclass(self.__class__).run(self, *args, **kwargs) - if self.has_upx and self.upx: - print "\n*** UPX result ***" - for basename, origsize, newsize, ratio in self.upx_packed: - print " %s packed to %i%%" % (basename, ratio) - print "\n" + result = self._otherclass().run(self, *args, **kwargs) + self._upxPack() return result + def _upxPack(self): + if not self.has_upx or not self.upx: + return + + packed = [] + for fname, copied in self.upx_packlist: + if not copied: + continue + basename = os.path.basename(fname) + tmp, ext = os.path.splitext(basename) + ext = ext[1:] # strip leading dot + + # check extension + if ext not in self.upx_extensions: + continue + # check ignores + if self.upx_ignore: + matches = [pat for pat in self.upx_ignore if fnmatch(basename, pat)] + if matches: + continue + + origsize = os.stat(fname)[ST_SIZE] + self._upxPackFile(os.path.normpath(fname)) + newsize = os.stat(fname)[ST_SIZE] + ratio = newsize*100 / origsize + packed.append((basename, origsize, newsize, ratio)) + + print "\n*** UPX result ***" + for basename, origsize, newsize, ratio in packed: + print " %s packed to %i%%" % (basename, ratio) + if not packed: + print " no files packed" + print "\n" + def _upxPackFile(self, fname): + """Pack a file + """ + retcode, stdout = _call('%s %s "%s"' % (self.upx_path, self.upx_args, fname), silent=False) + if retcode == 0: # OK, file packed + pass + elif retcode == 2: # OK, file already packed + pass + else: # something bad has happend + sys.exit(retcode) # XXX + + def _upxAvailable(self): + """Search for UPX in search path + """ + try: + retcode, stdout = _call("%s --version" % self.upx_path, silent=True) + except OSError: + log.debug('UPX not found') + return False + else: + if retcode == 0: + log.debug('UPX found') + return True + else: + log.debug('UPX: an error occured %i' % retcode) + return False + + @classmethod + def _otherclass(cls): + """Workaround: distutils.cmd.Command is an old style class + + Find next class in MRO that is not based on UpxCommand class + """ + for c in getmro(cls): + if not issubclass(c, UpxCommand): + return c + raise ValueError(cls) + + try: from py2exe.build_exe import py2exe except ImportError: @@ -128,3 +159,4 @@ else: class UpxPy2exe(UpxCommand, py2exe): pass + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-23 13:49:56
|
Revision: 60 http://pymoul.svn.sourceforge.net/pymoul/?rev=60&view=rev Author: tiran Date: 2007-01-23 05:49:43 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Updated htdocs Modified Paths: -------------- htdocs/trunk/index.html Property Changed: ---------------- htdocs/trunk/index.html Modified: htdocs/trunk/index.html =================================================================== --- htdocs/trunk/index.html 2007-01-23 13:02:21 UTC (rev 59) +++ htdocs/trunk/index.html 2007-01-23 13:49:43 UTC (rev 60) @@ -4,8 +4,24 @@ </head> <body> <h1>pyMoul</h1> + <p>Go to <a href="http://sourceforge.net/projects/pymoul">project page</a> <p> + +<h2>Subversion</h2> +<p>Browse <a href="http://pymoul.svn.sourceforge.net/viewvc/pymoul/pymoul/trunk/">subversion repository</a> +<p> +<p>Checkout svn:<br /> +<code>svn co https://pymoul.svn.sourceforge.net/svnroot/pymoul/pymoul/trunk/ pymoul</code> +</p> + +<h2>Other</h2> +<p>Read <a href="http://pymoul.sourceforge.net/doc/html/">API documentation</a> +</p> +<p>View <a href="http://pymoul.sourceforge.net/screenshots/">Screenshots</a> +</p> + + <p><a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=186624&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a></p> </body> </html> Property changes on: htdocs/trunk/index.html ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-23 13:02:29
|
Revision: 59 http://pymoul.svn.sourceforge.net/pymoul/?rev=59&view=rev Author: tiran Date: 2007-01-23 05:02:21 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Configuration cleanup Moved all os dependent stuff to the right directory Modified Paths: -------------- pymoul/trunk/src/moul/config/__init__.py pymoul/trunk/src/moul/file/localization.py pymoul/trunk/src/moul/file/plasmalog.py pymoul/trunk/src/moul/osdependent/__init__.py pymoul/trunk/src/moul/osdependent/darwin/__init__.py pymoul/trunk/src/moul/osdependent/linux/__init__.py pymoul/trunk/src/moul/osdependent/win32/__init__.py pymoul/trunk/src/moul/qt/ui/mainwindow.py Added Paths: ----------- pymoul/trunk/src/moul/config/tests/test_config.py pymoul/trunk/src/moul/osdependent/win32/registry.py pymoul/trunk/src/moul/osdependent/win32/winpath.py Removed Paths: ------------- pymoul/trunk/src/moul/config/darwin.py pymoul/trunk/src/moul/config/linux.py pymoul/trunk/src/moul/config/win32.py Modified: pymoul/trunk/src/moul/config/__init__.py =================================================================== --- pymoul/trunk/src/moul/config/__init__.py 2007-01-23 11:06:58 UTC (rev 58) +++ pymoul/trunk/src/moul/config/__init__.py 2007-01-23 13:02:21 UTC (rev 59) @@ -34,23 +34,23 @@ _marker=object() # XXX: what about cygwin, bsd and others? if __WIN32__: - from moul.config.win32 import ( + from moul.osdependent.win32 import ( getMoulUserDataDir, - getPyMoulIniLocation, + getPyMoulIniDir, _startMOUL, EXEC_NAME ) elif __LINUX__: - from moul.config.linux import ( + from moul.osdependent.linux import ( getMoulUserDataDir, - getPyMoulIniLocation, + getPyMoulIniDir, _startMOUL, EXEC_NAME ) elif __MACOSX__: - from moul.config.darwin import ( + from moul.osdependent.darwin import ( getMoulUserDataDir, - getPyMoulIniLocation, + getPyMoulIniDir, _startMOUL, EXEC_NAME ) @@ -58,95 +58,137 @@ raise RuntimeError('platform %s not supported' % sys.platform) ## configuration -_configuration = { - 'moul' : {} - } -def getConfigOption(section, name=None, default=_marker): - """Get configuration option - """ - global _configuration - if name is None: - section, name = section.split('.') - sec = _configuration.get(section, default) - if sec is not default: - value = sec.get(name, default) - if value is default and default is _marker: - raise KeyError("%s.%s" % (section, name)) - else: - return value - elif default is _marker: - raise KeyError(section) -def setConfigOption(section, name=None, value=_marker): - """Set configuratin option - """ - global _configuration - if value is _marker: - raise ValueError("No value applied") - if name is None: - section, name = section.split('.') - sec = _configuration[section] - if value is None: - del sec[name] - else: - sec[name] = value +class Configuration(dict): + def __new__(cls, *args, **kwargs): + self = dict.__new__(cls, *args, **kwargs) + self.addSection('moul') + return self -def addConfigSection(section): - """Add a new configuration section - """ - global _configuration - return _configuration.setdefault(section, {}) + def getOption(self, section, name=None, default=_marker): + """Get configuration option + """ + if name is None: + section, name = section.split('.') + sec = self.get(section, default) + if sec is not default: + value = sec.get(name, default) + if value is default and default is _marker: + raise KeyError("%s.%s" % (section, name)) + else: + return value + elif default is _marker: + raise KeyError(section) + + def setOption(self, section, name=None, value=_marker): + """Set configuratin option + """ + if value is _marker: + raise ValueError("No value applied") + if name is None: + section, name = section.split('.') + sec = self[section] + if value is None: + del sec[name] + else: + sec[name] = value + + def addSection(self, section): + """Add a new configuration section + """ + return self.setdefault(section, {}) + + def listConfig(self): + """List + + >>> cfg = listConfig() + >>> len(cfg) > 0 + True + >>> type(cfg) + <type 'dict'> + """ + out = {} + for sec, names in self.items(): + for name, value in names.items(): + fullname = "%s.%s" % (sec, name) + out[fullname] = value + return out -def listConfig(): - """List - """ - global _configuration - out = {} - for sec, names in _configuration.items(): - for name, value in names.items(): - fullname = "%s.%s" % (sec, name) - out[fullname] = value - return out +_configuration = Configuration() +getOption = _configuration.getOption +setOption = _configuration.setOption +addSection = _configuration.addSection +listConfig = _configuration.listConfig -#setConfigOption('moul', 'installdir', 'D:\\games\\MystOnline') +# hard coded for my system +setOption('moul', 'installdir', 'D:\\games\\MystOnline') ## directories -def getMoulInstallDir(): - return getConfigOption('moul.installdir') +class Directories(object): + + _dirmapping = { + 'install' : "%(installdir)s", + 'loc' : "%(installdir)s/dat", + 'dat' : "%(installdir)s/dat", + 'sound' : "%(installdir)s/sfx", + 'soundwav' : "%(installdir)s/sfx/streamingCache", + 'video' : "%(installdir)s/avi", + + 'userdata' : "%(datadir)s", + 'log' : "%(datadir)s/Log", + 'kiimages' : "%(datadir)s/KIimages", + 'avatars' : "%(datadir)s/Avatars", + 'chatlogs' : "%(datadir)s/chatlogs", + 'ini' : "%(datadir)s/init", + + 'pymoul.ini' : "%(pymouldir)s/pymoul.ini", + } + + def __init__(self, config): + self._cache = {} + self._config = config + + def clearCache(self): + self._cache.clear() -def startMOUL(*args): - """Start MOUL wrapper - """ - installdir = getMoulInstallDir() - _startMOUL(installdir, *args) + def getMoulInstallDir(self): + return self._config.getOption('moul.installdir') + + def getMoulUserDataDir(self): + return getMoulUserDataDir() -# name -> (callable, list) -_mapping = { - 'install' : (getMoulInstallDir, ()), - 'loc' : (getMoulInstallDir, ('dat', )), - 'dat' : (getMoulInstallDir, ('dat', )), - 'sound' : (getMoulInstallDir, ('sfx', )), - 'soundwav' : (getMoulInstallDir, ('sfx', 'streamingCache', )), - 'video' : (getMoulInstallDir, ('avi', )), + def getPyMoulIniDir(self): + return getPyMoulIniDir() - 'userdata' : (getMoulUserDataDir, ()), - 'log' : (getMoulUserDataDir, ('Log', )), - 'kiimages' : (getMoulUserDataDir, ('KIimages', )), - 'avatars' : (getMoulUserDataDir, ('Avatars', )), - 'chatlogs' : (getMoulUserDataDir, ('chatlogs', )), - 'ini' : (getMoulUserDataDir, ('init', )), + def lookupDir(self, name): + """Lookup MOUL directory + """ + cached = self._cache.get(name, None) + if cached: + return cached + path = self._dirmapping.get(name) + path = path.replace('/', os.sep) + map = {'installdir' : self.getMoulInstallDir(), + 'datadir' : self.getMoulUserDataDir(), + 'pymouldir' : self.getPyMoulIniDir(), + } + fullpath = path % map + #self._cache[name] = fullpath + return fullpath + + def listDirs(self): + """List all MOUL dirs + + >>> dirs = listDirs() + >>> len(dirs) + 13 + >>> type(dirs) + <type 'dict'> + """ + return dict([(name, self.lookupDir(name)) for name in self._dirmapping]) - 'pymoul.ini' : (getPyMoulIniLocation, ()), - } - -def getMoulDir(name): - """Lookup MOUL directory - """ - callable, args = _mapping.get(name) - return os.path.join(callable(), *args) - -def listMoulDirs(): - """List all MOUL dirs - """ - return dict([(name, getMoulDir(name)) for name in _mapping]) +_directories = Directories(_configuration) +clearCache = _directories.clearCache +lookupDir = _directories.lookupDir +listDirs = _directories.listDirs Deleted: pymoul/trunk/src/moul/config/darwin.py =================================================================== --- pymoul/trunk/src/moul/config/darwin.py 2007-01-23 11:06:58 UTC (rev 58) +++ pymoul/trunk/src/moul/config/darwin.py 2007-01-23 13:02:21 UTC (rev 59) @@ -1,57 +0,0 @@ -# pyMoul - Python interface to Myst Online URU Live -# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> - -# 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 2 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, write to the Free Software Foundation, Inc., 59 -# Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -"""Darwin (Mac OS X) configuration for pyMoul - -XXX: untested! -""" -__author__ = "Christian Heimes" -__version__ = "$Id$" -__revision__ = "$Revision$" - -import os -from moul.log import LOG -LOG.warning('Darwin/Mac support is not tested') - -MOUL_DIR = "Uru Live" -INI_FILE = ('pyMoul', 'pymoul.ini') -EXEC_NAME = "UruLauncher" -HOME = os.environ['HOME'] - -def getMoulUserDataDir(): - """Get path of MOUL data directory - - The MOUL data directory contains log files, chatlogs, KI images and many - more things. - """ - moul_data = os.path.join(HOME, MOUL_DIR) - -def getPyMoulIniLocation(): - """Get path to the pyMoul ini file - """ - ini_file = os.path.join(HOME, *INI_FILE) - return ini_file - -def _startMOUL(installdir, *args): - """Start MOUL - """ - # P_DETACH is similar to P_NOWAIT, but the new process is detached from - # the console of the calling process. - mode = os.P_DETACH - path = os.path.join(installdir, EXEC_NAME) - args = (EXEC_NAME,) + args - return os.spawnv(mode, path, args) Deleted: pymoul/trunk/src/moul/config/linux.py =================================================================== --- pymoul/trunk/src/moul/config/linux.py 2007-01-23 11:06:58 UTC (rev 58) +++ pymoul/trunk/src/moul/config/linux.py 2007-01-23 13:02:21 UTC (rev 59) @@ -1,57 +0,0 @@ -# pyMoul - Python interface to Myst Online URU Live -# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> - -# 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 2 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, write to the Free Software Foundation, Inc., 59 -# Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -"""Linux configuration for pyMoul - -XXX: untested! -""" -__author__ = "Christian Heimes" -__version__ = "$Id$" -__revision__ = "$Revision$" - -import os -from moul.log import LOG -LOG.warning('Linux support is not tested') - -MOUL_DIR = "Uru Live" -INI_FILE = ('pyMoul', 'pymoul.ini') -EXEC_NAME = "UruLauncher" -HOME = os.environ['HOME'] - -def getMoulUserDataDir(): - """Get path of MOUL data directory - - The MOUL data directory contains log files, chatlogs, KI images and many - more things. - """ - moul_data = os.path.join(HOME, MOUL_DIR) - -def getPyMoulIniLocation(): - """Get path to the pyMoul ini file - """ - ini_file = os.path.join(HOME, *INI_FILE) - return ini_file - -def _startMOUL(installdir, *args): - """Start MOUL - """ - # P_DETACH is similar to P_NOWAIT, but the new process is detached from - # the console of the calling process. - mode = os.P_DETACH - path = os.path.join(installdir, EXEC_NAME) - args = (EXEC_NAME,) + args - return os.spawnv(mode, path, args) Added: pymoul/trunk/src/moul/config/tests/test_config.py =================================================================== --- pymoul/trunk/src/moul/config/tests/test_config.py (rev 0) +++ pymoul/trunk/src/moul/config/tests/test_config.py 2007-01-23 13:02:21 UTC (rev 59) @@ -0,0 +1,35 @@ +# pyMoul - Python interface to Myst Online URU Live +# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> + +# 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 2 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, write to the Free Software Foundation, Inc., 59 +# Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +"""moul.config unit tests +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import unittest +from doctest import DocTestSuite + +import moul.config + +def test_suite(): + return unittest.TestSuite(( + DocTestSuite('moul.config') + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") Property changes on: pymoul/trunk/src/moul/config/tests/test_config.py ___________________________________________________________________ Name: svn:eol-style + native Deleted: pymoul/trunk/src/moul/config/win32.py =================================================================== --- pymoul/trunk/src/moul/config/win32.py 2007-01-23 11:06:58 UTC (rev 58) +++ pymoul/trunk/src/moul/config/win32.py 2007-01-23 13:02:21 UTC (rev 59) @@ -1,67 +0,0 @@ -# pyMoul - Python interface to Myst Online URU Live -# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> - -# 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 2 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, write to the Free Software Foundation, Inc., 59 -# Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -"""Win32 configuration for pyMoul -""" -__author__ = "Christian Heimes" -__version__ = "$Id$" -__revision__ = "$Revision$" - -import os -from miniwinshell import my_documents -from miniwinshell import application_data -#from win32com.directsound import directsound - -MOUL_DIR = "Uru Live" -INI_FILE = ('pyMoul', 'pymoul.ini') -EXEC_NAME = "UruLauncher.exe" - -def getMoulUserDataDir(): - """Get path of MOUL data directory - - The MOUL data directory contains log files, chatlogs, KI images and many - more things. - """ - mydoc = my_documents() - moul_data = os.path.join(mydoc, MOUL_DIR) - return moul_data - -def getPyMoulIniLocation(): - """Get path to the pyMoul ini file - """ - app_data = application_data() - ini_file = os.path.join(app_data, *INI_FILE) - return ini_file - -def _startMOUL(installdir, *args): - """Start MOUL - """ - # P_DETACH is similar to P_NOWAIT, but the new process is detached from - # the console of the calling process. - mode = os.P_DETACH - path = os.path.join(installdir, EXEC_NAME) - args = (EXEC_NAME,) + args - return os.spawnv(mode, path, args) - -#def enumSoundDevices(): -# """ -# """ -# names = [] -# for iid, name, driver in directsound.DirectSoundEnumerate(): -# if iid is not None: -# names.append(name) -# return names Modified: pymoul/trunk/src/moul/file/localization.py =================================================================== --- pymoul/trunk/src/moul/file/localization.py 2007-01-23 11:06:58 UTC (rev 58) +++ pymoul/trunk/src/moul/file/localization.py 2007-01-23 13:02:21 UTC (rev 59) @@ -33,7 +33,6 @@ from xml.sax import make_parser from xml.sax.handler import feature_namespaces -from moul.config import getMoulDir from moul.log import LOG def _add(d, key, value): @@ -179,7 +178,7 @@ parser.setContentHandler(dh) parser.parse(fd) -def parseLocDirectory(path=None, clear=False): +def parseLocDirectory(path, clear=False): """Parse all loc files in a directory """ files = [] @@ -188,8 +187,6 @@ if clear: translationRegistry.clear() - if path is None: - path = getMoulDir('loc') if not os.path.isdir(path): raise IOError("invalid path %s" % path) @@ -210,10 +207,3 @@ files.append(fname) return {'files' : files, 'errors' : errors } - -def _test(): - path = getMoulDir('loc') - parseDirectory(path) - -if __name__ == '__main__': - _test() Modified: pymoul/trunk/src/moul/file/plasmalog.py =================================================================== --- pymoul/trunk/src/moul/file/plasmalog.py 2007-01-23 11:06:58 UTC (rev 58) +++ pymoul/trunk/src/moul/file/plasmalog.py 2007-01-23 13:02:21 UTC (rev 59) @@ -27,8 +27,6 @@ import zipfile import re -from moul.config import getMoulDir -from moul.config import getConfigOption from moul.crypt.elf import decryptElf PLASMA_LOG = "plasmalog.txt" @@ -54,18 +52,11 @@ return False return getTimeStamp(pl) -def zipLogDir(logdir=None, destdir=None, remove=_marker): +def zipLogDir(logdir, destdir, remove): """Zip all log files This function also zips subdirectories. """ - if logdir is None: - logdir = getMoulDir('log') - if destdir is None: - destdir = getMoulDir('userdata') - if remove is _marker: - remove = getConfigOption('moul', 'removelogs', default=False) - stored_dirs = [] for root, dirs, files in os.walk(logdir): @@ -92,14 +83,11 @@ return stored_dirs -def removeLogs(logdir=None): +def removeLogs(logdir): """Removes log directories The removeLogs function removes only files considered as safe """ - if logdir is None: - logdir = getMoulDir('log') - for root, dirs, files in os.walk(logdir, topdown=False): for name in files: if RE_SAFEXT.search(name): Modified: pymoul/trunk/src/moul/osdependent/__init__.py =================================================================== --- pymoul/trunk/src/moul/osdependent/__init__.py 2007-01-23 11:06:58 UTC (rev 58) +++ pymoul/trunk/src/moul/osdependent/__init__.py 2007-01-23 13:02:21 UTC (rev 59) @@ -1,22 +1,22 @@ -# pyMoul - Python interface to Myst Online URU Live -# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> - -# 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 2 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, write to the Free Software Foundation, Inc., 59 -# Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -""" -""" -__author__ = "Christian Heimes" -__version__ = "$Id$" -__revision__ = "$Revision$" +# pyMoul - Python interface to Myst Online URU Live +# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> + +# 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 2 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, write to the Free Software Foundation, Inc., 59 +# Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +""" +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" Modified: pymoul/trunk/src/moul/osdependent/darwin/__init__.py =================================================================== --- pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-01-23 11:06:58 UTC (rev 58) +++ pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-01-23 13:02:21 UTC (rev 59) @@ -1,23 +1,54 @@ -# pyMoul - Python interface to Myst Online URU Live -# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> - -# 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 2 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, write to the Free Software Foundation, Inc., 59 -# Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -""" -""" -__author__ = "Christian Heimes" -__version__ = "$Id$" -__revision__ = "$Revision$" - +# pyMoul - Python interface to Myst Online URU Live +# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> + +# 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 2 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, write to the Free Software Foundation, Inc., 59 +# Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +"""moul.osdependent.darwin +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import os +from moul.log import LOG +LOG.warning('Darwin/Mac support is not tested') + +MOUL_DIR = "Uru Live" +EXEC_NAME = "UruLauncher" +HOME = os.environ['HOME'] + +def getMoulUserDataDir(): + """Get path of MOUL data directory + + The MOUL data directory contains log files, chatlogs, KI images and many + more things. + """ + moul_data = os.path.join(HOME, MOUL_DIR) + +def getPyMoulIniDir(): + """Get path to the pyMoul ini directory + """ + inidir= os.path.join(HOME, '.pymoul') + return inidir + +def _startMOUL(installdir, *args): + """Start MOUL + """ + # P_DETACH is similar to P_NOWAIT, but the new process is detached from + # the console of the calling process. + mode = os.P_DETACH + path = os.path.join(installdir, EXEC_NAME) + args = (EXEC_NAME,) + args + return os.spawnv(mode, path, args) Modified: pymoul/trunk/src/moul/osdependent/linux/__init__.py =================================================================== --- pymoul/trunk/src/moul/osdependent/linux/__init__.py 2007-01-23 11:06:58 UTC (rev 58) +++ pymoul/trunk/src/moul/osdependent/linux/__init__.py 2007-01-23 13:02:21 UTC (rev 59) @@ -1,23 +1,55 @@ -# pyMoul - Python interface to Myst Online URU Live -# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> - -# 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 2 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, write to the Free Software Foundation, Inc., 59 -# Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -""" -""" -__author__ = "Christian Heimes" -__version__ = "$Id$" -__revision__ = "$Revision$" - +# pyMoul - Python interface to Myst Online URU Live +# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> + +# 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 2 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, write to the Free Software Foundation, Inc., 59 +# Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +"""moul.osdependent.linux +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import os +from moul.log import LOG +LOG.warning('Linux support is not tested') + +MOUL_DIR = "Uru Live" +INI_FILE = ('pyMoul', 'pymoul.ini') +EXEC_NAME = "UruLauncher" +HOME = os.environ['HOME'] + +def getMoulUserDataDir(): + """Get path of MOUL data directory + + The MOUL data directory contains log files, chatlogs, KI images and many + more things. + """ + moul_data = os.path.join(HOME, MOUL_DIR) + +def getPyMoulIniDir(): + """Get path to the pyMoul ini directory + """ + inidir= os.path.join(HOME, '.pymoul') + return inidir + +def _startMOUL(installdir, *args): + """Start MOUL + """ + # P_DETACH is similar to P_NOWAIT, but the new process is detached from + # the console of the calling process. + mode = os.P_DETACH + path = os.path.join(installdir, EXEC_NAME) + args = (EXEC_NAME,) + args + return os.spawnv(mode, path, args) Modified: pymoul/trunk/src/moul/osdependent/win32/__init__.py =================================================================== --- pymoul/trunk/src/moul/osdependent/win32/__init__.py 2007-01-23 11:06:58 UTC (rev 58) +++ pymoul/trunk/src/moul/osdependent/win32/__init__.py 2007-01-23 13:02:21 UTC (rev 59) @@ -1,23 +1,69 @@ -# pyMoul - Python interface to Myst Online URU Live -# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> - -# 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 2 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, write to the Free Software Foundation, Inc., 59 -# Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -""" -""" -__author__ = "Christian Heimes" -__version__ = "$Id$" -__revision__ = "$Revision$" - +# pyMoul - Python interface to Myst Online URU Live +# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> + +# 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 2 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, write to the Free Software Foundation, Inc., 59 +# Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +"""moul.osdependent.win32 +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import os +#from moul.osdependent.win32.miniwinshell import my_documents +#from moul.osdependent.win32.miniwinshell import application_data +#from win32com.directsound import directsound +from moul.osdependent.win32.winpath import get_homedir +from moul.osdependent.win32.winpath import get_appdata + + +MOUL_DIR = "Uru Live" +EXEC_NAME = "UruLauncher.exe" + +def getMoulUserDataDir(): + """Get path of MOUL data directory + + The MOUL data directory contains log files, chatlogs, KI images and many + more things. + """ + mydoc = get_homedir() + moul_data = os.path.join(mydoc, MOUL_DIR) + return moul_data + +def getPyMoulIniDir(): + """Get path to the pyMoul ini file + """ + app_data = get_appdata() + inidir = os.path.join(app_data, 'pyMoul') + return inidir + +def _startMOUL(installdir, *args): + """Start MOUL + """ + # P_DETACH is similar to P_NOWAIT, but the new process is detached from + # the console of the calling process. + mode = os.P_DETACH + path = os.path.join(installdir, EXEC_NAME) + args = (EXEC_NAME,) + args + return os.spawnv(mode, path, args) + +#def enumSoundDevices(): +# """ +# """ +# names = [] +# for iid, name, driver in directsound.DirectSoundEnumerate(): +# if iid is not None: +# names.append(name) +# return names Added: pymoul/trunk/src/moul/osdependent/win32/registry.py =================================================================== --- pymoul/trunk/src/moul/osdependent/win32/registry.py (rev 0) +++ pymoul/trunk/src/moul/osdependent/win32/registry.py 2007-01-23 13:02:21 UTC (rev 59) @@ -0,0 +1,69 @@ +"""Based on http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146305 +""" +import _winreg as wreg +#import cPickle as pickle + +class WindowsRegistry: + + def __init__(self, company="spirito GmbH", project="TestProg", write=1): + """ + handle registry access + """ + self.write = write + self.company = company + self.project = project + self.keyname = "Software\\%s\\%s" % (self.company, self.project) + + try: + self.key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, self.keyname) + except: + if self.write: + self.key = wreg.CreateKey(wreg.HKEY_CURRENT_USER, self.keyname) + + def set(self, name, value): + " set value in registry " + if not self.write: + raise Exception, "registry is read only" + wreg.SetValue(self.key, name, wreg.REG_SZ,str(value)) + +# def pset(self, name, value): +# " set using pickle " +# self.set(name, pickle.dumps(value)) + + def get(self, name): + " get value out of registry " + return wreg.QueryValue(self.key, name) + + def delkey(self, name): + """Delete a key + """ + if not self.write: + raise Exception, "registry is read only" + return wreg.DeleteKey(self.key, name) + + def delvalue(self, name): + """Delete a value + """ + if not self.write: + raise Exception, "registry is read only" + return wreg.ValueKey(self.key, name) + +# def pget(self, name): +# " get using pickle " +# return pickle.loads(self.get(name)) + + def close(self): + " close the key finally " + self.key.Close() + + def __del__(self): + self.close() + + +if __name__=="__main__": + r = WindowsRegistry(project="MyTestProg", write=1) + r.set("test", "hello string data") + r.pset("testp", 123) + print r.get("test") + print r.pget("testp") + Property changes on: pymoul/trunk/src/moul/osdependent/win32/registry.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/osdependent/win32/winpath.py =================================================================== --- pymoul/trunk/src/moul/osdependent/win32/winpath.py (rev 0) +++ pymoul/trunk/src/moul/osdependent/win32/winpath.py 2007-01-23 13:02:21 UTC (rev 59) @@ -0,0 +1,150 @@ +"""Functions for getting system/language/user dependent paths on windows. + +All path names returned by the functions of this module are unicode strings. + +From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473846/ +""" + +__all__ = [ + 'HKCU', 'HKLM', + 'SHELL_FOLDERS', + 'USER_SHELL_FOLDERS', + 'expandvars', + 'get_appdata', + 'get_common_shellfolders', + 'get_homedir', + 'get_sharedconf', + 'get_shellfolders', + 'get_userconf', + 'get_windir' +] + +__module__ = "winpaths" +__author__ = "Christopher Arndt" +__version__ = "0.1" +__revision__ = "$Rev$" +__date__ = "$Date$" +__copyright__ = "Python license" + +# standard library modules +import _winreg, os + +SHELL_FOLDERS = \ + r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders' +USER_SHELL_FOLDERS = \ + r'Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' +HKCU = _winreg.HKEY_CURRENT_USER +HKLM = _winreg.HKEY_LOCAL_MACHINE + +# helper functions +def _substenv(m): + return os.environ.get(m.group(1), m.group(0)) + +_env_rx = None +def expandvars(s): + """Expand environment variables of form %var%. + + Unknown variables are left unchanged. + """ + + global _env_rx + + if '%' not in s: + return s + if _env_rx is None: + import re + _env_rx = re.compile(r'%([^|<>=^%]+)%') + return _env_rx.sub(_substenv, s) + +def _get_reg_value(key, subkey, name): + """Return registry value specified by key, subkey, and name. + + Environment variables in values of type REG_EXPAND_SZ are expanded + if possible. + """ + + key = _winreg.OpenKey(key, subkey) + try: + ret = _winreg.QueryValueEx(key, name) + except WindowsError: + return None + else: + key.Close() + if ret[1] == _winreg.REG_EXPAND_SZ: + return expandvars(ret[0]) + else: + return ret[0] + +def _get_reg_user_value(key, name): + """Return a windows registry value from the CURRENT_USER branch.""" + + return _get_reg_value(HKCU, key, name) + +def _get_reg_machine_value(key, name): + """Return a windows registry value from the LOCAL_MACHINE branch.""" + + return _get_reg_value(HKLM, key, name) + +# public functions +def get_appdata(): + """Return path of directory where apps should store user specific data.""" + + return _get_reg_user_value(SHELL_FOLDERS, 'AppData') + +def get_common_shellfolders(): + """Return mapping of shell folder names (all users) to paths.""" + + return get_shellfolders(branch=HKLM) + +def get_homedir(): + """Return path to user home directory, i.e. 'My Files'.""" + + return _get_reg_user_value(SHELL_FOLDERS, 'Personal') + +def get_sharedconf(prog, *args): + """Return path to shared configuration data for 'prog' from 'vendor'. + + Additional arguments are appended via os.path.join(). + + See also: get_user_conf() + """ + + return os.path.join( + _get_reg_machine_value(SHELL_FOLDERS, 'Common AppData'), + vendor, prog, *args + ) + +def get_shellfolders(branch=HKCU, key=SHELL_FOLDERS): + """Return mapping of shell folder names (current user) to paths.""" + + key = _winreg.OpenKey(branch, key) + folders = {} + i = 0 + while True: + try: + ret = _winreg.EnumValue(key, i) + if ret[2] == _winreg.REG_EXPAND_SZ: + folders[ret[0]] = expandvars(ret[1]) + else: + folders[ret[0]] = ret[1] + except WindowsError: + break + i +=1 + key.Close() + return folders + +def get_userconf(vendor, prog, *args): + """Return path to user configuration data for 'prog' from 'vendor'. + + Additional arguments are appended via os.path.join(), e.g. + use like this: + + optionsfn = get_userconf("ACME Soft", "Exploder", "Options.xml") + """ + + return os.path.join(get_appdata(), vendor, prog, *args) + +def get_windir(): + """Convenience function to get path to windows installation directory.""" + + return unicode(os.environ["WINDIR"]) Property changes on: pymoul/trunk/src/moul/osdependent/win32/winpath.py ___________________________________________________________________ Name: svn:eol-style + native Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-23 11:06:58 UTC (rev 58) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-23 13:02:21 UTC (rev 59) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Fri Jan 19 17:32:22 2007 +# Created: Fri Jan 19 17:47:21 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-23 11:06:59
|
Revision: 58 http://pymoul.svn.sourceforge.net/pymoul/?rev=58&view=rev Author: tiran Date: 2007-01-23 03:06:58 -0800 (Tue, 23 Jan 2007) Log Message: ----------- Renamed misc to contrib Added distutils_upx file with UpxCommand class Fixed typo in config.darwin Added epydoc support doc Makefile Modified Paths: -------------- pymoul/trunk/Makefile pymoul/trunk/setup.py pymoul/trunk/setup_win32.py pymoul/trunk/src/moul/config/darwin.py Added Paths: ----------- pymoul/trunk/contrib/ pymoul/trunk/distutils_upx.py pymoul/trunk/doc/ Removed Paths: ------------- pymoul/trunk/misc/ Modified: pymoul/trunk/Makefile =================================================================== --- pymoul/trunk/Makefile 2007-01-22 19:09:49 UTC (rev 57) +++ pymoul/trunk/Makefile 2007-01-23 11:06:58 UTC (rev 58) @@ -1,4 +1,5 @@ -PYTHON?=python2.5 +PYTHON?=python +EPYDOC=$(PYTHON) -c "import epydoc.cli; epydoc.cli.cli()" TESTFLAGS=-v TESTOPTS= SETUPFLAGS= @@ -7,16 +8,16 @@ # Build in-place inplace: - $(PYTHON) setup.py $(SETUPFLAGS) build_ext -i + PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) build_ext -i build: compileui - $(PYTHON) setup.py $(SETUPFLAGS) build + PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) build py2exe: - $(PYTHON) setup.py $(SETUPFLAGS) py2exe + PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) py2exe bdist_egg: - $(PYTHON) setup.py $(SETUPFLAGS) bdist_egg + PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) bdist_egg run: compileui PYTHONPATH="src" $(PYTHON) src/moul/qt/moulqt.py @@ -30,6 +31,9 @@ test_inplace: compileui PYTHONPATH="src" $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS) +doc_html: + PYTHONPATH="src" $(EPYDOC) -v --html --output="doc/html" moul + # What should the default be? test: test_inplace Copied: pymoul/trunk/contrib (from rev 57, pymoul/trunk/misc) Added: pymoul/trunk/distutils_upx.py =================================================================== --- pymoul/trunk/distutils_upx.py (rev 0) +++ pymoul/trunk/distutils_upx.py 2007-01-23 11:06:58 UTC (rev 58) @@ -0,0 +1,130 @@ +"""Patched distutils Command +""" +__author__ = "Christian Heimes" +__version__ = "$Id" +__revision__ = "$Revision$" + +import os +import sys +from inspect import getmro +from tempfile import TemporaryFile +from subprocess import call +from distutils import log +from stat import ST_SIZE + +def inEnvPath(name): + result = [] + for path in os.environ['PATH'].split(';'): + upx = os.path.join(path, name) + if os.path.isfile(upx): + result.append(upx) + if result: + return result[0] + +def _call(cmd, silent=False, *args, **kwargs): + """Call silently - redirect stdout to dump + """ + data = None + if silent: + stdout = TemporaryFile() + else: + stdout = None + try: + retcode = call(cmd, stdout=stdout, *args, **kwargs) + finally: + if stdout: + data = stdout.read() + stdout.close() + return retcode, data + +def _has_upx(upx): + """Search for UPX in search path + """ + try: + retcode, stdout = _call("%s --version" % upx, silent=True) + except OSError: + log.debug('UPX not found') + return False + else: + if retcode == 0: + log.debug('UPX found') + return True + else: + log.debug('UPX: an error occured %i' % retcode) + return False + +def _upx_compress(upx, args, fname): + """Check file + """ + retcode, stdout = _call('upx %s "%s"' % (args, fname), silent=False) + if retcode == 0: # file packed + pass + elif retcode == 2: # file already packed + pass + else: # something bad has happend + sys.exit(retcode) + +def otherclass(mycls): + for cls in getmro(mycls): + if not issubclass(cls, UpxCommand): + return cls + raise ValueError(mycls) + +class UpxCommand: + def initialize_options(self): + result = otherclass(self.__class__).initialize_options(self) + self.upx = True + self.upx_args = '--no-color --best' + self.upx_path = 'upx' + self.upx_extensions = ( + 'pyd', 'dll', 'exe', # Windows + '', 'so', # Linux + 'dylib', # Mac OS X + ) + return result + + def finalize_options(self): + result = otherclass(self.__class__).finalize_options(self) + self.has_upx = _has_upx(self.upx_path) + self.upx_packed = [] + return result + + def copy_file(self, *args, **kwargs): + # Override to UPX copied binaries. + result = otherclass(self.__class__).copy_file(self, *args, **kwargs) + self._upx_compress(result) + return result + + def _upx_compress(self, result): + fname, copied = result + if not self.has_upx or not self.upx or not copied: + return + + basename = os.path.basename(fname) + tmp, ext = os.path.splitext(basename) + ext = ext[1:] # strip leading dot + origsize = os.stat(fname)[ST_SIZE] + if ext in self.upx_extensions: + _upx_compress(self.upx_path, self.upx_args, os.path.normpath(fname)) + newsize = os.stat(fname)[ST_SIZE] + ratio = newsize*100 / origsize + self.upx_packed.append((basename, origsize, newsize, ratio)) + return result + + def run(self, *args, **kwargs): + result = otherclass(self.__class__).run(self, *args, **kwargs) + if self.has_upx and self.upx: + print "\n*** UPX result ***" + for basename, origsize, newsize, ratio in self.upx_packed: + print " %s packed to %i%%" % (basename, ratio) + print "\n" + return result + + +try: + from py2exe.build_exe import py2exe +except ImportError: + pass +else: + class UpxPy2exe(UpxCommand, py2exe): + pass Property changes on: pymoul/trunk/distutils_upx.py ___________________________________________________________________ Name: svn:eol-style + native Property changes on: pymoul/trunk/doc ___________________________________________________________________ Name: svn:ignore + html Modified: pymoul/trunk/setup.py =================================================================== --- pymoul/trunk/setup.py 2007-01-22 19:09:49 UTC (rev 57) +++ pymoul/trunk/setup.py 2007-01-23 11:06:58 UTC (rev 58) @@ -23,6 +23,7 @@ # import the rest from setuptools import setup from setuptools import find_packages + from compileui import compileUi VERSION = "0.0" @@ -93,14 +94,9 @@ if sys.platform.startswith('win32'): from setup_win32 import updateSetupOptions from setup_win32 import updateSetupOptionsQT - from setup_win32 import upxPack updateSetupOptions(kwargs) updateSetupOptionsQT(kwargs) elif sys.platform.startswith('linux2'): kwargs['packages'].append('moul.qt') setup(**kwargs) - -if sys.platform.startswith('win') and 'py2exe' in sys.argv: - pass - upxPack('dist') Modified: pymoul/trunk/setup_win32.py =================================================================== --- pymoul/trunk/setup_win32.py 2007-01-22 19:09:49 UTC (rev 57) +++ pymoul/trunk/setup_win32.py 2007-01-23 11:06:58 UTC (rev 58) @@ -12,8 +12,11 @@ import py2exe except ImportError: print >>sys.stderr, "py2exe missing, unable to create executables" + cmdclass = {} else: # If run without args, build executables, in quiet mode. + from distutils_upx import UpxPy2exe + cmdclass = {'py2exe': UpxPy2exe} if len(sys.argv) == 1: sys.argv.append("py2exe") @@ -50,31 +53,8 @@ # packages = ['pytz.%s.*' % pack for pack in packages] # return packages -def inEnvPath(name): - result = [] - for path in os.environ['PATH'].split(';'): - upx = os.path.join(path, name) - if os.path.isfile(upx): - result.append(upx) - if result: - return result[0] - -def upxPack(dst): - """Pack PE executables with UPX http://upx.sourceforge.net/ - - UPX can shrink dll, exe and pyd files 50 to 70% without disadvantage - """ - if not inEnvPath('upx.exe'): - print >>sys.stderr, "UPX not available - skipping" - upx_pack = [] - for root, dirs, files in os.walk(dst): - for file in files: - if file[-4:] in ('.pyd', '.dll', '.exe'): - upx_pack.append(os.path.join(root, file)) - # --best --all-methods --all-filters - os.system("upx -q --mono %s" % ' '.join(upx_pack)) - def updateSetupOptions(kw): + kw['cmdclass'] = cmdclass for req in ("py2exe >=0.6.5",): kw['setup_requires'].append(req) for req in (): Modified: pymoul/trunk/src/moul/config/darwin.py =================================================================== --- pymoul/trunk/src/moul/config/darwin.py 2007-01-22 19:09:49 UTC (rev 57) +++ pymoul/trunk/src/moul/config/darwin.py 2007-01-23 11:06:58 UTC (rev 58) @@ -30,7 +30,7 @@ MOUL_DIR = "Uru Live" INI_FILE = ('pyMoul', 'pymoul.ini') EXEC_NAME = "UruLauncher" -HOME = os.environ('HOME') +HOME = os.environ['HOME'] def getMoulUserDataDir(): """Get path of MOUL data directory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-22 19:10:00
|
Revision: 57 http://pymoul.svn.sourceforge.net/pymoul/?rev=57&view=rev Author: tiran Date: 2007-01-22 11:09:49 -0800 (Mon, 22 Jan 2007) Log Message: ----------- Revert last commit: svn merge -r COMMITTED:PREV __init__.py Modified Paths: -------------- pymoul/trunk/src/moul/config/__init__.py Modified: pymoul/trunk/src/moul/config/__init__.py =================================================================== --- pymoul/trunk/src/moul/config/__init__.py 2007-01-22 18:50:34 UTC (rev 56) +++ pymoul/trunk/src/moul/config/__init__.py 2007-01-22 19:09:49 UTC (rev 57) @@ -15,8 +15,138 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # Temple Place, Suite 330, Boston, MA 02111-1307 USA # +"""Configuration package """ -""" -__author__ = "Christian Heimes" -__version__ = "$Id$" -__revision__ = "$Revision$" +__all__ = ('setMoulInstallDir', 'startMOUL', 'getMoulDir') + +import os +import sys +from moul.log import getLogger + +# a program under py2exe is sys.frozen +__FROZEN__ = bool(getattr(sys, 'frozen', False)) +# OS stuff +__WIN32__ = sys.platform.startswith('win32') # win64, cygwin? +__LINUX__ = sys.platform.startswith('linux2') +__MACOSX__ = sys.platform.startswith('darwin') +__UNIX__ = __LINUX__ or __MACOSX__ + +_marker=object() +# XXX: what about cygwin, bsd and others? +if __WIN32__: + from moul.config.win32 import ( + getMoulUserDataDir, + getPyMoulIniLocation, + _startMOUL, + EXEC_NAME + ) +elif __LINUX__: + from moul.config.linux import ( + getMoulUserDataDir, + getPyMoulIniLocation, + _startMOUL, + EXEC_NAME + ) +elif __MACOSX__: + from moul.config.darwin import ( + getMoulUserDataDir, + getPyMoulIniLocation, + _startMOUL, + EXEC_NAME + ) +else: + raise RuntimeError('platform %s not supported' % sys.platform) + +## configuration +_configuration = { + 'moul' : {} + } + +def getConfigOption(section, name=None, default=_marker): + """Get configuration option + """ + global _configuration + if name is None: + section, name = section.split('.') + sec = _configuration.get(section, default) + if sec is not default: + value = sec.get(name, default) + if value is default and default is _marker: + raise KeyError("%s.%s" % (section, name)) + else: + return value + elif default is _marker: + raise KeyError(section) + +def setConfigOption(section, name=None, value=_marker): + """Set configuratin option + """ + global _configuration + if value is _marker: + raise ValueError("No value applied") + if name is None: + section, name = section.split('.') + sec = _configuration[section] + if value is None: + del sec[name] + else: + sec[name] = value + +def addConfigSection(section): + """Add a new configuration section + """ + global _configuration + return _configuration.setdefault(section, {}) + +def listConfig(): + """List + """ + global _configuration + out = {} + for sec, names in _configuration.items(): + for name, value in names.items(): + fullname = "%s.%s" % (sec, name) + out[fullname] = value + return out + +#setConfigOption('moul', 'installdir', 'D:\\games\\MystOnline') + +## directories +def getMoulInstallDir(): + return getConfigOption('moul.installdir') + +def startMOUL(*args): + """Start MOUL wrapper + """ + installdir = getMoulInstallDir() + _startMOUL(installdir, *args) + +# name -> (callable, list) +_mapping = { + 'install' : (getMoulInstallDir, ()), + 'loc' : (getMoulInstallDir, ('dat', )), + 'dat' : (getMoulInstallDir, ('dat', )), + 'sound' : (getMoulInstallDir, ('sfx', )), + 'soundwav' : (getMoulInstallDir, ('sfx', 'streamingCache', )), + 'video' : (getMoulInstallDir, ('avi', )), + + 'userdata' : (getMoulUserDataDir, ()), + 'log' : (getMoulUserDataDir, ('Log', )), + 'kiimages' : (getMoulUserDataDir, ('KIimages', )), + 'avatars' : (getMoulUserDataDir, ('Avatars', )), + 'chatlogs' : (getMoulUserDataDir, ('chatlogs', )), + 'ini' : (getMoulUserDataDir, ('init', )), + + 'pymoul.ini' : (getPyMoulIniLocation, ()), + } + +def getMoulDir(name): + """Lookup MOUL directory + """ + callable, args = _mapping.get(name) + return os.path.join(callable(), *args) + +def listMoulDirs(): + """List all MOUL dirs + """ + return dict([(name, getMoulDir(name)) for name in _mapping]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-20 20:23:20
|
Revision: 55 http://pymoul.svn.sourceforge.net/pymoul/?rev=55&view=rev Author: tiran Date: 2007-01-20 12:23:17 -0800 (Sat, 20 Jan 2007) Log Message: ----------- loc parser tests Modified Paths: -------------- pymoul/trunk/src/moul/file/localization.py pymoul/trunk/src/moul/file/tests/test_localization.py Added Paths: ----------- pymoul/trunk/src/moul/file/tests/test.loc Modified: pymoul/trunk/src/moul/file/localization.py =================================================================== --- pymoul/trunk/src/moul/file/localization.py 2007-01-20 20:00:57 UTC (rev 54) +++ pymoul/trunk/src/moul/file/localization.py 2007-01-20 20:23:17 UTC (rev 55) @@ -70,6 +70,13 @@ assert key == translation.key() dict.__setitem__(self, key, translation) + def clear(self): + dict.clear(self) + self._bylanguage.clear() + self._byage.clear() + self._byset.clear() + self._byelement.clear() + translationRegistry = TranslationRegistry() registerTranslation = translationRegistry.register @@ -101,6 +108,12 @@ @property def age(self): return self._age + @property + def set(self): return self._set + + @property + def element(self): return self._element + def __str__(self): return self.content @@ -193,7 +206,7 @@ LOG.debug("parseLogDirectory: unable to read file %s" % loc) continue with open(loc, 'r') as fd: - parseLoc(fd, fname=fname, debug=debug) + parseLoc(fd, fname=fname) files.append(fname) return {'files' : files, 'errors' : errors } Added: pymoul/trunk/src/moul/file/tests/test.loc =================================================================== --- pymoul/trunk/src/moul/file/tests/test.loc (rev 0) +++ pymoul/trunk/src/moul/file/tests/test.loc 2007-01-20 20:23:17 UTC (rev 55) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<localizations> + <age name="testage"> + <set name="testset"> + <element name="testelement"> +<translation language="english"> +text +data +foo +</translation> + </element> + </set> + </age> +</localizations> + Modified: pymoul/trunk/src/moul/file/tests/test_localization.py =================================================================== --- pymoul/trunk/src/moul/file/tests/test_localization.py 2007-01-20 20:00:57 UTC (rev 54) +++ pymoul/trunk/src/moul/file/tests/test_localization.py 2007-01-20 20:23:17 UTC (rev 55) @@ -21,13 +21,39 @@ __version__ = "$Id$" __revision__ = "$Revision$" +import os import unittest from doctest import DocTestSuite -import moul.file.localization +from moul.file.localization import parseLocDirectory +from moul.file.localization import parseLoc +from moul.file.localization import translationRegistry +base = os.path.dirname(__file__) + +class LocalizationTest(unittest.TestCase): + def setUp(self): + self._old = translationRegistry.copy() + translationRegistry.clear() + + def tearDown(self): + pass + + def test_parseLocDir(self): + parseLocDirectory(base) + key = (u'testage', u'testset', u'testelement', u'english') + self.failUnless(key in translationRegistry, translationRegistry.keys()) + self.failUnlessEqual(len(translationRegistry), 1) + + def test_parseLoc(self): + parseLoc(os.path.join(base, 'test.loc')) + key = (u'testage', u'testset', u'testelement', u'english') + self.failUnless(key in translationRegistry, translationRegistry.keys()) + self.failUnlessEqual(len(translationRegistry), 1) + def test_suite(): return unittest.TestSuite(( + unittest.makeSuite(LocalizationTest), DocTestSuite('moul.file.localization') )) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-20 20:00:57
|
Revision: 54 http://pymoul.svn.sourceforge.net/pymoul/?rev=54&view=rev Author: tiran Date: 2007-01-20 12:00:57 -0800 (Sat, 20 Jan 2007) Log Message: ----------- Removed stupid tabs Modified Paths: -------------- pymoul/trunk/GPL.txt pymoul/trunk/src/moul/file/kiimage.py pymoul/trunk/src/moul/file/localization.py pymoul/trunk/src/moul/file/tests/test_kiimage.py Modified: pymoul/trunk/GPL.txt =================================================================== --- pymoul/trunk/GPL.txt 2007-01-20 16:32:00 UTC (rev 53) +++ pymoul/trunk/GPL.txt 2007-01-20 20:00:57 UTC (rev 54) @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -56,7 +56,7 @@ The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -255,7 +255,7 @@ of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - Appendix: How to Apply These Terms to Your New Programs + Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it Modified: pymoul/trunk/src/moul/file/kiimage.py =================================================================== --- pymoul/trunk/src/moul/file/kiimage.py 2007-01-20 16:32:00 UTC (rev 53) +++ pymoul/trunk/src/moul/file/kiimage.py 2007-01-20 20:00:57 UTC (rev 54) @@ -27,6 +27,9 @@ JPEG_HEADER = "\377\330\377" +class KiImageError(ValueError): + pass + class KiImage(object): """Ki image handler @@ -36,15 +39,15 @@ def __init__(self, fd_name): if isinstance(fd_name, basestring): - name = fd_name - fd = open(fd_name, 'rb') + name = fd_name + fd = open(fd_name, 'rb') else: - name = getattr(fd_name, 'name', '<UNKNOWN>') - fd = fd_name - + name = getattr(fd_name, 'name', '<UNKNOWN>') + fd = fd_name + self._filename = name self._fd = fd - self._size = None + self._size = None def close(self): if self._fd: @@ -53,7 +56,7 @@ def getSize(self): if self._size is not None: - return self._size + return self._size fd = self._fd opos = fd.tell() size = 0 @@ -62,15 +65,15 @@ size = fd.tell() finally: fd.seek(opos) - self._size = size + self._size = size return size def moulHeaderToSize(self, header=None): # XXX use struct if header is None: - fd = self._fd - fd.seek(0) - header = fd.read(4) + fd = self._fd + fd.seek(0) + header = fd.read(4) size = 0 for i, l in enumerate(header): size += ord(l) << 8*i @@ -79,7 +82,7 @@ def sizeToMoulHeader(self, size=None): # XXX use struct if size is None: - size = self.getSize() + 4 # XXX +4 ? + size = self.getSize() leading = 4* [None] for i in (3,2,1,0): l = size >> 8*i @@ -113,18 +116,19 @@ def removeMoulHeader(self): if not self.isMoulImage(): - raise ValueError('Image has no MOUL header') + raise KiImageError('Image has no MOUL header') out = tempfile.TemporaryFile() fd = self._fd fd.seek(4) out.write(fd.read()) + out.seek(0) return out def addMoulHeader(self): if self.isMoulImage(): - raise ValueError('Image has already a MOUL header') + raise KiImageError('Image has already a MOUL header') if not self.isJpeg(): - raise ValueError('File is not a JPEG') + raise KiImageError('File is not a JPEG') out = tempfile.TemporaryFile() header = self.sizeToMoulHeader() fd = self._fd @@ -132,4 +136,5 @@ out.write(header) fd.seek(0) out.write(fd.read()) + out.seek(0) return out Modified: pymoul/trunk/src/moul/file/localization.py =================================================================== --- pymoul/trunk/src/moul/file/localization.py 2007-01-20 16:32:00 UTC (rev 53) +++ pymoul/trunk/src/moul/file/localization.py 2007-01-20 20:00:57 UTC (rev 54) @@ -36,12 +36,22 @@ from moul.config import getMoulDir from moul.log import LOG +def _add(d, key, value): + lst = d.setdefault(key, []) + lst.append(value) + class TranslationRegistry(dict): """Registry for Translation objects""" + __slot__ = ('_bylanguage', '_byage', '_byset', '_byelement') + def __new__(cls, *args, **kwargs): - inst = dict.__new__(cls, *args, **kwargs) - return inst + self = dict.__new__(cls, *args, **kwargs) + self._bylanguage = {} + self._byage = {} + self._byset = {} + self._byelement = {} + return self def register(self, translation): key = translation.key() @@ -50,6 +60,10 @@ (translation.fname, str(key))) LOG.error("TranslationRegistry: %s" % msg) raise KeyError(msg) + _add(self._bylanguage, translation.language, key) + _add(self._byage, translation.age, key) + _add(self._byset, translation.set, key) + _add(self._byelement, translation.element, key) self[key] = translation def __setitem__(self, key, translation): @@ -59,24 +73,34 @@ translationRegistry = TranslationRegistry() registerTranslation = translationRegistry.register -class Translation(object): - """Translation object""" +class Translation(unicode): + """Translation object - def __init__(self, age, set, element, language, content, fname=''): + >>> Translation(u"earth", u"journal", u"mybook", u"english", u"text", "file") + u'text' + """ + __slots__ = ('_age', '_set', '_element', '_language', '_fname') + + def __new__(cls, age, set, element, language, content, fname=''): + self = unicode.__new__(cls, content) for attr in age, set, element, language: assert attr - self.age = age - self.set = set - self.element = element - self.language = language - self.content = content - - self.fname = fname + self._age = age + self._set = set + self._element = element + self._language = language LOG.debug("New translation file(%s): %s" % (fname, self.key)) + return self def key(self): - return (self.age, self.set, self.element, self.language) + return (self._age, self._set, self._element, self._language) + @property + def language(self): return self._language + + @property + def age(self): return self._age + def __str__(self): return self.content Modified: pymoul/trunk/src/moul/file/tests/test_kiimage.py =================================================================== --- pymoul/trunk/src/moul/file/tests/test_kiimage.py 2007-01-20 16:32:00 UTC (rev 53) +++ pymoul/trunk/src/moul/file/tests/test_kiimage.py 2007-01-20 20:00:57 UTC (rev 54) @@ -27,6 +27,8 @@ from doctest import DocTestSuite from moul.file.kiimage import KiImage +from moul.file.kiimage import KiImageError +from moul.file.kiimage import JPEG_HEADER base = os.path.dirname(__file__) kiimg = os.path.join(base, 'avatar.jpg') @@ -36,7 +38,7 @@ def setUp(self): self._ki = open(kiimg, 'rb') - self._clean = open(kiclean, 'rb') + self._clean = open(kiclean, 'rb') def tearDown(self): self._ki.close() @@ -44,23 +46,44 @@ def test_openname(self): k = KiImage(kiimg) - self.failUnless(k.isMoulImage()) - self.failIf(k.isJpeg()) - - k = KiImage(kiclean) - self.failIf(k.isMoulImage()) - self.failUnless(k.isJpeg()) + self.failUnless(k.verifyMoulHeader()) + self.failUnless(k.isMoulImage()) + self.failIf(k.isJpeg()) + + k = KiImage(kiclean) + self.failIf(k.verifyMoulHeader()) + self.failIf(k.isMoulImage()) + self.failUnless(k.isJpeg()) def test_openfd(self): k = KiImage(self._ki) - self.failUnless(k.isMoulImage()) - self.failIf(k.isJpeg()) - - k = KiImage(self._clean) - self.failIf(k.isMoulImage()) - self.failUnless(k.isJpeg()) + self.failUnless(k.verifyMoulHeader()) + self.failUnless(k.isMoulImage()) + self.failIf(k.isJpeg()) + + k = KiImage(self._clean) + self.failIf(k.verifyMoulHeader()) + self.failIf(k.isMoulImage()) + self.failUnless(k.isJpeg()) - + def test_removeheader(self): + k = KiImage(self._ki) + fd = k.removeMoulHeader() + data = fd.read() + cleandata = self._clean.read() + self.failUnlessEqual(len(data), len(cleandata)) + self.failUnlessEqual(data, cleandata, + "file mismatch %r:%r" % (data[:8], cleandata[:8])) + + def test_addheader(self): + k = KiImage(self._clean) + fd = k.addMoulHeader() + data = fd.read() + kidata = self._ki.read() + self.failUnlessEqual(len(data), len(kidata)) + self.failUnlessEqual(data, kidata, + "file mismatch %r:%r" % (data[:8], kidata[:8])) + def test_suite(): return unittest.TestSuite(( unittest.makeSuite(KiImageTest), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-20 16:32:04
|
Revision: 53 http://pymoul.svn.sourceforge.net/pymoul/?rev=53&view=rev Author: tiran Date: 2007-01-20 08:32:00 -0800 (Sat, 20 Jan 2007) Log Message: ----------- Minor linux fixes KiImage fixes and first tests Modified Paths: -------------- pymoul/trunk/src/moul/file/kiimage.py pymoul/trunk/src/moul/file/tests/test_kiimage.py Added Paths: ----------- pymoul/trunk/src/moul/config/linux.py pymoul/trunk/src/moul/file/tests/avatar_clean.jpg Removed Paths: ------------- pymoul/trunk/src/moul/config/linux2.py Copied: pymoul/trunk/src/moul/config/linux.py (from rev 51, pymoul/trunk/src/moul/config/linux2.py) =================================================================== --- pymoul/trunk/src/moul/config/linux.py (rev 0) +++ pymoul/trunk/src/moul/config/linux.py 2007-01-20 16:32:00 UTC (rev 53) @@ -0,0 +1,57 @@ +# pyMoul - Python interface to Myst Online URU Live +# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> + +# 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 2 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, write to the Free Software Foundation, Inc., 59 +# Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +"""Linux configuration for pyMoul + +XXX: untested! +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import os +from moul.log import LOG +LOG.warning('Linux support is not tested') + +MOUL_DIR = "Uru Live" +INI_FILE = ('pyMoul', 'pymoul.ini') +EXEC_NAME = "UruLauncher" +HOME = os.environ['HOME'] + +def getMoulUserDataDir(): + """Get path of MOUL data directory + + The MOUL data directory contains log files, chatlogs, KI images and many + more things. + """ + moul_data = os.path.join(HOME, MOUL_DIR) + +def getPyMoulIniLocation(): + """Get path to the pyMoul ini file + """ + ini_file = os.path.join(HOME, *INI_FILE) + return ini_file + +def _startMOUL(installdir, *args): + """Start MOUL + """ + # P_DETACH is similar to P_NOWAIT, but the new process is detached from + # the console of the calling process. + mode = os.P_DETACH + path = os.path.join(installdir, EXEC_NAME) + args = (EXEC_NAME,) + args + return os.spawnv(mode, path, args) Deleted: pymoul/trunk/src/moul/config/linux2.py =================================================================== --- pymoul/trunk/src/moul/config/linux2.py 2007-01-20 15:28:50 UTC (rev 52) +++ pymoul/trunk/src/moul/config/linux2.py 2007-01-20 16:32:00 UTC (rev 53) @@ -1,57 +0,0 @@ -# pyMoul - Python interface to Myst Online URU Live -# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> - -# 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 2 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, write to the Free Software Foundation, Inc., 59 -# Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -"""Linux configuration for pyMoul - -XXX: untested! -""" -__author__ = "Christian Heimes" -__version__ = "$Id$" -__revision__ = "$Revision$" - -import os -from moul.log import LOG -LOG.warning('Linux support is not tested') - -MOUL_DIR = "Uru Live" -INI_FILE = ('pyMoul', 'pymoul.ini') -EXEC_NAME = "UruLauncher" -HOME = os.environ('HOME') - -def getMoulUserDataDir(): - """Get path of MOUL data directory - - The MOUL data directory contains log files, chatlogs, KI images and many - more things. - """ - moul_data = os.path.join(HOME, MOUL_DIR) - -def getPyMoulIniLocation(): - """Get path to the pyMoul ini file - """ - ini_file = os.path.join(HOME, *INI_FILE) - return ini_file - -def _startMOUL(installdir, *args): - """Start MOUL - """ - # P_DETACH is similar to P_NOWAIT, but the new process is detached from - # the console of the calling process. - mode = os.P_DETACH - path = os.path.join(installdir, EXEC_NAME) - args = (EXEC_NAME,) + args - return os.spawnv(mode, path, args) Modified: pymoul/trunk/src/moul/file/kiimage.py =================================================================== --- pymoul/trunk/src/moul/file/kiimage.py 2007-01-20 15:28:50 UTC (rev 52) +++ pymoul/trunk/src/moul/file/kiimage.py 2007-01-20 16:32:00 UTC (rev 53) @@ -23,27 +23,37 @@ import os import tempfile +import struct JPEG_HEADER = "\377\330\377" -class KIImage(object): +class KiImage(object): + """Ki image handler - def __init__(self, filename): - assert os.path.isfile(filename) - self._filename = filename - self._fd = None - self.open() + MOUL's KI images have four leading bytes of junk that encode the file + size. The class allowes to add, remove and verify the header. + """ + + def __init__(self, fd_name): + if isinstance(fd_name, basestring): + name = fd_name + fd = open(fd_name, 'rb') + else: + name = getattr(fd_name, 'name', '<UNKNOWN>') + fd = fd_name + + self._filename = name + self._fd = fd + self._size = None - def open(self): - if not self._fd: - self._fd = open(filename, 'rb') - def close(self): if self._fd: self._fd.close() self._fd = None def getSize(self): + if self._size is not None: + return self._size fd = self._fd opos = fd.tell() size = 0 @@ -52,9 +62,11 @@ size = fd.tell() finally: fd.seek(opos) + self._size = size return size def moulHeaderToSize(self, header=None): + # XXX use struct if header is None: fd = self._fd fd.seek(0) @@ -65,8 +77,9 @@ return size def sizeToMoulHeader(self, size=None): + # XXX use struct if size is None: - size = self.getSize() + 4 + size = self.getSize() + 4 # XXX +4 ? leading = 4* [None] for i in (3,2,1,0): l = size >> 8*i @@ -77,7 +90,7 @@ def verifyMoulHeader(self, header=None): header_size = self.moulHeaderToSize(header) file_size = self.getSize() - if header_size == file_size: + if (header_size + 4) == file_size: return True return False @@ -100,7 +113,7 @@ def removeMoulHeader(self): if not self.isMoulImage(): - raise Exception + raise ValueError('Image has no MOUL header') out = tempfile.TemporaryFile() fd = self._fd fd.seek(4) @@ -108,8 +121,10 @@ return out def addMoulHeader(self): + if self.isMoulImage(): + raise ValueError('Image has already a MOUL header') if not self.isJpeg(): - raise Exception + raise ValueError('File is not a JPEG') out = tempfile.TemporaryFile() header = self.sizeToMoulHeader() fd = self._fd Added: pymoul/trunk/src/moul/file/tests/avatar_clean.jpg =================================================================== (Binary files differ) Property changes on: pymoul/trunk/src/moul/file/tests/avatar_clean.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: pymoul/trunk/src/moul/file/tests/test_kiimage.py =================================================================== --- pymoul/trunk/src/moul/file/tests/test_kiimage.py 2007-01-20 15:28:50 UTC (rev 52) +++ pymoul/trunk/src/moul/file/tests/test_kiimage.py 2007-01-20 16:32:00 UTC (rev 53) @@ -21,13 +21,49 @@ __version__ = "$Id$" __revision__ = "$Revision$" +import os +from StringIO import StringIO import unittest from doctest import DocTestSuite -import moul.file.kiimage +from moul.file.kiimage import KiImage +base = os.path.dirname(__file__) +kiimg = os.path.join(base, 'avatar.jpg') +kiclean = os.path.join(base, 'avatar_clean.jpg') + +class KiImageTest(unittest.TestCase): + + def setUp(self): + self._ki = open(kiimg, 'rb') + self._clean = open(kiclean, 'rb') + + def tearDown(self): + self._ki.close() + self._clean.close() + + def test_openname(self): + k = KiImage(kiimg) + self.failUnless(k.isMoulImage()) + self.failIf(k.isJpeg()) + + k = KiImage(kiclean) + self.failIf(k.isMoulImage()) + self.failUnless(k.isJpeg()) + + def test_openfd(self): + k = KiImage(self._ki) + self.failUnless(k.isMoulImage()) + self.failIf(k.isJpeg()) + + k = KiImage(self._clean) + self.failIf(k.isMoulImage()) + self.failUnless(k.isJpeg()) + + def test_suite(): return unittest.TestSuite(( + unittest.makeSuite(KiImageTest), DocTestSuite('moul.file.kiimage') )) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-20 15:28:53
|
Revision: 52 http://pymoul.svn.sourceforge.net/pymoul/?rev=52&view=rev Author: tiran Date: 2007-01-20 07:28:50 -0800 (Sat, 20 Jan 2007) Log Message: ----------- Updated installation information for Windows and Unix Modified Paths: -------------- pymoul/trunk/INSTALL.txt Removed Paths: ------------- pymoul/trunk/README.qt.txt Modified: pymoul/trunk/INSTALL.txt =================================================================== --- pymoul/trunk/INSTALL.txt 2007-01-19 16:32:53 UTC (rev 51) +++ pymoul/trunk/INSTALL.txt 2007-01-20 15:28:50 UTC (rev 52) @@ -1,30 +1,171 @@ +============ Requirements ============ - * Python 2.5.x + * Python 2.5.x http://www.python.org/ + * easy_install http://peak.telecommunity.com/DevCenter/EasyInstall + * setuptools (via easy install) + * PyTz (via $ easy_install pytz) + * Qt4 GPL 4.2+ http://www.trolltech.com/developer/downloads/qt/ + * PyQt4 4.1.1+ http://www.riverbankcomputing.co.uk/pyqt/ - Also read README.qt.txt - Windows ------- * pywin32 http://sourceforge.net/projects/pywin32/ + * py2exe http://www.py2exe.org/ + * MinGW32 compiler (bundled with Qt4) -Development ------------ - - * py2exe http://www.py2exe.org/ (Windows only) - - Tools ----- * UPX http://upx.sourceforge.net/#download - * Nullsoft Installer http://nsis.sourceforge.net/ +==================== +Windows Installation +==================== + +Installation +------------ + + * Download Qt/Windows Open Source Edition from + http://www.trolltech.com/developer/downloads/qt/index + + * Download PyQt4 GPL from http://www.riverbankcomputing.co.uk/pyqt/ + If you want to use eric4 as editor install sip and PyQt4 from sources! + + * Install Qt4 + MinGW. I suggest installing both to C:\Program Files instead + of C:\ (C:\Programme or whatever your program files folder is) + + * Install PyQt4 + +http://www.riverbankcomputing.com/Downloads/PyQt4/GPL/ +http://wftp.tu-chemnitz.de/pub/Qt/qt/source/qt-win-opensource-4.2.2-mingw.exe + +Adjust your environment for Qt/PyQt +----------------------------------- + +You have to create / adjust some environment variables in order to make +Qt and PyQt work well. I had to create the variables manually. The article at +http://vlaurie.com/computers2/Articles/environment.htm#editing explains how +to set user specific env vars. + +PATH = %PATH%;%ProgramFiles%\Python25;%ProgramFiles%\Python25\Scripts;%ProgramFiles%\Qt\4.2.2\bin;%ProgramFile +s%\MinGW\bin +PATHEXT = %PATHEXT%;.PY;.PYW +QMAKESPEC = win32-g++ +QT4DIR = %ProgramFiles%\Qt\4.2.2 + +You may also set PYTHONPATH to the root of pyMoul/src: +PYTHONPATH = %PYTHONPATH%;%USERPROFILE%\My Documents\dev\pymoul\src + +Source installation of sip, PyQt4 and QScintilla2 +------------------------------------------------- + + * Install Qt4 GPL + MinGW32 as described + + * Adust the environment variables as described + + * Download the following packages and unzip them to C:\tmp\ or another + folder without (!) spaces or special character. + + o sip 4.5+ http://www.riverbankcomputing.co.uk/sip/index.php + o QScintilla2 snapshot http://www.riverbankcomputing.com/Downloads/Snapshots/QScintilla2/ + o PyQt4-win-gpl-4.X (not binary) http://www.riverbankcomputing.co.uk/pyqt/download.php + + * Compile and install sip with: + + o c:\tmp\sip...>python configure.py -p win32-g++ + o c:\tmp\sip...>mingw32-make + o c:\tmp\sip...>mingw32-make install + + * Compile and install QScintilla2 for Qt4 + + o c:\tmp\QScintilla2...\Qt4>qmake qscintilla.pro + o c:\tmp\QScintilla2...\Qt4>mingw32-make + o c:\tmp\QScintilla2...\Qt4>mingw32-make install + + * Compile and install PyQt4 + + o c:\tmp\PyQt4...>python configure.py + o c:\tmp\PyQt4...\Qt4>mingw32-make + o c:\tmp\PyQt4...\Qt4>mingw32-make install + + * Install QScintilla2 for Python + + o c:\tmp\QScintilla2...\Python>python configure.py + o c:\tmp\QScintilla2...\Python>mingw32-make + o c:\tmp\QScintilla2...\Python>mingw32-make install + + py2exe error -============ +------------ If you are getting an AttributeError on zlib_file.read() replace py2exe's build_exe.py with misc/build_exe.py. The file is located somewhere in Python25\Lib\site-packages\py2exe\ + +================== +Linux Installation +================== + +For Ubuntu and Debian. SuSE, RedHat and Mac OS X should work similar + +NOTE: The latest version of Ubuntu has no support for Qt4 under Python2.5. + You have to compile the stuff on your own. + + * Install Python 2.5 with development packages + + o sudo apt-get install python2.5 python2.5-dev + + * Install Qt4 with development packages + + o sudo apt-get install libqt4 libqt4-dev qt4-designer qt4-dev-tools qt4-doc + + * Download and unpack sip, PyQt4 and QScintilla2 snapshot + + o sip 4.5+ http://www.riverbankcomputing.co.uk/sip/index.php + o QScintilla2 snapshot http://www.riverbankcomputing.com/Downloads/Snapshots/QScintilla2/ + o PyQt4-x11-gpl-4.X http://www.riverbankcomputing.co.uk/pyqt/download.php + + * compile and install sip + + o $ cd sip-XXX + o $ python2.5 configure.py && make + o $ sudo make install + + * The current make install command is buggy. You have to adjust the + permissions of all installed files manually. I recommand to run the + following command line after each install step. a+rX means all users + readable, all users directory executable + + o sudo chmod a+rx /usr/bin/sip + o sudo chmod -R a+rX /usr/lib/python2.5/ /usr/include/python2.5 \ + /usr/include/qt4 /usr/share/qt4/ /usr/share/sip/ + + * Install QScintilla for Qt4 + + o $ cd QScintilla.../Qt4 + o $ qmake-qt4 + o $ make + o $ sudo make install + o Adjust permissions + + * Install PyQt4 + + o $ cd PyQt4-x11-gpl... + o $ python2.5 configure.py -q /usr/bin/qmake-qt4 + o $ make + o $ sudo make install + o Adjust permissions + + * Install QScintilla2 for Python + + o $ cd QScintilla.../Python + o $ python2.5 configure.py + o $ make + o $ make install + o Adjust permissions + + + Deleted: pymoul/trunk/README.qt.txt =================================================================== --- pymoul/trunk/README.qt.txt 2007-01-19 16:32:53 UTC (rev 51) +++ pymoul/trunk/README.qt.txt 2007-01-20 15:28:50 UTC (rev 52) @@ -1,35 +0,0 @@ -Installation ------------- - - * Download Qt/Windows Open Source Edition from - http://www.trolltech.com/developer/downloads/qt/index - * Download PyQT4 GPL from http://www.riverbankcomputing.co.uk/pyqt/ - * Install QT4 + MinGW. I suggest installing both to C:\Program Files instead - of C:\ (C:\Programme or whatever your program files folder is) - * Install PyQT4 - * Download and install elementtree http://effbot.org/downloads/#elementtree - or use the "easy_install elementtree" command -http://www.riverbankcomputing.com/Downloads/PyQt4/GPL/PyQt-gpl-4.1.1-Py2.5-Qt4.2.2.exe -http://wftp.tu-chemnitz.de/pub/Qt/qt/source/qt-win-opensource-4.2.2-mingw.exe - -Adjust your environment for Qt/PyQt ------------------------------------ - -You have to create / adjust some environment variables in order to make -Qt and PyQt work well. I had to create the variables manually. The article at -http://vlaurie.com/computers2/Articles/environment.htm#editing explains how -to set user specific env vars. - -PATH = %PATH%;%ProgramFiles%\Python25;%ProgramFiles%\Python25\Scripts;%ProgramFiles%\Qt\4.2.2\bin;%ProgramFiles%\MinGW\bin -PATHEXT = %PATHEXT%;.PY;.PYW -QMAKESPEC = win32-g++ -QTDIR = %ProgramFiles%\Qt\4.2.2 - -You may also set PYTHONPATH to the root of pyMoul/src: -PYTHONPATH = %PYTHONPATH%;%USERPROFILE%\My Documents\dev\pymoul\src - -Notes (do not install) ----------------------- - -http://effbot.org/downloads/#cElementTree -python setup.py build -c mingw32 install \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-19 15:54:30
|
Revision: 50 http://pymoul.svn.sourceforge.net/pymoul/?rev=50&view=rev Author: tiran Date: 2007-01-19 07:54:25 -0800 (Fri, 19 Jan 2007) Log Message: ----------- Added constrains to INI parser Modified Paths: -------------- pymoul/trunk/src/moul/file/wdysini.py Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-01-19 13:36:38 UTC (rev 49) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-01-19 15:54:25 UTC (rev 50) @@ -24,6 +24,12 @@ from moul.crypt.whatdoyousee import decryptWDYS from moul.crypt.whatdoyousee import encryptWDYS +class BoolStringError(ValueError): + pass + +class ConstrainError(ValueError): + pass + class BoolString(object): """Boolean string @@ -54,7 +60,7 @@ >>> BoolString('OK') Traceback (most recent call last): ... - ValueError: OK + BoolStringError: 'OK' <type 'str'> >>> BoolString(False) == False True @@ -62,17 +68,36 @@ True >>> BoolString(False) == True False + + >>> BoolString(True) == 'true' + True + >>> BoolString(True) == 'false' + False + >>> BoolString(False) == 'false' + True """ + __slots__ = ('_true',) def __init__(self, value=False): - if isinstance(value, basestring): + self._true = self._val2bool(value) + + @classmethod + def _val2bool(cls, value): + result = None + if isinstance(value, cls): + result = value._true + elif isinstance(value, basestring): if value.lower() in ('yes', 'true', '1'): - value = True + result = True elif value.lower() in ('no', 'false', '0'): - value = False - else: - raise ValueError(value) - self._true = bool(value) + result = False + elif isinstance(value, int): # int and bool + result = bool(value) + + if result is None: + raise BoolStringError("%s %s" % (repr(value), type(value))) + else: + return result def __nonzero__(self): return self._true @@ -90,8 +115,13 @@ return str(self) def __eq__(self, other): - return self._true == bool(other) + other = self._val2bool(other) + return self._true == other + def __cmp__(self, other): + other = self._val2bool(other) + return cmp(self._true, other) + class FloatString(float): """Float with a slightly different representation @@ -114,21 +144,150 @@ def __repr__(self): return str(self) -VIDEO_MODES = ( +class Constrain(object): + """Constrain for configuration values + + Constrain() is a NOOP + >>> c = Constrain('foo', False, object) + >>> c('dummy') + 'dummy' + """ + __slots__ = () + def __init__(self, *args, **kwargs): + pass + + def __call__(self, value): + return value + +class MinMax(Constrain): + """Min / max constrain + + >>> c = MinMax(1, 10) + >>> c(1) + 1 + >>> c(10) + 10 + >>> c(11) + Traceback (most recent call last): + ... + ConstrainError: 11 > max 10 + >>> c(-1) + Traceback (most recent call last): + ... + ConstrainError: -1 < min 1 + + >>> c = MinMax(0, 1) + >>> c(0.5) + 0.5 + """ + __slots__ = ('_min', '_max') + def __init__(self, min, max): + self._min = min + self._max = max + + def __call__(self, value): + if not isinstance(value, (int, float)): + raise ConstrainError(type(value)) + if value < self._min: + raise ConstrainError("%s < min %s" % (value, self._min)) + if value > self._max: + raise ConstrainError("%s > max %s" % (value, self._max)) + return value + +class VideoConstrain(MinMax): + """Constrain for video mode indexes + + >>> v = VideoConstrain() + >>> v(0) + 0 + >>> v(-1) + Traceback (most recent call last): + ... + ConstrainError: -1 < min 0 + >>> v(11) + Traceback (most recent call last): + ... + ConstrainError: 11 > max 10 + """ + def __init__(self): + self._min = 0 + self._max = len(videoModes) -1 + +class Contains(Constrain): + """value in list constrain + + >>> c = Contains((1, 2, 3)) + >>> c(1) + 1 + >>> c(4) + Traceback (most recent call last): + ... + ConstrainError: 4 not in (1, 2, 3) + """ + __slots__ = ('_values') + def __init__(self, values): + self._values = values + + def __call__(self, value): + if not value in self._values: + raise ConstrainError("%s not in %s" % (value, str(self._values))) + return value + +class _VideoModes(object): + """Video mode informations + """ # width, height, w ratio, h ratio - (800, 600, 4, 3), - (1024, 768, 4, 3), - (1152, 864, 4, 3), - (1280, 720, 16, 9), - (1280, 768, 5, 3), - (1280, 800, 16, 10), - (1280, 960, 4, 3), - (1280, 1024, 5, 4), - (1600, 900, 16, 9), - (1600, 1200, 4, 3), - (1920, 1200, 16, 10), - ) + _videomodes = ( + (800, 600, 4, 3), + (1024, 768, 4, 3), + (1152, 864, 4, 3), + (1280, 720, 16, 9), + (1280, 768, 5, 3), + (1280, 800, 16, 10), + (1280, 960, 4, 3), + (1280, 1024, 5, 4), + (1600, 900, 16, 9), + (1600, 1200, 4, 3), + (1920, 1200, 16, 10), + ) + # (w, h) -> idx + _reverse_vm = dict([((d[0], d[1]), i) for i, d in enumerate(_videomodes)]) + + def __len__(self): + return len(self._videomodes) + def getVidModeByIdx(self, idx): + """Get video mode by index + + >>> videoModes.getVidModeByIdx(0) + (800, 600, 4, 3) + """ + return self._videomodes[idx] + + def getVidModeHuman(self, idx): + """Human readable vidoe mode by index + + >>> videoModes.getVidModeHuman(0) + '800x600 (4:3)' + """ + return "%ix%i (%i:%i)" % self.getVidModeByIdx(idx) + + def getVidIdxByMode(self, w, h): + """Reverse lookup + + >>> videoModes.getVidIdxByMode(800, 600) + 0 + """ + return self._reverse_vm[(w, h)] + + def widths(self): + return [w for w, h, wr, hr in self._videomodes] + + def heights(self): + return [h for w, h, wr, hr in self._videomodes] + +videoModes = _VideoModes() + class ConfFile(object): _options = {} @@ -162,7 +321,8 @@ if not line.strip(): continue found = False - for key, convert in self._options.items(): + for key, value in self._options.items(): + convert, constrain = value # not elegant but safe if line.startswith(key): found = True @@ -170,8 +330,9 @@ #newkey = newkey.replace('.', '_') newkey = key self._order.append(newkey) - data = line[len(key)+1:].strip() - self._filedata[newkey] = convert(data) + value = line[len(key)+1:].strip() + value = constrain(convert(value)) + self._filedata[newkey] = value break if not found: raise ValueError(line) @@ -195,7 +356,8 @@ key = newkey #key = newkey.replace('__', ' ') #key = key.replace('_', '.') - assert key in self._options + convert, constrain = self._options[key] + value = constrain(convert(value)) out.append("%s %s" % (key, value)) out.append('') # new line at EOF return '\n'.join(out) @@ -212,70 +374,33 @@ class AudioIni(ConfFile): _options = { - 'Audio.Initialize' : BoolString, - 'Audio.UseEAX' : BoolString, - 'Audio.SetPriorityCutoff' : int, - 'Audio.MuteAll' : int, - 'Audio.SetChannelVolume SoundFX' : FloatString, - 'Audio.SetChannelVolume BgndMusic' : FloatString, - 'Audio.SetChannelVolume Ambience' : FloatString, - 'Audio.SetChannelVolume NPCVoice' : FloatString, - 'Audio.EnableVoiceRecording' : int, - 'Audio.SetDeviceName' : str, - 'Audio.SetChannelVolume GUI' : FloatString, + 'Audio.Initialize' : (BoolString, Constrain()), + 'Audio.UseEAX' : (BoolString, Constrain()), + 'Audio.SetPriorityCutoff' : (int, Constrain()), + 'Audio.MuteAll' : (int, MinMax(0, 1)), + 'Audio.SetChannelVolume SoundFX' : (FloatString, MinMax(0.0, 1.0)), + 'Audio.SetChannelVolume BgndMusic' : (FloatString, MinMax(0.0, 1.0)), + 'Audio.SetChannelVolume Ambience' : (FloatString, MinMax(0.0, 1.0)), + 'Audio.SetChannelVolume NPCVoice' : (FloatString, MinMax(0.0, 1.0)), + 'Audio.EnableVoiceRecording' : (int, MinMax(0, 1)), + 'Audio.SetDeviceName' : (str, Constrain()), + 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), } -class _VideoModes(object): - """Video mode informations - """ - # width, height, w ratio, h ratio - _videomodes = VIDEO_MODES - # (w, h) -> idx - _reverse_vm = dict([((d[0], d[1]), i) for i, d in enumerate(VIDEO_MODES)]) - - def __len__(self): - return len(self._videomodes) - - def getVidModeByIdx(self, idx): - """Get video mode by index - - >>> videoModes.getVidModeByIdx(0) - (800, 600, 4, 3) - """ - return self._videomodes[idx] - - def getVidModeHuman(self, idx): - """Human readable vidoe mode by index - - >>> videoModes.getVidModeHuman(0) - '800x600 (4:3)' - """ - return "%ix%i (%i:%i)" % self.getVidModeByIdx(idx) - - def getVidIdxByMode(self, w, h): - """Reverse lookup - - >>> videoModes.getVidIdxByMode(800, 600) - 0 - """ - return self._reverse_vm[(w, h)] - -videoModes = _VideoModes() - class GraphicsIni(ConfFile): _options = { - 'Graphics.Width' : int, - 'Graphics.Height' : int, - 'Graphics.ColorDepth' : int, # no ui - 'Graphics.Windowed' : BoolString, - 'Graphics.AntiAliasAmount' : int, - 'Graphics.AnisotropicLevel' : int, - 'Graphics.TextureQuality' : int, - 'Quality.Level' : int, - 'Graphics.Shadow.Enable' : int, - 'Graphics.EnablePlanarReflections' : int, # no ui - 'Graphics.EnableVSync' : BoolString, - 'Graphics.Shadow.VisibleDistance' : FloatString, + 'Graphics.Width' : (int, Contains(videoModes.widths())), + 'Graphics.Height' : (int, Contains(videoModes.heights())), + 'Graphics.ColorDepth' : (int, Constrain()), # no ui + 'Graphics.Windowed' : (BoolString, Constrain()), + 'Graphics.AntiAliasAmount' : (int, MinMax(1,4)), + 'Graphics.AnisotropicLevel' : (int, MinMax(1,5)), + 'Graphics.TextureQuality' : (int, MinMax(1,3)), + 'Quality.Level' : (int, MinMax(1,4)), + 'Graphics.Shadow.Enable' : (int, MinMax(0, 1)), + 'Graphics.EnablePlanarReflections' : (int, MinMax(0, 1)), # no ui + 'Graphics.EnableVSync' : (BoolString, Constrain()), + 'Graphics.Shadow.VisibleDistance' : (FloatString, MinMax(0.0, 1.0)), } def _getScreenRes(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-18 20:25:26
|
Revision: 48 http://pymoul.svn.sourceforge.net/pymoul/?rev=48&view=rev Author: tiran Date: 2007-01-18 12:25:26 -0800 (Thu, 18 Jan 2007) Log Message: ----------- Major work on graphics ini parsing Modified Paths: -------------- pymoul/trunk/src/moul/crypt/whatdoyousee.py pymoul/trunk/src/moul/file/tests/test_wdysini.py pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Modified: pymoul/trunk/src/moul/crypt/whatdoyousee.py =================================================================== --- pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-01-18 17:03:38 UTC (rev 47) +++ pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-01-18 20:25:26 UTC (rev 48) @@ -76,7 +76,7 @@ """ # XXX: dos format instr = instr.replace("\n", "\r\n") - fin.seek(0) + fout.seek(0) fout.write(HEADER) flen = len(instr) Modified: pymoul/trunk/src/moul/file/tests/test_wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/tests/test_wdysini.py 2007-01-18 17:03:38 UTC (rev 47) +++ pymoul/trunk/src/moul/file/tests/test_wdysini.py 2007-01-18 20:25:26 UTC (rev 48) @@ -22,9 +22,12 @@ __revision__ = "$Revision$" import os +import string +from StringIO import StringIO import unittest from doctest import DocTestSuite +from moul.crypt.whatdoyousee import decryptWDYS from moul.file.wdysini import AudioIni from moul.file.wdysini import GraphicsIni @@ -47,6 +50,12 @@ def tearDown(self): self.enc_fd.close() self.dec_fd.close() + + def _compareLines(self, first, second): + flines = first.split('\n') + slines = second.split('\n') + for i, fline in enumerate(flines): + self.failUnlessEqual(fline, slines[i]) def test_parseString(self): p = self.parser @@ -55,11 +64,33 @@ self.failUnless(p._filedata) self.failIf(p.isChanged()) newdata = p.writeString() - olines = data.split('\n') - nlines = newdata.split('\n') - for i, oline in enumerate(olines): - self.failUnlessEqual(oline, nlines[i]) - + self._compareLines(data, newdata) + + def test_chars(self): + valid = string.ascii_letters + '_. ' + data = self.dec_fd.read() + self.parser.parseString(data) + for key in self.parser._filedata: + for s in key: + self.failUnless(s in valid, s) + + def test_cryptparse(self): + p = self.parser + data = self.dec_fd.read() + p.parseEncFile(self.enc) + newdata = p.writeString() + self._compareLines(data, newdata) + fdout = StringIO() + p.writeEncFile(fdout) + + # round trip + fdout.seek(0) + encdata = decryptWDYS(fdout) + p.parseString(encdata) + newdata = p.writeString() + self._compareLines(data, newdata) + + class AudioIniTest(GenericIniTest): enc = aud_enc dec = aud_dec @@ -69,7 +100,45 @@ enc = gra_enc dec = gra_dec parserClass = GraphicsIni + + def test_properties(self): + p = self.parser + eq = self.failUnlessEqual + + p.parseEncFile(self.enc) + eq(p.screenres, 1) + eq(p.windowed, True) + eq(p.antialias, 2) + eq(p.anisotropic, 2) + eq(p.texture, 2) + eq(p.quality, 2) + eq(p.shadow_enabled, 1) + eq(p.vsync, False) + def test_property_edit(self): + p = self.parser + eq = self.failUnlessEqual + + p.parseEncFile(self.enc) + self.failIf(p.isChanged()) + + p.vsync = True + eq(p._get('Graphics.EnableVSync'), True) + self.failUnless(p.isChanged()) + p.vsync = False + eq(p._get('Graphics.EnableVSync'), False) + #XXX self.failIf(p.isChanged()) + + p.screenres = 0 + eq(p._get('Graphics.Width'), 800) + eq(p._get('Graphics.Height'), 600) + + p.screenres = 10 + eq(p._get('Graphics.Width'), 1920) + eq(p._get('Graphics.Height'), 1200) + self.failUnless(p.isChanged()) + + def test_suite(): return unittest.TestSuite(( unittest.makeSuite(AudioIniTest), Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-01-18 17:03:38 UTC (rev 47) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-01-18 20:25:26 UTC (rev 48) @@ -55,6 +55,13 @@ Traceback (most recent call last): ... ValueError: OK + + >>> BoolString(False) == False + True + >>> BoolString(True) == True + True + >>> BoolString(False) == True + False """ def __init__(self, value=False): @@ -82,8 +89,8 @@ def __repr__(self): return str(self) - def __cmp__(self, other): - return cmp(bool(self), bool(other)) + def __eq__(self, other): + return self._true == bool(other) class FloatString(float): """Float with a slightly different representation @@ -126,15 +133,30 @@ _options = {} def __init__(self): + self.clear() + + def clear(self): self._filedata = {} self._newdata = {} - self._order = [] - + self._order = [] + + def parseEncFile(self, fd_name): + """Read and parse file (fd or file name) + """ + self.clear() + if isinstance(fd_name, basestring): + fd = open(fd_name, 'rb') + else: + fd = fd_name + data = decryptWDYS(fd) + return self.parseString(data) + def parseString(self, s): """Parse string with file contents @param s newline seperated file (string) """ + self.clear() lines = s.split('\n') for line in lines: if not line.strip(): @@ -144,7 +166,9 @@ # not elegant but safe if line.startswith(key): found = True - newkey = key.replace(' ', '_') + #newkey = key.replace(' ', '__') + #newkey = newkey.replace('.', '_') + newkey = key self._order.append(newkey) data = line[len(key)+1:].strip() self._filedata[newkey] = convert(data) @@ -168,12 +192,24 @@ out = [] for newkey in self._order: value = self._newdata[newkey] - key = newkey.replace('_', ' ') + key = newkey + #key = newkey.replace('__', ' ') + #key = key.replace('_', '.') assert key in self._options out.append("%s %s" % (key, value)) out.append('') # new line at EOF return '\n'.join(out) - + + def writeEncFile(self, fd_name): + """Write file (fd or file name) + """ + if isinstance(fd_name, basestring): + fd = open(fd_name, 'wb') + else: + fd = fd_name + data = self.writeString() + return encryptWDYS(data, fd) + class AudioIni(ConfFile): _options = { 'Audio.Initialize' : BoolString, @@ -189,37 +225,99 @@ 'Audio.SetChannelVolume GUI' : FloatString, } +class _VideoModes(object): + """Video mode informations + """ + # width, height, w ratio, h ratio + _videomodes = VIDEO_MODES + # (w, h) -> idx + _reverse_vm = dict([((d[0], d[1]), i) for i, d in enumerate(VIDEO_MODES)]) + + def __len__(self): + return len(self._videomodes) + + def getVidModeByIdx(self, idx): + """Get video mode by index + + >>> videoModes.getVidModeByIdx(0) + (800, 600, 4, 3) + """ + return self._videomodes[idx] + + def getVidModeHuman(self, idx): + """Human readable vidoe mode by index + + >>> videoModes.getVidModeHuman(0) + '800x600 (4:3)' + """ + return "%ix%i (%i:%i)" % self.getVidModeByIdx(idx) + + def getVidIdxByMode(self, w, h): + """Reverse lookup + + >>> videoModes.getVidIdxByMode(800, 600) + 0 + """ + return self._reverse_vm[(w, h)] + +videoModes = _VideoModes() + class GraphicsIni(ConfFile): _options = { 'Graphics.Width' : int, 'Graphics.Height' : int, - 'Graphics.ColorDepth' : int, + 'Graphics.ColorDepth' : int, # no ui 'Graphics.Windowed' : BoolString, 'Graphics.AntiAliasAmount' : int, 'Graphics.AnisotropicLevel' : int, 'Graphics.TextureQuality' : int, 'Quality.Level' : int, 'Graphics.Shadow.Enable' : int, - 'Graphics.EnablePlanarReflections' : int, + 'Graphics.EnablePlanarReflections' : int, # no ui 'Graphics.EnableVSync' : BoolString, 'Graphics.Shadow.VisibleDistance' : FloatString, } - # width, height, w ratio, h ratio - _videomodes = VIDEO_MODES + def _getScreenRes(self): + w = self._newdata['Graphics.Width'] + h = self._newdata['Graphics.Height'] + return videoModes.getVidIdxByMode(w, h) - def getVidModeByIdx(self, idx): - """Get video mode by index - """ - return self._videomodes[idx] + def _setScreenRes(self, idx): + w, h, wf, hf = videoModes.getVidModeByIdx(idx) + self._newdata['Graphics.Width'] = w + self._newdata['Graphics.Height'] = h - def getVidModeHuman(self, idx): - """Human readable vidoe mode by index - """ - return "%ix%i (%i:%i)" % self.getVidModeByIdx(idx) - - def getVidIdxByMode(self, w, h): - for idx, mode in enumerate(self._videomodes): - if mode[0] == w and mode[1] == h: - return idx - raise KeyError("Video mode for %ix%i not found" % (w, h)) + def _get(self, name): + return self._newdata[name] + + def _set(self, name, value): + self._newdata[name] = value + + screenres = property(_getScreenRes, _setScreenRes, doc="Screen resolution by index") + windowed = property(lambda self: self._get('Graphics.Windowed'), + lambda self, v: self._set('Graphics.Windowed', v), + ) + antialias = property(lambda self: self._get('Graphics.AntiAliasAmount'), + lambda self, v: self._set('Graphics.AntiAliasAmount', v), + ) + anisotropic = property(lambda self: self._get('Graphics.AnisotropicLevel'), + lambda self, v: self._set('Graphics.AnisotropicLevel', v), + ) + texture = property(lambda self: self._get('Graphics.TextureQuality'), + lambda self, v: self._set('Graphics.TextureQuality', v), + ) + quality = property(lambda self: self._get('Quality.Level'), + lambda self, v: self._set('Quality.Level', v), + ) + shadow_enabled = property(lambda self: self._get('Graphics.Shadow.Enable'), + lambda self, v: self._set('Graphics.Shadow.Enable', v), + ) + # XXX: shadows + #shadow = property(lambda self: self._get('Graphics.Shadow.VisibleDistance'), + # lambda self, v: self._set('Graphics.Shadow.VisibleDistance', v), + # ) + vsync = property(lambda self: self._get('Graphics.EnableVSync'), + lambda self, v: self._set('Graphics.EnableVSync', v), + ) + Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-18 17:03:38 UTC (rev 47) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-18 20:25:26 UTC (rev 48) @@ -33,7 +33,9 @@ from moul.qt.ui.mainwindow import Ui_MainWindow from moul.time.cavern import CavernTime +from moul.file.wdysini import AudioIni from moul.file.wdysini import GraphicsIni +from moul.file.wdysini import videoModes from moul.server.ping import ServerList from moul.server.ping import isSocketError from moul.log import getLogger @@ -96,22 +98,24 @@ def _graphics_init(self): """init graphics tab """ - self._graphicsini = GraphicsIni() - length = len(self._graphicsini._videomodes) - 1 + length = len(videoModes) - 1 self.slid_screenres.setMaximum(length) - #self.connect(self.slid_screenres, SIGNAL("valueChanged(int)"), - # self.on_slid_screenres_changed) - self.connect(self.slid_screenres, SIGNAL("sliderMoved(int)"), + self.connect(self.slid_screenres, SIGNAL("valueChanged(int)"), self.on_slid_screenres_changed) + def on_graphicsini_loaded(self, gini): + """SIGNAL: graphicsIniLoaded(file) + """ + self.slid_screenres.setValue(gini.screenres) + @signalLogDecorator(LOG) @pyqtSignature("int") def on_slid_screenres_changed(self, idx): """SIGNAL: valueChanged (int) """ - txt = self._graphicsini.getVidModeHuman(idx) + txt = videoModes.getVidModeHuman(idx) self.lb_screenres.setText(QtCore.QString(txt)) - + # ************************************************************************ # time zones Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-18 17:03:38 UTC (rev 47) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-18 20:25:26 UTC (rev 48) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Thu Jan 18 16:28:04 2007 +# Created: Thu Jan 18 19:42:55 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -65,12 +65,6 @@ self.pushButton.setObjectName("pushButton") self.hboxlayout.addWidget(self.pushButton) - self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) - self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) - self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) - self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") - self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(5,100,450,375)) self.tabWidget.setTabPosition(QtGui.QTabWidget.North) @@ -667,6 +661,12 @@ self.label_6.setAlignment(QtCore.Qt.AlignCenter) self.label_6.setObjectName("label_6") self.tabWidget.addTab(self.tab_4,"") + + self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) + self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) + self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) + self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-18 17:03:38 UTC (rev 47) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-18 20:25:26 UTC (rev 48) @@ -100,22 +100,6 @@ </item> </layout> </widget> - <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > - <property name="geometry" > - <rect> - <x>10</x> - <y>480</y> - <width>441</width> - <height>32</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons" > - <set>QDialogButtonBox::Close|QDialogButtonBox::NoButton|QDialogButtonBox::Reset|QDialogButtonBox::Save</set> - </property> - </widget> <widget class="QTabWidget" name="tabWidget" > <property name="geometry" > <rect> @@ -1408,6 +1392,22 @@ </widget> </widget> </widget> + <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > + <property name="geometry" > + <rect> + <x>10</x> + <y>480</y> + <width>441</width> + <height>32</height> + </rect> + </property> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons" > + <set>QDialogButtonBox::Close|QDialogButtonBox::NoButton|QDialogButtonBox::Reset|QDialogButtonBox::Save</set> + </property> + </widget> </widget> <widget class="QStatusBar" name="statusbar" /> </widget> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-18 17:03:39
|
Revision: 46 http://pymoul.svn.sourceforge.net/pymoul/?rev=46&view=rev Author: tiran Date: 2007-01-18 09:03:10 -0800 (Thu, 18 Jan 2007) Log Message: ----------- Added some platform code to moul.config Stub for DX enumerate sound devices (disabled) Disabled ping tests Logging enhancements Modified Paths: -------------- pymoul/trunk/src/moul/config/__init__.py pymoul/trunk/src/moul/config/win32.py pymoul/trunk/src/moul/log.py pymoul/trunk/src/moul/server/tests/test_ping.py Modified: pymoul/trunk/src/moul/config/__init__.py =================================================================== --- pymoul/trunk/src/moul/config/__init__.py 2007-01-18 17:01:49 UTC (rev 45) +++ pymoul/trunk/src/moul/config/__init__.py 2007-01-18 17:03:10 UTC (rev 46) @@ -21,24 +21,33 @@ import os import sys +from moul.log import getLogger +# a program under py2exe is sys.frozen +__FROZEN__ = bool(getattr(sys, 'frozen', False)) +# OS stuff +__WIN32__ = sys.platform.startswith('win32') # win64, cygwin? +__LINUX__ = sys.platform.startswith('linux2') +__MACOSX__ = sys.platform.startswith('darwin') +__UNIX__ = __LINUX__ or __MACOSX__ + _marker=object() # XXX: what about cygwin, bsd and others? -if sys.platform.startswith('win32'): +if __WIN32__: from moul.config.win32 import ( getMoulUserDataDir, getPyMoulIniLocation, _startMOUL, EXEC_NAME ) -elif sys.platform.startswith('linux2'): +elif __LINUX__: from moul.config.linux import ( getMoulUserDataDir, getPyMoulIniLocation, _startMOUL, EXEC_NAME ) -elif sys.platform.startswith('darwin'): +elif __MACOSX__: from moul.config.darwin import ( getMoulUserDataDir, getPyMoulIniLocation, Modified: pymoul/trunk/src/moul/config/win32.py =================================================================== --- pymoul/trunk/src/moul/config/win32.py 2007-01-18 17:01:49 UTC (rev 45) +++ pymoul/trunk/src/moul/config/win32.py 2007-01-18 17:03:10 UTC (rev 46) @@ -24,6 +24,7 @@ import os from miniwinshell import my_documents from miniwinshell import application_data +#from win32com.directsound import directsound MOUL_DIR = "Uru Live" INI_FILE = ('pyMoul', 'pymoul.ini') @@ -55,3 +56,12 @@ path = os.path.join(installdir, EXEC_NAME) args = (EXEC_NAME,) + args return os.spawnv(mode, path, args) + +#def enumSoundDevices(): +# """ +# """ +# names = [] +# for iid, name, driver in directsound.DirectSoundEnumerate(): +# if iid is not None: +# names.append(name) +# return names Modified: pymoul/trunk/src/moul/log.py =================================================================== --- pymoul/trunk/src/moul/log.py 2007-01-18 17:01:49 UTC (rev 45) +++ pymoul/trunk/src/moul/log.py 2007-01-18 17:03:10 UTC (rev 46) @@ -21,11 +21,16 @@ __version__ = "$Id$" __revision__ = "$Revision$" +__all__ = ['LOG', 'getLogger', 'signalLogDecorator'] + import logging import sys -# py2exe sets sys.frozen -if getattr(sys, 'frozen', False): +# copied from moul.config to prevent circular imports +__FROZEN__ = bool(getattr(sys, 'frozen', False)) +__LOG_SIGNALS__ = not __FROZEN__ + +if __FROZEN__: level = logging.ERROR else: level = logging.DEBUG @@ -34,6 +39,25 @@ format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%a, %d %b %Y %H:%M:%S' ) - LOG = logging.getLogger('pyMoul') getLogger = logging.getLogger + +def signalLogDecorator(__logger__): + """Decorator to log signals + + Logs signal methods to __logger__.debug() including func name, args + and kwargs. + + signalLogDecorator() is a NOOP when running as a sys.frozen program. + """ + def wrapper(func): + if __LOG_SIGNALS__: + def logwrapper(*args, **kwargs): + __logger__.debug("%s(*%s, **%s)" % (func.__name__, + repr(args[1:]), repr(kwargs))) + return func(*args, **kwargs) + logwrapper.__name__ = func.__name__ + return logwrapper + else: + return func + return wrapper Modified: pymoul/trunk/src/moul/server/tests/test_ping.py =================================================================== --- pymoul/trunk/src/moul/server/tests/test_ping.py 2007-01-18 17:01:49 UTC (rev 45) +++ pymoul/trunk/src/moul/server/tests/test_ping.py 2007-01-18 17:03:10 UTC (rev 46) @@ -57,7 +57,7 @@ def test_suite(): return unittest.TestSuite(( - unittest.makeSuite(PingServerTest), + #unittest.makeSuite(PingServerTest), DocTestSuite('moul.server.ping'), )) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-18 17:02:00
|
Revision: 45 http://pymoul.svn.sourceforge.net/pymoul/?rev=45&view=rev Author: tiran Date: 2007-01-18 09:01:49 -0800 (Thu, 18 Jan 2007) Log Message: ----------- * Fixed compileui.py to create files * Added AUTHORS.txt * Add txt files to dist Modified Paths: -------------- pymoul/trunk/compileui.py pymoul/trunk/setup.py Added Paths: ----------- pymoul/trunk/AUTHORS.txt Added: pymoul/trunk/AUTHORS.txt =================================================================== --- pymoul/trunk/AUTHORS.txt (rev 0) +++ pymoul/trunk/AUTHORS.txt 2007-01-18 17:01:49 UTC (rev 45) @@ -0,0 +1,13 @@ +Authors +------- + +Christian Heimes (maintainer, software design, QT ui) + +Others +------ + +ELF crypt code based on Marack's C++ code. + +Whatdoyousee crypt code based on the C++ code from Joseph D. and Anonymous54321. + +miniwinshell is a stripped down version of Tim Golden's winshell. Property changes on: pymoul/trunk/AUTHORS.txt ___________________________________________________________________ Name: svn:eol-style + native Modified: pymoul/trunk/compileui.py =================================================================== --- pymoul/trunk/compileui.py 2007-01-18 17:00:13 UTC (rev 44) +++ pymoul/trunk/compileui.py 2007-01-18 17:01:49 UTC (rev 45) @@ -22,7 +22,11 @@ UI_MODULE = "moul.qt.ui" def _newer(orig, py): - return os.stat(orig)[ST_MTIME] > os.stat(py)[ST_MTIME] + try: + return os.stat(orig)[ST_MTIME] > os.stat(py)[ST_MTIME] + except Exception: + return True + def previewUi(uifname): """Copied from PyQt.uic.pyuic Modified: pymoul/trunk/setup.py =================================================================== --- pymoul/trunk/setup.py 2007-01-18 17:00:13 UTC (rev 44) +++ pymoul/trunk/setup.py 2007-01-18 17:01:49 UTC (rev 45) @@ -10,10 +10,13 @@ import sys import os import time +from glob import glob + # boot strap easy setup SETUPTOOLS_VERSION = "0.6c1" from ez_setup import use_setuptools use_setuptools(version=SETUPTOOLS_VERSION) + from setuptools import setup from setuptools import find_packages from compileui import compileUi @@ -50,7 +53,7 @@ setup_options = dict( setup_requires = ["setuptools>="+SETUPTOOLS_VERSION,], install_requires = [], - data_files = [], + data_files = list(glob('*.txt')), package_dir = {'' : 'src'}, packages = find_packages('src', exclude="moul.qt"), include_package_data = True, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |