File: wb_diff_main.py

package info (click to toggle)
svn-workbench 1.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,164 kB
  • ctags: 2,111
  • sloc: python: 15,849; sh: 236; makefile: 11; ansic: 9
file content (74 lines) | stat: -rw-r--r-- 1,709 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
'''
 ====================================================================
 Copyright (c) 2003-2010 Barry A Scott.  All rights reserved.

 This software is licensed as described in the file LICENSE.txt,
 which you should have received as part of this distribution.

 ====================================================================


    wb_diff_main.py

'''

VERSION_STRING = "Uncontrolled"

import sys

# make sure that we get 2.8 or 3.0 and not an earlier version
if not hasattr(sys, 'frozen'):
    import wxversion
    wxversion.select( ['3.0', '2.8'] )

def noTranslate(msg):
    return msg

import __builtin__
__builtin__.__dict__['T_'] = noTranslate
__builtin__.__dict__['U_'] = noTranslate

import wx
import wb_diff_frame
import wb_preferences
import wb_platform_specific



class WbDiffApp(wx.App):
    def __init__( self, file1, file2 ):
        self.file1 = file1
        self.file2 = file2
        self.log = self
        self.prefs = wb_preferences.Preferences(
                self,
                wb_platform_specific.getPreferencesFilename(),
                wb_platform_specific.getOldPreferencesFilename() )

        wx.App.__init__( self, 0 )

    def OnInit( self ):
        self.frame = wb_diff_frame.DiffFrame( self, None, self.file1, self.file1, self.file2, self.file2 )
        self.frame.Show( True )
        self.SetTopWindow( self.frame )

        return True

    def info( self, *arg ):
        pass

        
def main():
    if len(sys.argv) < 3:
        print 'Usages: wb_diff file1 file2'
        return 1

    file1 = sys.argv[1]
    file2 = sys.argv[2]

    diff_app = WbDiffApp( file1, file2 )
    diff_app.MainLoop()
    return 0

if __name__ == '__main__':
    main()