Ejemplo n.º 1
0
 def HelpBuilder_Check(self):
     if self.helpbuilder_hilite:
         t = 240
     else:
         t = 255
     self.SetTransparent(t)
     import awc.controls.dbgrid as dbglib
     for c in awu.GetAllChildrens(self):
         c.Bind(wx.EVT_ENTER_WINDOW, self.OnHelpBuilderMouseEnter)
         c.Bind(wx.EVT_LEAVE_WINDOW, self.OnHelpBuilderMouseLeave)
Ejemplo n.º 2
0
def SetFirstFocus(parent):
    if parent.IsShown():
        if awu.GetParentFrame(parent).IsShown():
            for ctrl in awu.GetAllChildrens(parent):
                if isinstance(ctrl, (TextCtrl, NumCtrl, DateCtrl, CheckBox,
                                     RadioBox, Choice, LinkTable, DbGrid)):
                    if hasattr(ctrl, 'this'):

                        def SetFocus():
                            try:
                                ctrl.SetFocus()
                            except:
                                pass

                        wx.CallAfter(SetFocus)
                    break
Ejemplo n.º 3
0
 def TestRegIva(self):
     tipo = self.FindWindowByName('tipo').GetValue()
     rdyn = self.FindWindowByName('regivadyn').GetValue()
     rivctrls = [x for x in awu.GetAllChildrens(self)
                 if 'regiva' in x.GetName()]
     riva = self.FindWindowByName('id_regiva')
     doiva = tipo in "IE"
     if not doiva:
         riva.SetValue(None)
     for c in rivctrls:
         if c.GetName().startswith('id_regiva'):
             enab = doiva and rdyn == 0
         elif c.GetName().startswith('_regiva_detmag'):
             enab = doiva and rdyn == 1 and self.db_recid is not None
         else:
             enab = doiva
         c.Enable(enab)
     riva.SetObligatory(doiva and not rdyn)
Ejemplo n.º 4
0
 def HasFocus(self):
     return self.FindFocus() in awu.GetAllChildrens(self)
Ejemplo n.º 5
0
 def RefreshInsideDefaultItems(self):
     for c in awu.GetAllChildrens(self):
         if hasattr(c, 'RefreshDefaultItem'):
             c.RefreshDefaultItem()
Ejemplo n.º 6
0
 def GetAllChildren(self):
     return awu.GetAllChildrens(self)
Ejemplo n.º 7
0
    def AddFiltersPanelTitleElements(self, filtersPanel):

        from report.element import staticText as ST
        from report.element import linea as LINE
        import copy

        t = self.oTitle
        t.dDefinizione_Banda = copy.copy(self.oPageHeader.dDefinizione_Banda)
        self.oTitle.insideObject = copy.copy(self.oPageHeader.insideObject)
        self.oTitle.altezza = self.oPageHeader.altezza
        self.oTitle.altezzaEstesa = self.oPageHeader.altezzaEstesa

        controls = awu.GetAllChildrens(
            filtersPanel,
            lambda x: isinstance(x, (wx.StaticText, wx.TextCtrl, wx.CheckBox)))
        controls = [[
            c.GetParent().ClientToScreen(c.GetPosition())[1],
            c.GetParent().ClientToScreen(c.GetPosition())[0],
            c.GetSize()[1],
            c.GetSize()[0], c
        ] for c in controls]
        controls.sort()

        pf = self.oCanvas.oPageFormat
        drawable_width = pf.larghezza - pf.leftMargin - pf.rightMargin

        miny = minx = 44444
        for cy, cx, ch, cw, c in controls:
            miny = min(miny, cy)
            minx = min(minx, cx)
        WX_RATIO_X = float(filtersPanel.GetSize()[0]) / float(drawable_width)
        WX_RATIO_Y = 2
        for c in controls:
            c[0] = (c[0] - miny) / WX_RATIO_Y
            c[1] = (c[1] - minx) / WX_RATIO_X
            c[2] = c[2] / WX_RATIO_Y
            c[3] = c[3] / WX_RATIO_X

        def_text = {}
        def_text['reportElement'] = {
            'backcolor': '#FFFFFF',
            'forecolor': '#000000',
            'height': 10,
            'isPrintInFirstWholeBand': 'false',
            'isPrintRepeatedValues': 'true',
            'isPrintWhenDetailOverflows': 'false',
            'isRemoveLineWhenBlank': 'false',
            'key': 'keyelement-0000',
            'mode': 'Transparent',
            'positionType': 'FixRelativeToTop',
            'stretchType': 'NoStrech',
            'width': 100,
            'x': 0,
            'y': 0
        }

        def_text['text'] = {'DATA': 'text'}

        def_text['textElement'] = {
            'font': {
                'fontName': 'Times New Roman',
                'isBold': 'false',
                'isItalic': 'false',
                'isPdfEmbedded': 'false',
                'isStrikeThrough': 'false',
                'isUnderline': 'false',
                'pdfEncoding': 'Cp1252',
                'pdfFontName': 'Times-Roman',
                'size': 7,
            },
            'lineSpacing': 'Single',
            'rotation': 'None',
            'textAlignment': 'Left',
            'verticalAlignment': 'Top'
        }

        def_line = {
            'direction': 'TipDown',
            'graphicElement': {
                'fill': 'Solid',
                'pen': 'Thin',
                'stretchType': 'NoStrech'
            },
            'reportElement': def_text['reportElement']
        }

        yos = self.oTitle.altezza
        hec = 15
        d = def_text
        re = d['reportElement']
        te = d['textElement']
        tx = d['text']

        for cy, cx, ch, cw, c in controls:

            ey = yos + cy
            ex = cx

            if isinstance(c, wx.StaticText):
                re['key'] = 'autolabel-%s' % c.GetName()
                tx['DATA'] = c.GetLabel()
                ta = 'Left'
                if not c.GetLabel().lower() in 'da: a:'.split():
                    ta = 'Right'
                te['textAlignment'] = ta
                te['font']['fontName'] = 'Times New Roman'
                te['font']['pdfFontName'] = 'Times-Roman'
                te['font']['isBold'] = 'false'

            elif isinstance(c, wx.TextCtrl):
                re['key'] = 'autovalue-%s' % c.GetName()
                tx['DATA'] = c.GetValue()
                te['textAlignment'] = 'Left'
                #if type(c.GetValue()) in (int, long, float, Env.DateTime.Date):
                #te['font']['fontName'] =    'Courier New'
                #te['font']['pdfFontName'] = 'Courier-Bold'
                #else:
                #te['font']['fontName'] =    'Arial'
                #te['font']['pdfFontName'] = 'Helvetica-Bold'
                te['font']['fontName'] = 'Times New Roman'
                te['font']['pdfFontName'] = 'Times-Roman'
                te['font']['isBold'] = 'true'
                ey += 3

            elif isinstance(c, wx.CheckBox) and c.IsChecked():
                re['key'] = 'autovalue-%s' % c.GetName()
                tx['DATA'] = c.GetLabel()
                te['textAlignment'] = 'Left'
                #te['font']['fontName'] =    'Arial'
                #te['font']['pdfFontName'] = 'Helvetica-Bold'
                te['font']['fontName'] = 'Times New Roman'
                te['font']['pdfFontName'] = 'Times-Roman'
                te['font']['isBold'] = 'true'

            else:
                continue

            re['y'] = ey
            re['x'] = ex
            re['width'] = cw
            re['height'] = 10  #ch
            self.oTitle.insideObject.append(ST(d, self.oCanvas))
            ey = max(ey, ey)

        d = def_line
        re = d['reportElement']
        re['x'] = 0
        re['y'] = ey + hec
        re['width'] = drawable_width
        re['height'] = 0
        self.oTitle.insideObject.append(LINE(d))
        self.oTitle.altezza = self.oTitle.altezzaEstesa = ey + hec + 5