Lines 371-385
class EA_Layout( dict ):
|
Link Here
|
---|
|
371 |
return self.get( 'advanced', False ) |
371 |
return self.get( 'advanced', False ) |
372 |
|
372 |
|
373 |
def __cmp__( self, other ): |
373 |
def __cmp__( self, other ): |
374 |
if self.groupName < other.groupName: |
374 |
return cmp(self.groupName, other.groupName) or cmp(self.position, other.position) |
375 |
return -1 |
|
|
376 |
if other.groupName < self.groupName: |
377 |
return 1 |
378 |
if self.position < other.position: |
379 |
return -1 |
380 |
if other.position < self.position: |
381 |
return 1 |
382 |
return 0 |
383 |
|
375 |
|
384 |
def update_extended_attributes(lo, module, position): |
376 |
def update_extended_attributes(lo, module, position): |
385 |
|
377 |
|
Lines 531-544
def update_extended_attributes(lo, module, position):
|
Link Here
|
---|
|
531 |
tabPosition = -1 |
523 |
tabPosition = -1 |
532 |
|
524 |
|
533 |
if tabPosition == -1: |
525 |
if tabPosition == -1: |
534 |
for ea_layout in properties4tabs[ tabname ]: |
526 |
tabPosition = min((ea_layout.position for ea_layout in properties4tabs[tabname])) - 1 |
535 |
try: |
|
|
536 |
if ea_layout.position <= tabPosition: |
537 |
# CLEANUP, FIXME: pos is undefined! |
538 |
# does not break because of except: |
539 |
tabPosition = pos-1 |
540 |
except: |
541 |
ud.debug(ud.ADMIN, ud.WARN, 'modules update_extended_attributes: custom field for tab %s: failed to set tabPosition' % tabname) |
542 |
|
527 |
|
543 |
properties4tabs[ tabname ].append( EA_Layout( name = pname, tabName = tabname, position = tabPosition, advanced = tabAdvanced, overwrite = overwriteProp, fullWidth = fullWidth, groupName = groupname, groupPosition = groupPosition ) ) |
528 |
properties4tabs[ tabname ].append( EA_Layout( name = pname, tabName = tabname, position = tabPosition, advanced = tabAdvanced, overwrite = overwriteProp, fullWidth = fullWidth, groupName = groupname, groupPosition = groupPosition ) ) |
544 |
|
529 |
|
Lines 553-568
def update_extended_attributes(lo, module, position):
|
Link Here
|
---|
|
553 |
overwriteTabList.append(tab) |
538 |
overwriteTabList.append(tab) |
554 |
|
539 |
|
555 |
if properties4tabs: |
540 |
if properties4tabs: |
556 |
lastprio = -1000 # CLEANUP: unneeded |
|
|
557 |
|
558 |
# remove layout of tabs that have been marked for replacement |
541 |
# remove layout of tabs that have been marked for replacement |
559 |
removetab = [] # CLEANUP: unneeded |
542 |
removetab = [] # CLEANUP: unneeded |
560 |
for tab in module.layout: |
543 |
for tab in module.layout: |
561 |
if tab.label in overwriteTabList: |
544 |
if tab.label in overwriteTabList: |
562 |
tab.layout = [] |
545 |
tab.layout = [] |
563 |
|
546 |
|
564 |
for tabname in properties4tabs.keys(): |
547 |
for tabname, priofields in properties4tabs.items(): |
565 |
priofields = properties4tabs[ tabname ] |
|
|
566 |
priofields.sort() |
548 |
priofields.sort() |
567 |
currentTab = None |
549 |
currentTab = None |
568 |
# get existing fields if tab has not been overwritten |
550 |
# get existing fields if tab has not been overwritten |