示例#1
0
 def __init__(self, parent, style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX|wx.RESIZE_BORDER|wx.STAY_ON_TOP):
     """Init."""
     self.parent=parent
     if not conf.settings['show.debug.log']: return
     wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=_(u'Debug Log'), pos=dPos, size=(415, 249), style=style)
     # Contents
     self.text_log = wx.TextCtrl(self, wx.ID_ANY, '', dPos, dSize, wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH)
     self.saveBtn = wx.Button(self, wx.ID_ANY, _(u'Save Log'), dPos, (-1, 22), 0)
     self.fcloseBtn = wx.Button(self, wx.ID_ANY, _(u'Force Close Wrye Mash...'), dPos, (-1, 22), 0)
     # Theming
     self.SetForegroundColour(wx.Colour(255, 255, 255))
     self.SetBackgroundColour(wx.Colour(240, 240, 240))
     # Events
     self.Bind(wx.EVT_CLOSE, self.OnClose)
     self.saveBtn.Bind(wx.EVT_BUTTON, self.savelog)
     self.fcloseBtn.Bind(wx.EVT_BUTTON, self.forceClose)
     # Functions
     sys.stdout = WxOutputRedirect(sys.stdout, self, self.text_log)
     sys.stderr = WxOutputRedirect(sys.stderr, self, self.text_log)
     # Layout
     btnSizer = wx.BoxSizer(wx.HORIZONTAL)
     btnSizer.AddMany([(self.saveBtn, 1, wx.EXPAND|wx.RIGHT, 5), (self.fcloseBtn, 0, wx.EXPAND, 5)])
     mainSizer = wx.BoxSizer(wx.VERTICAL)
     mainSizer.AddMany([(self.text_log, 1, wx.EXPAND, 5), (btnSizer, 0, wx.EXPAND, 5)])
     self.SetSizer(mainSizer)
     self.Layout()
     self.Centre(wx.BOTH)
示例#2
0
 def __init__(self, inName, recType, tryPos, maxPos):
     self.recType = recType
     self.tryPos = tryPos
     self.maxPos = maxPos
     if tryPos < 0: message = (_(u'%s: Attempted to read before (%d) beginning of file/buffer.') % (recType, tryPos))
     else: message = (_(u'%s: Attempted to read past (%d) end (%d) of file/buffer.') % (recType, tryPos, maxPos))
     Tes3Error.__init__(self, inName, message)
示例#3
0
 def __init__(self, inName, recName, readSize, maxSize, exactSize=True):
     self.recName = recName
     self.readSize = readSize
     self.maxSize = maxSize
     self.exactSize = exactSize
     if exactSize: messageForm = _(u'%s: Expected size == %d, but got: %d ')
     else: messageForm = _(u'%s: Expected size <= %d, but got: %d ')
     Tes3Error.__init__(self, inName, messageForm % (recName, readSize, maxSize))
示例#4
0
 def forceClose(self, event):
     """Force close Wrye Mash."""
     warning = _(u'Really force Wrye Mash to quit?\n\nDo this only if Wrye Mash is stuck ad infinitum in the debug log!!!')
     if gui.WarningQuery(self, warning, _(u'Are you sure?')) == wx.ID_NO: return
     self.Destroy()
     # Polemos: This is not a graceful exit. We could have exited gracefully by calling "self.parent.OnCloseWindow(None)" but
     # this may introduce undesired side-effects (conf corruption for example).
     self.parent.Destroy()
     sys.exit(0)
示例#5
0
def dumpTranslator():
    """Dumps new translation key file using existing key, value pairs."""
    #--Locale Path
    import locale
    language = locale.getlocale()[0].split('_', 1)[0]
    outPath = 'locale\\NEW%s.txt' % (language, )
    with open(outPath, 'w') as outFile:
        #--Scan for keys and dump to
        keyCount = 0
        dumpedKeys = set()
        reKey = re.compile(r'_\([\'\"](.+?)[\'\"]\)')
        for pyFile in ('mush.py', 'mosh.py', 'mash.py', 'masher.py'):
            with open(pyFile) as pyText:
                for lineNum, line in enumerate(pyText):
                    line = re.sub('#.*', '', line)
                    for key in reKey.findall(line):
                        if key in dumpedKeys: continue
                        outFile.write('=== %s, %d\n' % (pyFile, lineNum + 1))
                        outFile.write(key + '\n>>>>\n')
                        value = _(re.sub(r'\\n', '\n', key))
                        value = re.sub('\n', r'\\n', value)
                        if value != key: outFile.write(value)
                        outFile.write('\n')
                        dumpedKeys.add(key)
                        keyCount += 1
    print keyCount, 'translation keys written to', outPath
示例#6
0
 def savelog(self, event):
     """Save the log."""
     dialog = wx.FileDialog(self, _(u'Save log'), singletons.MashDir, "Debug", '*.log', wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
     if dialog.ShowModal() == wx.ID_OK:
         fileName = os.path.join(dialog.GetDirectory(), dialog.GetFilename())
         with io.open(fileName, 'w', encoding='utf-8', errors='replace') as fl:
             fl.write(self.text_log.GetValue())
示例#7
0
 def __init__(self, inName, cellId, objId, iObj, iMod, masterName=''):
     self.cellId = cellId
     self.iMod = iMod
     self.iObj = iObj
     self.objId = objId
     self.masterName = masterName
     message = (_(u'%s: Bad Ref: %s: objId: %s iObj: %d') % (inName, cellId, objId, iObj))
     if iMod: message += u' iMod: %d [%s]' % (iMod, masterName)
     Tes3Error.__init__(self, inName, message)
示例#8
0
def genSchedule(fileName, espName=None):
    """Schedule Generator."""
    generator = mosh.ScheduleGenerator()
    generator.loadText(fileName)
    #--Write to text file?
    if not espName:
        outName = os.path.splitext(fileName)[0] + '.mws'
        generator.dumpText(outName)
    #--Write to esp file?
    else:
        init(2)
        fileInfo = mosh.modInfos.data.get(espName)
        if not fileInfo: raise _(u'No such file: ') + espName
        generator.save(fileInfo)
示例#9
0
 def __init__(self,message=_(u'Section is not coded yet.')):
     mError.__init__(self, message)
示例#10
0
 def __init__(self, message=_(u'Object is in a bad state.')):
     mError.__init__(self, message)
示例#11
0
 def __init__(self, message=_(u'Argument is out of allowed ranged of values.')):
     mError.__init__(self, message)
示例#12
0
 def __init__(self,message=_(u'Abstract section called.')):
     mError.__init__(self, message)
示例#13
0
 def __init__(self, col=u'', message=_(u'Unrecognized sort key')):
     if col is None: col=u''
     mError.__init__(self, u'%s%s%s' % (message, u': ' if col or col is None else u'.', col))
示例#14
0
 def __init__(self, message=_(u'Unrecognized sort key.')):
     mError.__init__(self, message)
示例#15
0
 def __init__(self, message=_(u'Load list is full.')):
     mError.__init__(self, message)
示例#16
0
 def __str__(self):
     if self.inName: return self.inName+': '+self.message
     else: return _(u'Unknown File: ')+self.message
示例#17
0
                         'GFX',
                         'Location',
                         'Misc.',
                         'NPC',
                         'Quest',
                         'Race',
                         'Resource',
                         'Sound',
                         'MWSE'],
    'mash.mods.ratings': ['+', '1', '2', '3', '4', '5', '=', '~'],

    #--Wrye Mash: RefRemovers
    'mash.refRemovers.data': {
        },
    'mash.refRemovers.safeCells': [
        _(u"Balmora, Caius Cosades' House"),
        _(u"Indarys Manor"),
        _(u"Raven Rock, Factor's Estate"),
        _(u"Rethan Manor"),
        _(u"Skaal Village, The Blodskaal's House"),
        _(u"Solstheim, Thirsk"),
        _(u"Tel Uvirith, Tower Lower"),
        _(u"Tel Uvirith, Tower Upper"),
        ],

    #--Wrye Mash: RefReplacers
    'mash.refReplacers.data': {
        },

    #--Wrye Mash: Col (Sort) Names
    # Polemos: the '    File' fixes a wx glitch, kinda.   <===#
示例#18
0
 def __init__(self,inName,subName,recName):
     Tes3Error.__init__(self,inName,_(u'Extraneous subrecord (%s) in %s record.')
         % (subName,recName))
示例#19
0
 def __str__(self):
     return u'%s -> %s' % (self.inName or _(u'Unknown File'), self.message)