Пример #1
0
 def PreviewLine(self):
     prt = printout.PrintTable(self.frame)
     prt.label = ["Header 1", "Header 2", "Header 3"]
     prt.set_column = []
     prt.data = [["Row 1", "1", "2"], ["Row 2", "3", "4\nNew Line to see if it also can wrap around the cell region properly\nAnother new line"]]
     prt.SetFooter()
     prt.Preview()
Пример #2
0
    def PreviewNarrow(self):
        self.ReadData()
        new_data = []
        for val in self.data:
            new_data.append([val[0], val[1], val[2], val[4], val[5]])

        val = self.header
        new_header = [val[0], val[1], val[2], val[4], val[5]]

        prt = printout.PrintTable(self.frame)
        prt.data = new_data
        prt.set_column = [ 1, 1, 1, 1, 2]
        prt.label = new_header
        prt.SetColAlignment(1, wx.ALIGN_CENTRE)
        prt.SetColBackgroundColour(0, wx.NamedColour('RED'))
        prt.SetColTextColour(0, wx.NamedColour('WHITE'))
        prt.SetCellColour(4, 0, wx.NamedColour('LIGHT BLUE'))
        prt.SetCellColour(4, 1, wx.NamedColour('LIGHT BLUE'))
        prt.SetCellColour(17, 1, wx.NamedColour('LIGHT BLUE'))

        prt.SetColBackgroundColour(2, wx.NamedColour('LIGHT BLUE'))
        prt.SetCellText(4, 2, wx.NamedColour('RED'))

        prt.SetColTextColour(3, wx.NamedColour('RED'))
        prt.label_font_colour = wx.NamedColour('WHITE')
        prt.SetHeader("wxWindows Applications", colour = wx.NamedColour('RED'))

        prt.SetHeader("Printed: ", type = "Date & Time", align=wx.ALIGN_RIGHT, indent = -1, colour = wx.NamedColour('BLUE'))
        prt.SetFooter("Page No", colour = wx.NamedColour('RED'), type ="Num")
        prt.Preview()
Пример #3
0
    def OnPreviewMatrix(self):
        total_col = 45
        total_row = 10
        hsize = 0.2
        vsize = 0.2

        data = []
        startx = 1.0
        columns = []
        for val in range(total_col):
            columns.append(hsize)

        prt = printout.PrintTable(self.frame)

        for row in range(total_row):
            value = []
            for col in range(total_col):
                value.append(str(col))
            data.append(value)

        for col in range(total_col):
            prt.SetColAlignment(col, wx.ALIGN_CENTRE)

        prt.SetLandscape()
        prt.text_font_size = 8
        prt.cell_left_margin = 0

        prt.data = data
        prt.set_column = columns
        prt.SetHeader("Test of Small Grid Size")
        prt.Preview()
Пример #4
0
    def PrintWide(self):
        self.ReadData()
        prt = printout.PrintTable(self.frame)
        prt.data = self.data

        prt.left_margin = 0.5
        prt.set_columns = [ 1, 1, 1, 1, 2, 1, 3 ]
        prt.label = self.header
        prt.SetLandscape()
        prt.Print()
Пример #5
0
 def PreviewText(self):
     prt = printout.PrintTable(self.frame)
     prt.SetHeader("PROCLAMATION")
     file = open('data/proclamation.txt')
     data = []
     for txt in file:
         data.append(txt.strip())
     file.close()
     prt.data = data
     prt.Preview()
Пример #6
0
    def __init__(self, parent, frame):
        gridlib.Grid.__init__(self, parent, -1)
        self.parent = frame
        self.prt = printout.PrintTable(parent)

        #        self.prt.left_margin = 0.5
        #        self.prt.right_margin = 0.5
        #        self.prt.text_font_size = 8
        #        self.prt.cell_left_margin = 0

        self.project_func = None
        self.scan_func = None

        self.table = ParameterDataTable(self)

        self.variable_span = 0.25
        #The functions has to begin with the following letters:
        self.set_func = 'set'
        self.get_func = 'get'
        # The second parameter means that the grid is to take ownership of the
        # table and will destroy it when done.  Otherwise you would need to keep
        # a reference to it and call it's Destroy method later.
        self.SetTable(self.table, True)

        self.SetRowLabelSize(50)
        self.SetMargins(0, 0)
        # This is the my original column True means set as min...
        #self.AutoSizeColumns(True)
        # The new
        self.AutoSizeColumn(0, False)
        self.AutoSizeColumn(1, False)
        self.AutoSizeColumn(2, True)
        self.AutoSizeColumn(3, False)
        self.AutoSizeColumn(4, False)
        self.AutoSizeColumn(5, False)

        #Test cases for the parameter choosing function of the grid
        #self.objlist=['t','e']
        #self.funclist=[['e','w'],['x','y']]
        self.par_dict = {}

        self.Bind(gridlib.EVT_GRID_CELL_LEFT_DCLICK, self.OnLeftDClick)
        self.Bind(gridlib.EVT_GRID_CMD_CELL_LEFT_CLICK, self.OnLeftClick)
        self.Bind(gridlib.EVT_GRID_CMD_CELL_RIGHT_CLICK, self.OnRightClick)
        self.Bind(gridlib.EVT_GRID_LABEL_RIGHT_CLICK, self.OnLabelRightClick)
        self.Bind(wx.EVT_SIZE, self.OnResize)
Пример #7
0
    def PreviewWide(self):
        self.ReadData()
        prt = printout.PrintTable(self.frame)
        prt.data = self.data
        prt.left_margin = 0.5
        prt.set_column = [1.0, 1.0, 1.0, 1.5, 1.0, 3.0]
        prt.label = self.header
        prt.SetLandscape()

        prt.SetColumnLineSize(2, 3)
        prt.SetColumnLineColour(3, wx.NamedColour('RED'))

        prt.SetRowLineSize(1, 3)
        prt.SetRowLineColour(5, wx.NamedColour('RED'))

        prt.SetHeader("wx.Windows Applications")
        prt.SetFooter()
        prt.SetFooter("Date: ", type = "Date", align=wx.ALIGN_RIGHT, indent = -1, colour = wx.NamedColour('RED'))
        prt.Preview()
Пример #8
0
 def PreviewText(self):
     prt = printout.PrintTable(self.frame)
     prt.SetHeader("PROCLAMATION")
     with open('data/proclamation.txt') as file_:
         prt.data = [txt.strip() for txt in file_]
     prt.Preview()
Пример #9
0
def Crea_Info(padre, fichero, informe, destino=''):
    import wx.lib.printout as printout

    formManager = OC.manage.FormsManager()
    ls_inf = formManager.getFormsForTable(fichero)

    if not informe in ls_inf.keys(): return -1
    #
    deno, acc_antes, accion, acc_despues, gridc, gridp = ls_inf[informe]

    #- Contruimos preguntas
    preguntas = []
    for ln in gridp:
        campo, titu, fmt, lmax, op = ln
        preguntas.append([titu, op, '', campo, fmt, lmax])

    #- Campos a mostrar
    campos = []
    titus = []
    formatos = []
    anchos = []
    for ln in gridc:
        campos.append(ln[0])
        titus.append(ln[1])
        formatos.append(ln[2])
        anchos.append(ln[3] / 12.0)
    #-
    #if acc_antes!='':
    #    pb.Ejecuta_Accion(acc_antes)

    if accion != '':
        dl = OC.ui.dl_select(padre, fichero, campos, preguntas)
        res, prg = dl.res()
        if res == None: return -1
        res = padre.Ejecuta_Accion(accion, args=[res, prg])
    else:
        dl = OC.ui.dl_select(padre, fichero, campos, preguntas)
        res, prg = dl.res()
        if res == None: return -1

    #if acc_despues!='':
    #        pb.Ejecuta_Accion(acc_despues)

    if destino == '':
        for ln in res:
            for i in range(len(ln)):
                if formatos[i] == 'd': ln[i] = Num_aFecha(ln[i])
                if formatos[i] in ['i', '0', '1', '2', '3', '4']:
                    ln[i] = str(ln[i])
                #
                if not OC.isBaseString(ln[i]):
                    ln[i] = str(ln[i])

        if res == []:
            res = [' '] * len(titus)

        prt = printout.PrintTable(padre)
        prt.data = res
        prt.set_column = anchos  #[ 1, 3, 1, 1, 2]
        prt.label = titus
        for i in range(len(formatos)):
            fmt = formatos[i]
            if fmt in ['i', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
                prt.SetColAlignment(i, wx.ALIGN_RIGHT)

        #prt.SetColAlignment(1, wx.ALIGN_CENTRE)
        #prt.SetColBackgroundColour(0, wx.NamedColour('RED'))
        #prt.SetColTextColour(0, wx.NamedColour('WHITE'))
        #prt.SetCellColour(4, 0, wx.NamedColour('LIGHT BLUE'))
        #prt.SetCellColour(4, 1, wx.NamedColour('LIGHT BLUE'))
        #prt.SetCellColour(17, 1, wx.NamedColour('LIGHT BLUE'))
        #
        #prt.SetColBackgroundColour(2, wx.NamedColour('LIGHT BLUE'))
        #prt.SetCellText(4, 2, wx.NamedColour('RED'))

        #prt.SetColTextColour(3, wx.NamedColour('RED'))
        prt.label_font_colour = wx.Colour('WHITE')
        prt.SetHeader(deno, colour=wx.Colour('RED'))

        prt.SetHeader("Impreso: ",
                      type="Date & Time",
                      align=wx.ALIGN_RIGHT,
                      indent=-1,
                      colour=wx.Colour('BLUE'))
        prt.SetFooter("Page No", colour=wx.Colour('RED'), type="Num")
        prt.Preview()

    else:
        padre._ct[destino].SetValue(res)