~credativ/openobject-addons/c2c-extra

« back to all changes in this revision

Viewing changes to openerp-outlook-plugin/plugin_5.0/dialogs/resources/rcparser.py

  • Committer: ksa (Open ERP)
  • Date: 2010-07-06 05:10:58 UTC
  • Revision ID: ksa@tinyerp.co.in-20100706051058-x96e97ij1pvuu9ey
[IMP]:Remove print statement

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
import win32con
10
10
#import win32gui
11
11
import commctrl
 
12
import netsvc
 
13
logger = netsvc.Logger()
12
14
 
13
15
_controlMap = {"DEFPUSHBUTTON":0x80,
14
16
               "PUSHBUTTON":0x80,
51
53
        self.styles = []
52
54
        self.stylesEx = []
53
55
        self.controls = []
54
 
        #print "dialog def for ",self.name, self.id
55
56
    def createDialogTemplate(self):
56
57
        t = None
57
58
        self.template = [[self.caption, (self.x,self.y,self.w,self.h), self.style, self.styleEx, (self.fontSize, self.font)]]
87
88
        if ct in _controlMap:
88
89
            ct = _controlMap[ct]
89
90
        t = [ct, self.label, self.idNum, (self.x, self.y, self.w, self.h), self.style]
90
 
        #print t
91
91
        return t
92
92
 
93
93
 
105
105
 
106
106
    def debug(self, *args):
107
107
        if self.debugEnabled:
108
 
            print args
 
108
            return
109
109
 
110
110
    def getToken(self):
111
111
        self.token = self.lex.get_token()
131
131
            self.parseH(h)
132
132
            h.close()
133
133
        except OSError:
134
 
            print "No .h file. ignoring."
 
134
             logger.notifyChanne("No .h file. ignoring.")
135
135
        f = open(rcFileName)
136
136
        self.open(f)
137
137
        self.getToken()
159
159
                    if self.names.has_key(i):
160
160
                        # ignore AppStudio special ones.
161
161
                        if not n.startswith("_APS_"):
162
 
                            print "Duplicate id",i,"for",n,"is", self.names[i]
 
162
                             logger.notifyChannel("Duplicate id",i,"for",n,"is", self.names[i])
163
163
                    else:
164
164
                        self.names[i] = n
165
165
                    if self.next_id<=i:
179
179
                    deep -= 1
180
180
        elif "IDD_" == self.token[:4]:
181
181
            possibleDlgName = self.token
182
 
            #print "possible dialog:", possibleDlgName
183
182
            self.getToken()
184
183
            if "DIALOG" == self.token or "DIALOGEX" == self.token:
185
184
                self.dialog(possibleDlgName)
193
192
                    self.getToken() # bmpname
194
193
                bmf = self.token[1:-1] # quotes
195
194
                self.bitmaps[possibleBitmap] = bmf
196
 
                print "BITMAP", possibleBitmap, bmf
197
 
                #print win32gui.LoadImage(0, bmf, win32con.IMAGE_BITMAP,0,0,win32con.LR_DEFAULTCOLOR|win32con.LR_LOADFROMFILE)
198
195
 
199
196
    def addId(self, id_name):
200
197
        if id_name in self.ids:
309
306
        while self.token!="END":
310
307
            control = ControlDef()
311
308
            control.controlType = self.token;
312
 
            #print self.token
313
309
            self.getToken()
314
310
            if self.token[0:1]=='"':
315
311
                control.label = self.token[1:-1]
349
345
            if self.token==",":
350
346
                self.getToken()
351
347
                control.style, control.styles = self.styles([], defaultControlStyle)
352
 
            #print control.toString()
353
348
            dlg.controls.append(control)
354
349
def ParseDialogs(rc_file):
355
350
    rcp = RCParser()
358
353
    except:
359
354
        lex = getattr(rcp, "lex", None)
360
355
        if lex:
361
 
            print "ERROR parsing dialogs at line", lex.lineno
362
 
            print "Next 10 tokens are:"
 
356
            logger.notifyChannel("ERROR parsing dialogs at line", lex.lineno)
363
357
            for i in range(10):
364
 
                print lex.get_token(),
365
 
            print
 
358
                 logger.notifyChannel(lex.get_token(),)
366
359
        raise
367
360
 
368
361
    return rcp
372
365
    d = ParseDialogs(rc_file)
373
366
    import pprint
374
367
    for id, ddef in d.dialogs.items():
375
 
        print "Dialog %s (%d controls)" % (id, len(ddef))
376
368
        pprint.pprint(ddef)
377
 
        print