コード例 #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=wx.DefaultPosition, size=(415, 249), style=style)
     # Contents:
     self.text_log = wx.TextCtrl(self, wx.ID_ANY, '', wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH)
     self.saveBtn = wx.Button(self, wx.ID_ANY, _(u'Save Log'), wx.DefaultPosition, (-1,22), 0)
     self.fcloseBtn = wx.Button(self, wx.ID_ANY, _(u'Force Close Wrye Mash...'), wx.DefaultPosition, (-1,22), 0)
     # Theming:
     self.SetForegroundColour(wx.Colour(255, 255, 255))
     self.SetBackgroundColour(wx.Colour(240, 240, 240))
     # Sizer:
     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)
     # 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)
     self.Layout()
     self.Centre(wx.BOTH)
コード例 #2
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, )
    outFile = open(outPath, 'w')
    #--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'):
        pyText = open(pyFile)
        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
        pyText.close()
    outFile.close()
    print keyCount, 'translation keys written to', outPath
コード例 #3
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 codecs.open(fileName, 'w', encoding='utf-8', errors='replace') as file:
             file.write(self.text_log.GetValue())
コード例 #4
0
ファイル: mish.py プロジェクト: Nosewings/Wrye-Mash
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,)
    outFile = open(outPath,'w')
    #--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'):
        pyText = open(pyFile)
        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
        pyText.close()
    outFile.close()
    print keyCount,'translation keys written to',outPath
コード例 #5
0
def genSchedule(fileName, espName=None):
    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 _('No such file: ') + espName
        generator.save(fileInfo)
コード例 #6
0
ファイル: mish.py プロジェクト: Nosewings/Wrye-Mash
def genSchedule(fileName,espName=None):
    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 _('No such file: ')+espName
        generator.save(fileInfo)
コード例 #7
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.parent.Destroy()
     sys.exit(0)
コード例 #8
0
ファイル: conf.py プロジェクト: Nosewings/Wrye-Mash
     'Modified':1,
     },
 'bash.screens.colWidths': {
     'File':150,
     'Modified':150,
     'Size':75,
     },
 'bash.screens.colAligns': {},
 #--Wrye Mash: Group and Rating
 'mash.mods.groups': ['Body','Bethesda','Clothes','Creature','Fix','Last','Test','Game','GFX','Location','Misc.','NPC','Quest','Race','Resource','Sound'],
 'mash.mods.ratings': ['+','1','2','3','4','5','=','~'],
 #--Wrye Mash: RefRemovers
 'mash.refRemovers.data': {
     },
 'mash.refRemovers.safeCells': [
     _("Balmora, Caius Cosades' House"),
     _("Indarys Manor"),
     _("Raven Rock, Factor's Estate"),
     _("Rethan Manor"),
     _("Skaal Village, The Blodskaal's House"),
     _("Solstheim, Thirsk"),
     _("Tel Uvirith, Tower Lower"),
     _("Tel Uvirith, Tower Upper"),
     ],
 #--Wrye Mash: RefReplacers
 'mash.refReplacers.data': {
     },
 #--Wrye Mash: Col (Sort) Names
 'mash.colNames': {
     'Author': _('Author'),
     'Cell': _('Cell'),
コード例 #9
0
ファイル: conf.py プロジェクト: c0dir/Wrye-Mash
     'File': 150,
     'Modified': 150,
     'Size': 75,
 },
 'bash.screens.colAligns': {},
 #--Wrye Mash: Group and Rating
 'mash.mods.groups': [
     'Body', 'Bethesda', 'Clothes', 'Creature', 'Fix', 'Last', 'Test',
     'Game', 'GFX', 'Location', 'Misc.', 'NPC', 'Quest', 'Race', 'Resource',
     'Sound'
 ],
 'mash.mods.ratings': ['+', '1', '2', '3', '4', '5', '=', '~'],
 #--Wrye Mash: RefRemovers
 'mash.refRemovers.data': {},
 'mash.refRemovers.safeCells': [
     _("Balmora, Caius Cosades' House"),
     _("Indarys Manor"),
     _("Raven Rock, Factor's Estate"),
     _("Rethan Manor"),
     _("Skaal Village, The Blodskaal's House"),
     _("Solstheim, Thirsk"),
     _("Tel Uvirith, Tower Lower"),
     _("Tel Uvirith, Tower Upper"),
 ],
 #--Wrye Mash: RefReplacers
 'mash.refReplacers.data': {},
 #--Wrye Mash: Col (Sort) Names
 'mash.colNames': {
     'Author': _('Author'),
     'Cell': _('Cell'),
     'Count': _('Count'),