How to use resalte method in SeleniumBase

Best Python code snippet using SeleniumBase

frm_historial_detalle_procesos_ECD.py

Source:frm_historial_detalle_procesos_ECD.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2###########################################################################3## Python code generated with wxFormBuilder (version Jun 17 2015)4## http://www.wxformbuilder.org/5##6## PLEASE DO "NOT" EDIT THIS FILE!7###########################################################################8import wx9import pandas as pd10import wx.xrc11import wx.grid12import wx.adv13from pyeay.dbcac.conexiondb import Ejecutar_SQL14from pyeay.rows import ManipularRows15from pyeay.grillas import ManipularGrillas16from formEAY.dbaseCAC.dbVarios import DbGetVarios17from formEAY.constantesCAC.constantesCAC import BasesDeDatos18from formEAY.constantesCAC.constantesCAC import AreasProduccion19from formEAY.constantesCAC.coloresCAC import ColorsFondoCellGrilla, Colors_botones20# COLOR_RESALTE_PRIMERA = ColorsFondoCellGrilla.RESALTE_221# COLOR_RESALTE_SEGUNDA = ColorsFondoCellGrilla.RESALTE_522#23# COLOR_RESALTE_ROTURA = ColorsFondoCellGrilla.RESALTE_ROSA24# COLOR_RESALTE_ROTURA_CLARO = ColorsFondoCellGrilla.RESALTE_ROSA225#26# COLOR_RESALTE_TOTAL = ColorsFondoCellGrilla.RESALTE_AGUAMARINA27#28# AREA_EXTRUSION = AreasProduccion.EXTRUSION29# AREA_CARGUE_VAGONETAS = AreasProduccion.CARGUE_VAGONETAS30# AREA_DESCARGUE_VAGONETAS = AreasProduccion.DESCARGUE_VAGONETAS31COLOR_RESALTE_PRIMERA = wx.Colour(255, 236, 234)32COLOR_RESALTE_SEGUNDA = wx.Colour(229, 212, 210)33COLOR_RESALTE_ROTURA = wx.Colour(233, 192, 192) ## ROTURA34COLOR_RESALTE_ROTURA_CLARO = ColorsFondoCellGrilla.RESALTE_ROSA235COLOR_RESALTE_TOTAL = wx.Colour(255, 213, 177)36AREA_EXTRUSION = AreasProduccion.EXTRUSION37AREA_CARGUE_VAGONETAS = AreasProduccion.CARGUE_VAGONETAS38AREA_DESCARGUE_VAGONETAS = AreasProduccion.DESCARGUE_VAGONETAS39###########################################################################40## Class HistorialProcesos_ECD41###########################################################################42class HistorialDetalleProcesos_ECD(wx.Frame):43 def __init__(self, parent):44 wx.Frame.__init__(self, parent, id=wx.ID_ANY,45 title=u"Historial Detalle Procesos [Extrusión, Cargue y Descargue de Vagonetas]",46 pos=wx.DefaultPosition, size=wx.Size(1000, 650),47 style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)48 self.SetSizeHints(wx.Size(750, 400), wx.DefaultSize)49 self.SetBackgroundColour(wx.Colour(240, 240, 240))50 51 self.orden_ascendente=True52 self.df = None53 bSizer_principal = wx.BoxSizer(wx.VERTICAL)54 bSizer_panelCabecera = wx.BoxSizer(wx.HORIZONTAL)55 self.panel_cabecera = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL)56 self.panel_cabecera.SetBackgroundColour(wx.Colour(255, 255, 255))57 bSizer_cabecera = wx.BoxSizer(wx.HORIZONTAL)58 bSizer_rango_fechas = wx.BoxSizer(wx.VERTICAL)59 self.lbl_etq_rangoFechas = wx.StaticText(self.panel_cabecera, wx.ID_ANY, u"Rango Fechas", wx.DefaultPosition,60 wx.DefaultSize, 0)61 self.lbl_etq_rangoFechas.Wrap(-1)62 self.lbl_etq_rangoFechas.SetFont(wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString))63 self.lbl_etq_rangoFechas.SetForegroundColour(wx.Colour(255, 128, 0))64 bSizer_rango_fechas.Add(self.lbl_etq_rangoFechas, 0, wx.ALL, 5)65 bSizer_fecha1 = wx.BoxSizer(wx.HORIZONTAL)66 self.lbl_etq_fechaInicial = wx.StaticText(self.panel_cabecera, wx.ID_ANY, u"Fecha Inicial:", wx.DefaultPosition,67 wx.Size(70, -1), wx.ALIGN_RIGHT)68 self.lbl_etq_fechaInicial.Wrap(-1)69 bSizer_fecha1.Add(self.lbl_etq_fechaInicial, 0, wx.ALL, 5)70 self.datePicker_fecha1 = wx.adv.DatePickerCtrl(self.panel_cabecera, wx.ID_ANY, wx.DefaultDateTime,71 wx.DefaultPosition, wx.DefaultSize, style = wx.adv.DP_DROPDOWN | wx.adv.DP_SHOWCENTURY)72 bSizer_fecha1.Add(self.datePicker_fecha1, 1, wx.ALL, 5)73 bSizer_rango_fechas.Add(bSizer_fecha1, 0, wx.EXPAND, 5)74 bSizer_fecha2 = wx.BoxSizer(wx.HORIZONTAL)75 self.lbl_etq_fechaFinal = wx.StaticText(self.panel_cabecera, wx.ID_ANY, u"Fecha Final:", wx.DefaultPosition,76 wx.Size(70, -1), wx.ALIGN_RIGHT)77 self.lbl_etq_fechaFinal.Wrap(-1)78 bSizer_fecha2.Add(self.lbl_etq_fechaFinal, 0, wx.ALL, 5)79 self.datePicker_fecha2 = wx.adv.DatePickerCtrl(self.panel_cabecera, wx.ID_ANY, wx.DefaultDateTime,80 wx.DefaultPosition, wx.DefaultSize, style = wx.adv.DP_DROPDOWN | wx.adv.DP_SHOWCENTURY)81 bSizer_fecha2.Add(self.datePicker_fecha2, 1, wx.ALL, 5)82 bSizer_rango_fechas.Add(bSizer_fecha2, 1, wx.EXPAND, 5)83 bSizer_cabecera.Add(bSizer_rango_fechas, 1, wx.EXPAND, 5)84 bSizer_area = wx.BoxSizer(wx.VERTICAL)85 self.lbl_etq_area = wx.StaticText(self.panel_cabecera, wx.ID_ANY, u"Area", wx.DefaultPosition, wx.DefaultSize,86 0)87 self.lbl_etq_area.Wrap(-1)88 self.lbl_etq_area.SetFont(wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString))89 self.lbl_etq_area.SetForegroundColour(wx.Colour(255, 128, 0))90 bSizer_area.Add(self.lbl_etq_area, 0, wx.ALL, 5)91 bSizer17 = wx.BoxSizer(wx.VERTICAL)92 radioBox_areaChoices = [AreasProduccion.EXTRUSION, AreasProduccion.CARGUE_VAGONETAS, AreasProduccion.DESCARGUE_VAGONETAS, 'DESPACHOS']93 self.radioBox_area = wx.RadioBox(self.panel_cabecera, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,94 wx.DefaultSize, radioBox_areaChoices, 1, wx.RA_SPECIFY_COLS)95 self.radioBox_area.SetSelection(0)96 bSizer17.Add(self.radioBox_area, 0, wx.ALL, 5)97 bSizer_area.Add(bSizer17, 1, wx.EXPAND, 5)98 bSizer_cabecera.Add(bSizer_area, 0, wx.EXPAND, 5)99 bSizer_turno = wx.BoxSizer(wx.VERTICAL)100 self.lbl_etq_turno = wx.StaticText(self.panel_cabecera, wx.ID_ANY, u"Turno", wx.DefaultPosition, wx.DefaultSize,101 0)102 self.lbl_etq_turno.Wrap(-1)103 self.lbl_etq_turno.SetFont(wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString))104 self.lbl_etq_turno.SetForegroundColour(wx.Colour(255, 128, 0))105 bSizer_turno.Add(self.lbl_etq_turno, 0, wx.ALL, 5)106 checkList_turnoChoices = [u"turno 1", u"turno 2"]107 self.checkList_turno = wx.CheckListBox(self.panel_cabecera, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize,108 checkList_turnoChoices, 0)109 bSizer_turno.Add(self.checkList_turno, 1, wx.ALL | wx.EXPAND, 5)110 bSizer_cabecera.Add(bSizer_turno, 2, wx.EXPAND, 5)111 # bSizer_estado = wx.BoxSizer(wx.VERTICAL)112 #113 # self.lbl_etq_estado = wx.StaticText(self.panel_cabecera, wx.ID_ANY, u"Estado", wx.DefaultPosition,114 # wx.DefaultSize, 0)115 # self.lbl_etq_estado.Wrap(-1)116 # self.lbl_etq_estado.SetFont(wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString))117 # self.lbl_etq_estado.SetForegroundColour(wx.Colour(112, 112, 112))118 #119 # bSizer_estado.Add(self.lbl_etq_estado, 0, wx.ALL, 5)120 #121 # checkList_estadoChoices = [u"Activo", u"Inactivo"]122 # self.checkList_estado = wx.CheckListBox(self.panel_cabecera, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize,123 # checkList_estadoChoices, 0)124 # bSizer_estado.Add(self.checkList_estado, 1, wx.ALL | wx.EXPAND, 5)125 #126 # bSizer_cabecera.Add(bSizer_estado, 0, wx.EXPAND, 5)127 bSizer_botonesCabecera = wx.BoxSizer(wx.VERTICAL)128 self.m_staticText6 = wx.StaticText(self.panel_cabecera, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,129 wx.DefaultSize, 0)130 self.m_staticText6.Wrap(-1)131 bSizer_botonesCabecera.Add(self.m_staticText6, 0, wx.ALL, 5)132 self.btn_buscar = wx.Button(self.panel_cabecera, wx.ID_ANY, u"&Buscar", wx.DefaultPosition, wx.DefaultSize,133 wx.NO_BORDER)134 self.btn_buscar.SetBackgroundColour(wx.Colour(0, 255, 255))135 bSizer_botonesCabecera.Add(self.btn_buscar, 0, wx.ALL, 5)136 self.btn_graficar = wx.Button(self.panel_cabecera, wx.ID_ANY, u"&Graficar", wx.DefaultPosition, wx.DefaultSize,137 wx.NO_BORDER)138 self.btn_graficar.SetBackgroundColour(wx.Colour(255, 128, 0))139 self.btn_graficar.SetForegroundColour(wx.WHITE)140 bSizer_botonesCabecera.Add(self.btn_graficar, 0, wx.ALL, 5)141 bSizer_cabecera.Add(bSizer_botonesCabecera, 0, wx.EXPAND, 5)142 self.panel_cabecera.SetSizer(bSizer_cabecera)143 self.panel_cabecera.Layout()144 bSizer_cabecera.Fit(self.panel_cabecera)145 bSizer_panelCabecera.Add(self.panel_cabecera, 1, wx.EXPAND | wx.ALL, 5)146 bSizer_principal.Add(bSizer_panelCabecera, 0, wx.EXPAND, 5)147 bSizer_panelResultados = wx.BoxSizer(wx.VERTICAL)148 self.m_panel_resultados = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL)149 self.m_panel_resultados.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))150 bSizer_resultados = wx.BoxSizer(wx.VERTICAL)151 bSizer_totalesConsulta = wx.BoxSizer(wx.HORIZONTAL)152 self.lbl_etq_area_resultados = wx.StaticText(self.m_panel_resultados, wx.ID_ANY, u"Area:", wx.DefaultPosition,153 wx.DefaultSize, 0)154 self.lbl_etq_area_resultados.Wrap(-1)155 bSizer_totalesConsulta.Add(self.lbl_etq_area_resultados, 0, wx.ALL, 5)156 self.lbl_area = wx.StaticText(self.m_panel_resultados, wx.ID_ANY, u"", wx.DefaultPosition,157 wx.DefaultSize, 0)158 self.lbl_area.Wrap(-1)159 self.lbl_area.SetFont(wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString))160 self.lbl_area.SetForegroundColour(wx.Colour(0, 0, 0))161 self.lbl_area.SetMinSize(wx.Size(170, -1))162 bSizer_totalesConsulta.Add(self.lbl_area, 0, wx.ALL, 5)163 self.lbl_etq_fechas = wx.StaticText(self.m_panel_resultados, wx.ID_ANY, u"Fechas:", wx.DefaultPosition,164 wx.DefaultSize, 0)165 self.lbl_etq_fechas.Wrap(-1)166 bSizer_totalesConsulta.Add(self.lbl_etq_fechas, 0, wx.ALL, 5)167 self.lbl_fechas = wx.StaticText(self.m_panel_resultados, wx.ID_ANY, u"",168 wx.DefaultPosition, wx.DefaultSize, 0)169 self.lbl_fechas.Wrap(-1)170 self.lbl_fechas.SetFont(wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString))171 self.lbl_fechas.SetMinSize(wx.Size(150, -1))172 bSizer_totalesConsulta.Add(self.lbl_fechas, 0, wx.ALL, 5)173 self.lbl_etq_registrosEncontrados = wx.StaticText(self.m_panel_resultados, wx.ID_ANY, u"Registros encontrados:",174 wx.DefaultPosition, wx.DefaultSize, 0)175 self.lbl_etq_registrosEncontrados.Wrap(-1)176 bSizer_totalesConsulta.Add(self.lbl_etq_registrosEncontrados, 0, wx.ALL, 5)177 self.lbl_registrosencontrados = wx.StaticText(self.m_panel_resultados, wx.ID_ANY, u"0", wx.DefaultPosition,178 wx.DefaultSize, 0)179 self.lbl_registrosencontrados.Wrap(-1)180 self.lbl_registrosencontrados.SetFont(wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString))181 self.lbl_registrosencontrados.SetMinSize(wx.Size(60, -1))182 bSizer_totalesConsulta.Add(self.lbl_registrosencontrados, 0, wx.ALL, 5)183 ###184 self.lbl_etq_turnos = wx.StaticText(self.m_panel_resultados, wx.ID_ANY, u"Turnos"185 u":",186 wx.DefaultPosition, wx.DefaultSize, 0)187 self.lbl_etq_turnos.Wrap(-1)188 bSizer_totalesConsulta.Add(self.lbl_etq_turnos, 0, wx.ALL, 5)189 self.lbl_turnos = wx.StaticText(self.m_panel_resultados, wx.ID_ANY, u"", wx.DefaultPosition,190 wx.DefaultSize, 0)191 self.lbl_turnos.Wrap(-1)192 self.lbl_turnos.SetFont(wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString))193 self.lbl_turnos.SetMinSize(wx.Size(60, -1))194 bSizer_totalesConsulta.Add(self.lbl_turnos, 0, wx.ALL, 5)195 ###196 bSizer_resultados.Add(bSizer_totalesConsulta, 0, wx.EXPAND, 5)197 self.grid_totales = wx.grid.Grid(self.m_panel_resultados, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0)198 # Grid199 self.grid_totales.CreateGrid(1, 2)200 self.grid_totales.EnableEditing(True)201 self.grid_totales.EnableGridLines(True)202 self.grid_totales.EnableDragGridSize(False)203 self.grid_totales.SetMargins(0, 0)204 # Columns205 self.grid_totales.AutoSizeColumns()206 self.grid_totales.EnableDragColMove(False)207 self.grid_totales.EnableDragColSize(True)208 self.grid_totales.SetColLabelSize(30)209 self.grid_totales.SetColLabelValue(0, u"Total Unidades")210 self.grid_totales.SetColLabelValue(1, u"Total Toneladas")211 self.grid_totales.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)212 # Rows213 self.grid_totales.EnableDragRowSize(True)214 self.grid_totales.SetRowLabelSize(50)215 self.grid_totales.SetRowLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)216 # Label Appearance217 self.grid_totales.SetLabelBackgroundColour(wx.Colour(255, 255, 255))218 # Cell Defaults219 self.grid_totales.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP)220 bSizer_resultados.Add(self.grid_totales, 0, wx.ALL | wx.EXPAND, 5)221 self.grid_resultado_busqueda = wx.grid.Grid(self.m_panel_resultados, wx.ID_ANY, wx.DefaultPosition,222 wx.DefaultSize, 0)223 # Grid224 self.grid_resultado_busqueda.CreateGrid(5, 8)225 self.grid_resultado_busqueda.EnableEditing(True)226 self.grid_resultado_busqueda.EnableGridLines(True)227 self.grid_resultado_busqueda.EnableDragGridSize(False)228 self.grid_resultado_busqueda.SetMargins(0, 0)229 # Columns230 self.grid_resultado_busqueda.AutoSizeColumns()231 self.grid_resultado_busqueda.EnableDragColMove(False)232 self.grid_resultado_busqueda.EnableDragColSize(True)233 self.grid_resultado_busqueda.SetColLabelSize(30)234 self.grid_resultado_busqueda.SetColLabelValue(0, u"id")235 self.grid_resultado_busqueda.SetColLabelValue(1, u"uuid")236 self.grid_resultado_busqueda.SetColLabelValue(2, u"Fecha Inicio")237 self.grid_resultado_busqueda.SetColLabelValue(3, u"Hora Inicio")238 self.grid_resultado_busqueda.SetColLabelValue(4, u"Turno")239 self.grid_resultado_busqueda.SetColLabelValue(5, u"Cant. Coches")240 self.grid_resultado_busqueda.SetColLabelValue(6, u"Unidades")241 self.grid_resultado_busqueda.SetColLabelValue(7, u"Activo")242 self.grid_resultado_busqueda.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)243 # Rows244 self.grid_resultado_busqueda.EnableDragRowSize(True)245 self.grid_resultado_busqueda.SetRowLabelSize(50)246 self.grid_resultado_busqueda.SetRowLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)247 # Label Appearance248 self.grid_resultado_busqueda.SetLabelBackgroundColour(wx.Colour(255, 255, 255))249 # Cell Defaults250 self.grid_resultado_busqueda.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP)251 bSizer_resultados.Add(self.grid_resultado_busqueda, 1, wx.ALL | wx.EXPAND, 5)252 self.m_panel_resultados.SetSizer(bSizer_resultados)253 self.m_panel_resultados.Layout()254 bSizer_resultados.Fit(self.m_panel_resultados)255 bSizer_panelResultados.Add(self.m_panel_resultados, 1, wx.EXPAND | wx.ALL, 5)256 self.lbl_nota1 = wx.StaticText(self, wx.ID_ANY,257 u"DobleClick sobre el encabezado de la tabla para ordenar",258 wx.DefaultPosition, wx.DefaultSize, 0)259 self.lbl_nota1.Wrap(-1)260 self.lbl_nota1.SetFont(wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 90, False, wx.EmptyString))261 self.lbl_nota1.SetForegroundColour(wx.Colour(0, 128, 0))262 bSizer_panelResultados.Add(self.lbl_nota1, 0, wx.ALL, 5)263 bSizer_principal.Add(bSizer_panelResultados, 1, wx.EXPAND, 5)264 self.SetSizer(bSizer_principal)265 self.Layout()266 self.Centre(wx.BOTH)267 ## OPERACIONES INICIALES EAY268 self.cargar_valores_de_inicializacion()269 # Connect Events270 self.radioBox_area.Bind(wx.EVT_RADIOBOX, self.radioBox_areaOnRadioBox)271 self.btn_buscar.Bind(wx.EVT_BUTTON, self.btn_buscarOnButtonClick)272 self.btn_graficar.Bind(wx.EVT_BUTTON, self.btn_graficarOnButtonClick)273 self.grid_resultado_busqueda.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK,274 self.grid_resultado_busquedaOnGridCellLeftDClick)275 self.grid_resultado_busqueda.Bind(wx.grid.EVT_GRID_LABEL_LEFT_DCLICK,276 self.grid_resultado_busquedaOnGridLabelLeftDClick)277 def __del__(self):278 pass279 # Virtual event handlers, overide them in your derived class280 def radioBox_areaOnRadioBox(self, event):281 area_produccion = self.radioBox_area.GetStringSelection()282 self.cargar_checkList_turno(area_produccion)283 event.Skip()284 def btn_graficarOnButtonClick(self, event):285 cant_filas = self.grid_resultado_busqueda.GetNumberRows()286 if cant_filas == 0:287 wx.MessageBox(u'No hay datos para graficar, intentalo presionando el Boton Buscar', u'Atención', wx.OK | wx.ICON_INFORMATION)288 return 0289 area = self.lbl_area.GetLabel()290 fechas = self.lbl_fechas.GetLabel()291 turnos = self.lbl_turnos.GetLabel()292 dic_valores_resumen={}293 dic_valores_detalle={}294 dic_cabecera = {'area':area, 'fechas': fechas, 'turnos': turnos}295 dic_valores ={}296 if area == 'EXTRUSION':297 list_unidades = []298 dic_valores_detalle = {}299 list_productos = []300 list_unidades = []301 for i in range(cant_filas):302 list_productos.append(self.grid_resultado_busqueda.GetCellValue(i, 1))303 list_unidades.append(int(self.grid_resultado_busqueda.GetCellValue(i, 3)))304 dic_valores_detalle = {'list_productos':list_productos, 'list_unidades':list_unidades}305 if area == 'CARGUE DE VAGONETAS':306 list_unid_resumen = []307 list_ton_resumen = []308 list_unid_resumen.append(int(self.grid_totales.GetCellValue(0, 0)))309 list_unid_resumen.append(int(self.grid_totales.GetCellValue(0, 1)))310 list_ton_resumen.append(float(self.grid_totales.GetCellValue(0, 2)))311 list_ton_resumen.append(float(self.grid_totales.GetCellValue(0, 3)))312 dic_valores_resumen = {'list_unid_resumen': list_unid_resumen, 'list_ton_resumen':list_ton_resumen}313 list_productos = []314 list_prod_ok = []315 list_prod_rotos = []316 for i in range(cant_filas):317 list_productos.append(self.grid_resultado_busqueda.GetCellValue(i, 1))318 list_prod_ok.append(int(self.grid_resultado_busqueda.GetCellValue(i, 3)))319 list_prod_rotos.append(int(self.grid_resultado_busqueda.GetCellValue(i, 4)))320 dic_valores_detalle = {'list_productos':list_productos, 'list_prod_ok':list_prod_ok, 'list_prod_rotos':list_prod_rotos}321 if area == 'DESCARGUE DE VAGONETAS':322 list_unid_resumen = []323 list_ton_resumen = []324 list_unid_resumen.append(int(self.grid_totales.GetCellValue(0, 1)))325 list_unid_resumen.append(int(self.grid_totales.GetCellValue(0, 2)))326 list_unid_resumen.append(int(self.grid_totales.GetCellValue(0, 3)))327 list_ton_resumen.append(float(self.grid_totales.GetCellValue(0, 8)))328 list_ton_resumen.append(float(self.grid_totales.GetCellValue(0, 9)))329 list_ton_resumen.append(float(self.grid_totales.GetCellValue(0, 10)))330 dic_valores_resumen = {'list_unid_resumen': list_unid_resumen, 'list_ton_resumen':list_ton_resumen}331 list_productos = []332 list_prod_primera = []333 list_prod_segunda = []334 list_prod_rotos = []335 for i in range(cant_filas):336 list_productos.append(self.grid_resultado_busqueda.GetCellValue(i, 1))337 list_prod_primera.append(int(self.grid_resultado_busqueda.GetCellValue(i, 4)))338 list_prod_segunda.append(int(self.grid_resultado_busqueda.GetCellValue(i, 5)))339 list_prod_rotos.append(int(self.grid_resultado_busqueda.GetCellValue(i, 6)))340 dic_valores_detalle = {'list_productos':list_productos, 'list_prod_primera':list_prod_primera,341 'list_prod_segunda':list_prod_segunda,342 'list_prod_rotos': list_prod_rotos343 }344 if area == 'DESPACHOS':345 list_unid_resumen = []346 list_ton_resumen = []347 list_unid_resumen.append(int(self.grid_totales.GetCellValue(0, 1)))348 list_unid_resumen.append(int(self.grid_totales.GetCellValue(0, 2)))349 list_ton_resumen.append(float(self.grid_totales.GetCellValue(0, 6)))350 list_ton_resumen.append(float(self.grid_totales.GetCellValue(0, 7)))351 dic_valores_resumen = {'list_unid_resumen': list_unid_resumen, 'list_ton_resumen':list_ton_resumen}352 list_productos = self.df['Producto']353 list_prod_primera = self.df['Primera']354 list_prod_segunda = self.df['Segunda']355 dic_valores_detalle = {'list_productos':list_productos, 'list_prod_primera':list_prod_primera,356 'list_prod_segunda':list_prod_segunda357 }358 import formEAY.formularios.frm_graficas.frm_GraficosHistorialDetalleProcesos as frm_GraficosHistorialDetalleProcesos359 frame_GraficosHistorialDetalleProcesos = frm_GraficosHistorialDetalleProcesos.GraficosHistorialDetalleProcesos(self, dic_cabecera,360 dic_valores_resumen, dic_valores_detalle)361 frame_GraficosHistorialDetalleProcesos.Center()362 frame_GraficosHistorialDetalleProcesos.Show()363 event.Skip()364 def btn_buscarOnButtonClick(self, event):365 from formEAY.utilCAC.Utiles_proposito_general import ManejoFechasHoras366 turnos = []367 for i in self.checkList_turno.GetCheckedStrings():368 turnos.append(i)369 self.lbl_turnos.SetLabel(str(turnos))370 area_produccion = self.radioBox_area.GetStringSelection()371 cad_turno = ''372 lista_turnos_sel = self.checkList_turno.GetCheckedStrings()373 fecha_inicio = ManejoFechasHoras.formatearFechaXSql(self.datePicker_fecha1)374 fecha_fin = ManejoFechasHoras.formatearFechaXSql(self.datePicker_fecha2)375 if area_produccion != 'DESPACHOS':376 if len(lista_turnos_sel) == 0 :377 wx.MessageBox(u'Debes seleccionar mínimo un Turno', u'Atención', wx.OK | wx.ICON_INFORMATION)378 return 0379 for i in lista_turnos_sel:380 el_id = self.dic_turnos_todos[i][0]381 cad_turno += str(el_id) + ','382 cad_turno = cad_turno[:-1]383 if cad_turno != '':384 cad_turno = ' and id_turno in (' + cad_turno + ' )'385 rows, cabeceras = self.buscar( area_produccion, fecha_inicio, fecha_fin, cad_turno)386 if rows == None:387 self.m_panel_resultados.Hide()388 else:389 self.lbl_area.SetLabel(area_produccion)390 cad_fecha = fecha_inicio + ' al ' + fecha_fin391 self.lbl_fechas.SetLabel(cad_fecha)392 cant_registros = str(len(rows))393 self.lbl_registrosencontrados.SetLabel(cant_registros)394 row_totales, cabeceras = self.buscarTotales(area_produccion, fecha_inicio, fecha_fin, cad_turno)395 ManipularGrillas.llenarGrilla(self.grid_totales, row_totales)396 ManipularGrillas.reemplazarValorCeldaGrilla(self.grid_totales, 'None', '0')397 self.m_panel_resultados.Show()398 if area_produccion == 'DESPACHOS':399 cad_sql ="""400 SELECT dd.id_producto, dd.producto, p.peso, 401 (sum(dd.cant_primera) + sum(dd.cant_segunda)) as total_unids,402 sum(dd.cant_primera) as primera, sum(dd.cant_segunda) as segunda,403 404 trunc((sum(dd.cant_primera)*100.0) / ((sum(dd.cant_primera) + sum(dd.cant_segunda)) ), 2) as porct_primera, 405 trunc((sum(dd.cant_segunda)*100.0) / ((sum(dd.cant_primera) + sum(dd.cant_segunda)) ), 2) as porct_segunda, 406 407 trunc((sum(dd.cant_primera * p.peso) + sum(dd.cant_segunda * p.peso)) / 1000000.0, 2) as Total_ton, 408 trunc(sum(dd.cant_primera * p.peso) / 1000000.0, 2) as ton_primera, 409 trunc(sum(dd.cant_segunda * p.peso) / 1000000.0, 2) as ton_segunda410 FROM detalle_despacho as dd, producto as p411 WHERE dd.activo = True and dd.id_producto = p.id_producto AND dd.uuid in (412 SELECT uuid413 FROM despacho_mercancia414 WHERE fecha >= '{0}' and fecha <= '{1}'415 )416 GROUP BY dd.id_producto, dd.producto, p.peso417 ORDER BY dd.producto418 """.format(fecha_inicio, fecha_fin)419 cabeceras = []420 rows = Ejecutar_SQL.select_varios_registros(cad_sql, 'frm_historial_detalle_procesos_ECD/btn_buscarOnButtonClick',421 1000, BasesDeDatos.DB_PRINCIPAL)422 if rows == None:423 self.m_panel_resultados.Hide()424 else:425 self.lbl_area.SetLabel('DESPACHOS')426 cad_fecha = fecha_inicio + ' al ' + fecha_fin427 self.lbl_fechas.SetLabel(cad_fecha)428 cant_registros = str(len(rows))429 self.lbl_registrosencontrados.SetLabel(cant_registros)430 ManipularGrillas.setCantidadColumnasGrilla(self.grid_resultado_busqueda , 11)431 list_cabeceras = ['id', 'Producto', 'Peso gr', 'Total Unidas', 'Unids Primera', 'Unids Segunda',432 '% Primera', '% Segunda',433 'Total ton', 'Ton Primera', 'Ton Segunda']434 ManipularGrillas.setCabecerasGrilla(self.grid_resultado_busqueda, list_cabeceras)435 ManipularGrillas.setCantidadColumnasGrilla(self.grid_totales, 8)436 list_cabeceras = ['Total Unids', 'Primera', 'Segunda', '% Primera', '% Segunda', 'Total Ton', 'Ton 1ra', 'Ton 2da']437 ManipularGrillas.setCabecerasGrilla(self.grid_totales, list_cabeceras)438 self.df = pd.DataFrame(rows, columns = ['id', 'Producto', 'Peso gr', 'Total Unids', 'Primera', 'Segunda',439 '% Primera', '% Segunda',440 'Total Ton', 'Ton Primera', 'Ton Segunda'])441 df_totales = self.df[['Total Unids', 'Primera', 'Segunda','% Primera', '% Segunda', 'Total Ton', 'Ton Primera', 'Ton Segunda']].sum()442 rows_resumen = []443 rows_resumen.append(df_totales.tolist())444 ManipularGrillas.llenarGrilla(self.grid_totales, rows_resumen)445 total_unids = float(self.grid_totales.GetCellValue(0,0))446 primera_unids = float(self.grid_totales.GetCellValue(0,1))447 segunda_unids = float(self.grid_totales.GetCellValue(0,2))448 porct_primera = round((primera_unids / total_unids) * 100.0, 2)449 porct_segunda = round((segunda_unids / total_unids) * 100.0, 2)450 self.grid_totales.SetCellValue(0, 3, str(porct_primera))451 self.grid_totales.SetCellValue(0, 4, str(porct_segunda))452 self.m_panel_resultados.Show()453 ManipularGrillas.llenarGrilla(self.grid_resultado_busqueda, rows)454 ManipularGrillas.reemplazarValorCeldaGrilla(self.grid_resultado_busqueda, 'None', '0')455 self.colorearGrilla()456 event.Skip()457 def grid_resultado_busquedaOnGridCellLeftDClick(self, event):458 event.Skip()459 def grid_resultado_busquedaOnGridLabelLeftDClick(self, event):460 columna = event.GetCol()461 lista_tipoColumna = []462 area = self.lbl_area.GetLabel()463 if self.orden_ascendente == True:464 self.orden_ascendente = False465 else:466 self.orden_ascendente = True467 if area == 'EXTRUSION':468 lista_tipoColumna = ['int', 'str', 'int', 'int', 'float']469 if area == 'CARGUE DE VAGONETAS':470 lista_tipoColumna = ['int', 'str', 'int', 'int', 'int', 'float', 'float', 'float']471 if area == 'DESCARGUE DE VAGONETAS':472 lista_tipoColumna = ['int', 'str', 'int', 'int', 'int', 'int', 'int', 'float', 'float', 'float', 'float', 'float', 'float']473 if area == 'DESPACHOS':474 lista_tipoColumna = ['int', 'str', 'int', 'int', 'int', 'int', 'float', 'float', 'float', 'float', 'float']475 ManipularGrillas.ordenarGrillaPorColumna(self.grid_resultado_busqueda, columna, lista_tipoColumna,476 self.orden_ascendente)477 self.colorearGrilla()478 event.Skip()479 ## FUNCIONES EAY480 def colorearGrilla(self):481 area_produccion = self.lbl_area.GetLabel()482 if area_produccion == AREA_EXTRUSION:483 dic_color = {3: COLOR_RESALTE_PRIMERA, 4: COLOR_RESALTE_SEGUNDA}484 ManipularGrillas.setColorFondoCeldaGrilla(self.grid_resultado_busqueda, dic_color)485 dic_color = {0: COLOR_RESALTE_PRIMERA, 1: COLOR_RESALTE_SEGUNDA}486 ManipularGrillas.setColorFondoCeldaGrilla(self.grid_totales, dic_color)487 if area_produccion == AREA_CARGUE_VAGONETAS:488 dic_color = {3: COLOR_RESALTE_TOTAL, 4: COLOR_RESALTE_ROTURA_CLARO,489 5: COLOR_RESALTE_TOTAL, 6: COLOR_RESALTE_ROTURA_CLARO,490 7: COLOR_RESALTE_ROTURA491 }492 ManipularGrillas.setColorFondoCeldaGrilla(self.grid_resultado_busqueda, dic_color)493 dic_color = {0: COLOR_RESALTE_TOTAL, 1: COLOR_RESALTE_ROTURA_CLARO,494 2: COLOR_RESALTE_TOTAL, 3: COLOR_RESALTE_ROTURA_CLARO,495 4: COLOR_RESALTE_ROTURA496 }497 ManipularGrillas.setColorFondoCeldaGrilla(self.grid_totales, dic_color)498 if area_produccion == AREA_DESCARGUE_VAGONETAS:499 dic_color = {3: COLOR_RESALTE_TOTAL,500 4: COLOR_RESALTE_PRIMERA, 5: COLOR_RESALTE_SEGUNDA, 6: COLOR_RESALTE_ROTURA,501 7: COLOR_RESALTE_PRIMERA, 8: COLOR_RESALTE_SEGUNDA, 9: COLOR_RESALTE_ROTURA,502 10: COLOR_RESALTE_PRIMERA, 11: COLOR_RESALTE_SEGUNDA, 12: COLOR_RESALTE_ROTURA,503 }504 ManipularGrillas.setColorFondoCeldaGrilla(self.grid_resultado_busqueda, dic_color)505 dic_color = {0: COLOR_RESALTE_TOTAL,506 1: COLOR_RESALTE_PRIMERA, 2: COLOR_RESALTE_SEGUNDA, 3: COLOR_RESALTE_ROTURA,507 4: COLOR_RESALTE_PRIMERA, 5: COLOR_RESALTE_SEGUNDA, 6: COLOR_RESALTE_ROTURA,508 7: COLOR_RESALTE_TOTAL,509 8: COLOR_RESALTE_PRIMERA, 9: COLOR_RESALTE_SEGUNDA, 10: COLOR_RESALTE_ROTURA,510 }511 ManipularGrillas.setColorFondoCeldaGrilla(self.grid_totales, dic_color)512 if area_produccion == 'DESPACHOS':513 dic_color = {3: COLOR_RESALTE_TOTAL, 4: COLOR_RESALTE_PRIMERA, 5: COLOR_RESALTE_SEGUNDA,514 8: COLOR_RESALTE_TOTAL, 9: COLOR_RESALTE_PRIMERA, 10: COLOR_RESALTE_SEGUNDA515 }516 ManipularGrillas.setColorFondoCeldaGrilla(self.grid_resultado_busqueda, dic_color)517 dic_color = {0: COLOR_RESALTE_TOTAL, 1: COLOR_RESALTE_PRIMERA, 2: COLOR_RESALTE_SEGUNDA,518 5: COLOR_RESALTE_TOTAL, 6: COLOR_RESALTE_PRIMERA, 7: COLOR_RESALTE_SEGUNDA519 }520 ManipularGrillas.setColorFondoCeldaGrilla(self.grid_totales, dic_color)521 self.Layout()522 def buscarTotales(self, area_produccion, fecha_inicio, fecha_fin, cad_turno):523 rows = []524 sSql = ''525 cabeceras = []526 if area_produccion == AREA_CARGUE_VAGONETAS:527 sSql = """528 SELECT SUM(t1.total_unidades), 529 SUM(t2.cant_rotos), 530 trunc(SUM(t1.ton_cargados), 2), 531 trunc(SUM(t2.ton_rotos),2),532 trunc(SUM((100.0 * t2.ton_rotos)) / SUM((t2.ton_rotos + t1.ton_cargados )), 2) 533 FROM 534 ( SELECT dcv.id_producto as el_id, dcv.producto as producto, sum(dcv.unidades_producto) as total_unidades,535 p.peso as peso, p.peso * sum(dcv.unidades_producto) / 1000000.0 as ton_cargados 536 FROM detalle_cargue_vagonetas as dcv, producto as p537 WHERE p.id_producto = dcv.id_producto and dcv.uuid in 538 ( 539 SELECT uuid540 FROM cabecera_proceso_ecd541 WHERE fecha_inicio >= '{0}' and fecha_inicio <= '{1}' AND area_produccion = 'CARGUE DE VAGONETAS'542 {2} and activo = True 543 )544 GROUP BY dcv.id_producto, dcv.producto, p.peso 545 ) AS t1546 FULL OUTER JOIN547 ( SELECT rcv.id_producto as el_id, rcv.producto, sum(rcv.cant_rotos) as cant_rotos,548 p.peso * sum(rcv.cant_rotos) / 1000000.0 as ton_rotos 549 FROM rotura_cargue_vagonetas as rcv, producto as p550 WHERE p.id_producto = rcv.id_producto and rcv.uuid in 551 (552 SELECT uuid553 FROM cabecera_proceso_ecd554 WHERE fecha_inicio >= '{0}' and fecha_inicio <= '{1}' AND area_produccion = 'CARGUE DE VAGONETAS'555 {2} and activo = True 556 )557 GROUP BY rcv.id_producto, rcv.producto, p.peso 558 ) AS t2 559 ON ( t1.el_id = t2.el_id) 560 561 """.format(fecha_inicio, fecha_fin, cad_turno)562 cabeceras = ['Total Unid Primera', 'Total Unids Rotura', 'Total Toneladas', 'Toneladas Rotura', '% Rotura']563 if area_produccion == AREA_DESCARGUE_VAGONETAS:564 sSql = """565 SELECT sum(de_primera) + sum(de_segunda) + sum(rotos) as total_unidades, 566 sum(de_primera) as primera, 567 sum(de_segunda) as segunda, 568 sum(rotos) as rotos,569 trunc((sum(de_primera)*100.0) / (sum(de_primera) + sum(de_segunda) + sum(rotos)), 2) as porcentaje_primera,570 trunc((sum(de_segunda)*100.0) / (sum(de_primera) + sum(de_segunda) + sum(rotos)), 2) as porcentaje_segunda,571 trunc((sum(rotos)*100.0) / (sum(de_primera) + sum(de_segunda) + sum(rotos)), 2) as porcentaje_rotura,572 trunc((sum(p.peso * de_primera) + sum(p.peso * de_segunda) + sum(p.peso * rotos)) / 1000000.0, 2) as Total_Toneladas,573 trunc(sum(p.peso * de_primera) /1000000.0, 2) as ton_primera,574 trunc(sum(p.peso * de_segunda) /1000000.0, 2) as ton_segunda,575 trunc(sum(p.peso * rotos) /1000000.0, 2) as ton_rotos576 FROM producto as p, detalle_descargue_vagonetas as ddv577 WHERE p.id_producto = ddv.id_producto and uuid in (578 SELECT uuid579 FROM cabecera_proceso_ecd580 WHERE fecha_inicio >= '{0}' and fecha_inicio <= '{1}' AND area_produccion = 'DESCARGUE DE VAGONETAS'581 {2} and activo = True 582 ) 583 """.format(fecha_inicio, fecha_fin, cad_turno)584 cabeceras = ['Total Unidades', 'Primera', 'Segunda', 'Rotura',585 '% primera', '% segunda', '% Rotura','Total Toneladas', 'Ton 1ra', 'Ton 2da', 'Ton Rotura']586 if area_produccion == AREA_EXTRUSION :587 sSql = """588 SELECT sum(total) as total_unidades,589 trunc( sum( p.peso * total / 1000000.0), 2) as ton_producto590 FROM producto as p, detalle_extrusion as de591 WHERE p.id_producto = de.id_producto and uuid in (592 SELECT uuid593 FROM cabecera_proceso_ecd594 WHERE fecha_inicio >= '{0}' and fecha_inicio <= '{1}' AND area_produccion = 'EXTRUSION'595 {2} and activo = True 596 ) 597 """.format(fecha_inicio, fecha_fin, cad_turno)598 cabeceras = ['Total Unidades', 'Total Toneladas']599 ManipularGrillas.setCantidadColumnasGrilla(self.grid_totales, len(cabeceras))600 ManipularGrillas.setCabecerasGrilla(self.grid_totales, cabeceras)601 rows = Ejecutar_SQL.select_varios_registros(sSql, 'frm_historial_procesos_ECD/buscarTotales()', 1, BasesDeDatos.DB_PRINCIPAL)602 return rows, cabeceras603 def buscar(self, area_produccion, fecha_inicio, fecha_fin, cad_turno):604 rows = []605 sSql = ''606 cabeceras = []607 if area_produccion == AREA_CARGUE_VAGONETAS:608 sSql = """609 SELECT t1.el_id, t1.producto, t1.peso, t1.total_unidades, t2.cant_rotos, 610 trunc(t1.ton_cargados, 2), 611 trunc(t2.ton_rotos, 2),612 trunc((100.0 * t2.ton_rotos) / (t2.ton_rotos + t1.ton_cargados), 2)613 614 FROM615 ( SELECT dcv.id_producto as el_id, dcv.producto as producto, sum(dcv.unidades_producto) as total_unidades,616 p.peso as peso, p.peso * sum(dcv.unidades_producto) / 1000000.0 as ton_cargados 617 FROM detalle_cargue_vagonetas as dcv, producto as p618 WHERE p.id_producto = dcv.id_producto and dcv.uuid in 619 ( 620 SELECT uuid621 FROM cabecera_proceso_ecd622 WHERE fecha_inicio >= '{0}' and fecha_inicio <= '{1}' AND area_produccion = 'CARGUE DE VAGONETAS'623 {2} and activo = True 624 )625 GROUP BY dcv.id_producto, dcv.producto, p.peso 626 ) AS t1627 FULL OUTER JOIN628 ( SELECT rcv.id_producto as el_id, rcv.producto, sum(rcv.cant_rotos) as cant_rotos,629 p.peso * sum(rcv.cant_rotos) / 1000000.0 as ton_rotos 630 FROM rotura_cargue_vagonetas as rcv, producto as p631 WHERE p.id_producto = rcv.id_producto and rcv.uuid in 632 (633 SELECT uuid634 FROM cabecera_proceso_ecd635 WHERE fecha_inicio >= '{0}' and fecha_inicio <= '{1}' AND area_produccion = 'CARGUE DE VAGONETAS'636 {2} and activo = True 637 )638 GROUP BY rcv.id_producto, rcv.producto, p.peso 639 ) AS t2 640 ON ( t1.el_id = t2.el_id) 641 """.format(fecha_inicio, fecha_fin, cad_turno)642 cabeceras = ['id Producto', 'Producto', 'Peso gramos', 'Total Unid. Primera', 'Unid. Rotura', 'Toneladas',643 'Toneladas Rotura', '% Rotura']644 if area_produccion == AREA_DESCARGUE_VAGONETAS:645 sSql = """646 SELECT p.id_producto, producto, p.peso, (sum(de_primera) + sum(de_segunda) + sum(rotos)) as total_unidades, sum(de_primera) as primera, 647 sum(de_segunda) as segunda, sum(rotos) as rotos,648 trunc((sum(de_primera)*100.0) / (sum(de_primera) + sum(de_segunda) + sum(rotos)), 2) as porcentaje_primera,649 trunc((sum(de_segunda)*100.0) / (sum(de_primera) + sum(de_segunda) + sum(rotos)), 2) as porcentaje_segunda,650 trunc((sum(rotos)*100.0) / (sum(de_primera) + sum(de_segunda) + sum(rotos)), 2) as porcentaje_rotura,651 trunc((p.peso * sum(de_primera) /1000000.0), 2) as ton_primera,652 trunc((p.peso * sum(de_segunda) /1000000.0), 2) as ton_segunda,653 trunc((p.peso * sum(rotos) /1000000.0), 2) as ton_rotos654 FROM producto as p, detalle_descargue_vagonetas as ddv655 WHERE p.id_producto = ddv.id_producto and uuid in (656 SELECT uuid657 FROM cabecera_proceso_ecd658 WHERE fecha_inicio >= '{0}' and fecha_inicio <= '{1}' AND area_produccion = 'DESCARGUE DE VAGONETAS'659 {2} and activo = True 660 )661 GROUP BY p.id_producto, producto 662 """.format(fecha_inicio, fecha_fin, cad_turno)663 cabeceras = ['id Producto', 'Producto', 'Peso gramos', 'Total Unidades', 'Primera', 'Segunda', 'Rotura',664 '% primera', '% segunda', '% Rotura', 'Ton 1ra', 'Ton 2da', 'Ton Rotura']665 if area_produccion == AREA_EXTRUSION :666 sSql = """667 SELECT p.id_producto, producto, p.peso, sum(total) as total_unidades,668 trunc(p.peso * sum(total) / 1000000.0, 2) as ton_producto669 FROM producto as p, detalle_extrusion as de670 WHERE p.id_producto = de.id_producto and uuid in (671 SELECT uuid672 FROM cabecera_proceso_ecd673 WHERE fecha_inicio >= '{0}' and fecha_inicio <= '{1}' AND area_produccion = 'EXTRUSION'674 {2} and activo = True 675 )676 GROUP BY p.id_producto, producto 677 """.format(fecha_inicio, fecha_fin, cad_turno)678 cabeceras = ['id Producto', 'Producto', 'Peso gramos','Total Unidades', 'Toneladas']679 ManipularGrillas.setCantidadColumnasGrilla(self.grid_resultado_busqueda, len(cabeceras))680 ManipularGrillas.setCabecerasGrilla(self.grid_resultado_busqueda, cabeceras)681 rows = Ejecutar_SQL.select_varios_registros(sSql, 'frm_historial_procesos_ECD/buscar()', 500, BasesDeDatos.DB_PRINCIPAL)682 return rows, cabeceras683 def cargar_checkList_turno(self, area_produccion):684 if area_produccion == 'DESPACHOS':685 self.checkList_turno.Clear()686 else:687 rows = DbGetVarios.listaTurnos(area_produccion, True)688 # id_turno, nom_turno, hora_inicio, hora_salida, activo689 if rows != None:690 la_lista = ManipularRows.crearListaValores(rows, 1)691 self.dic_turnos_todos = ManipularRows.crearDiccionarioTodosLosCampos(rows, 1)692 self.checkList_turno.Set(la_lista)693 def cargar_valores_de_inicializacion(self):694 self.set_configuaracion_grid_resultado_busqueda()695 self.puntero_fila_resultado_busqueda = ManipularGrillas.limpiarGrilla(self.grid_resultado_busqueda)696 self.cargar_checkList_turno('EXTRUSION')697 self.grid_totales.AutoSizeColumns()698 def set_configuaracion_grid_resultado_busqueda(self):699 # list_columnas = [0, 1, 2, 3, 4, 5, 6]700 # ManipularGrillas.setColumnasSoloLectura(self.grid_resultado_busqueda, list_columnas)701 self.grid_resultado_busqueda.EnableEditing(False)...

Full Screen

Full Screen

ImgServer.py

Source:ImgServer.py Github

copy

Full Screen

1#!/usr/bin/python2'''3 Original Author: Igor Maculan - n3wtron@gmail.com4 A Simple mjpg stream http server5 Added commnand server for UMSS project DroneSimon6'''7import threading8import cv29from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer10import StringIO11import time12import VisualFilters13import Reconocedor_Fuego_Humo14from PIL import Image15capture=None16mode = 017class CommandHandler(BaseHTTPRequestHandler):18 def do_GET(self):19 global mode20 print self.path21 cmd = self.path22 self.send_response(200)23 if cmd == "/?cmd=0" :24 mode = VisualFilters.NADA25 if cmd == "/?cmd=1" :26 mode = VisualFilters.RESALTAR_CUERPOS27 elif cmd == "/?cmd=2" :28 mode = VisualFilters.RESALTAR_HUMO29 elif cmd == "/?cmd=3" :30 mode = VisualFilters.RESALTAR_FUEGO31 elif cmd == "/?cmd=4" :32 mode = VisualFilters.RESALTAR_BORDES33 elif cmd == "/?cmd=5" :34 mode = VisualFilters.RESALTAR_LINEAS_RECTAS35 elif cmd == "/?cmd=6" :36 mode = VisualFilters.RESALTAR_AZUL37 elif cmd == "/?cmd=7" :38 mode = VisualFilters.RESALTAR_ROJO39 elif cmd == "/?cmd=8" :40 mode = VisualFilters.RESALTAR_VERDE41 elif cmd == "/?cmd=9" :42 mode = VisualFilters.RESALTAR_BLANCO43 elif cmd == "/?cmd=10" :44 mode = VisualFilters.DETECTAR_MOVIMIENTO45 elif cmd == "/?cmd=11" :46 mode = VisualFilters.RESALTAR_COLORES_FUEGO47class CamHandler(BaseHTTPRequestHandler):48 def do_GET(self):49 if self.path.endswith('.mjpg'):50 self.send_response(200)51 self.send_header('Content-type','multipart/x-mixed-replace; boundary=--jpgboundary')52 self.end_headers()53 while True:54 try:55 rc,img = capture.read()56 if not rc:57 continue58 if mode == VisualFilters.RESALTAR_COLORES_FUEGO :59 img = VisualFilters.aumentarIntensidadPorRangoDeColor(img, 0, 18, 105, 255, 183, 255)60 if mode == VisualFilters.RESALTAR_BORDES:61 img = VisualFilters.encontrarBordesCanny(img)62 if mode == VisualFilters.DETECTAR_MOVIMIENTO:63 img = VisualFilters.detectarMovimiento(img)64 if mode == VisualFilters.RESALTAR_LINEAS_RECTAS:65 img = VisualFilters.marcarRectas(img)66 if mode == VisualFilters.RESALTAR_HUMO:67 img, porc = Reconocedor_Fuego_Humo.detectar_humo(img)68 if mode == VisualFilters.RESALTAR_FUEGO:69 img, porc = Reconocedor_Fuego_Humo.detectar_fuego(img)70 if mode == VisualFilters.RESALTAR_AZUL:71 img = VisualFilters.resalteColor(img, VisualFilters.PARAMETRO_AZUL)72 if mode == VisualFilters.RESALTAR_ROJO:73 img = VisualFilters.resalteColor(img, VisualFilters.PARAMETRO_ROJO)74 if mode == VisualFilters.RESALTAR_VERDE:75 img = VisualFilters.resalteColor(img, VisualFilters.PARAMETRO_VERDE)76 if mode == VisualFilters.RESALTAR_BLANCO:77 img = VisualFilters.resalteColor(img, VisualFilters.PARAMETRO_BLANCO)78 imgRGB=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)79 jpg = Image.fromarray(imgRGB)80 tmpFile = StringIO.StringIO()81 jpg.save(tmpFile,'JPEG')82 self.wfile.write("--jpgboundary")83 self.send_header('Content-type','image/jpeg')84 self.send_header('Content-length',str(tmpFile.len))85 self.send_header('Date', str(11-11-1111))86 self.send_header('mime-type', "image/jpeg")87 self.end_headers()88 jpg.save(self.wfile,'JPEG')89 time.sleep(0.05)90 except KeyboardInterrupt:91 break92 return93 if self.path.endswith('.html'):94 self.send_response(200)95 self.send_header('Content-type','text/html')96 self.end_headers()97 self.wfile.write('<html><head></head><body>')98 self.wfile.write('<img src="http://127.0.0.1:8080/stream.mjpg"/>')99 self.wfile.write('</body></html>')100 return101class CommandThread ( threading.Thread ):102 def run ( self ):103 server = HTTPServer(('',8081), CommandHandler)104 print "command server started"105 server.serve_forever()106def main():107 global capture108 capture = cv2.VideoCapture(0)109 capture.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, 320);110 capture.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, 240);111# capture.set(cv2.cv.CV_CAP_PROP_SATURATION,0.2);112 global img113 try:114 cmdserver = CommandThread()115 cmdserver.start()116 server = HTTPServer(('',8080),CamHandler)117 print "streaming server started"118 server.serve_forever()119 except KeyboardInterrupt:120 capture.release()121 server.socket.close()122if __name__ == '__main__':...

Full Screen

Full Screen

coloresCAC.py

Source:coloresCAC.py Github

copy

Full Screen

1import wx2class Colors_botones():3 ACEPTAR = wx.Colour(112, 186, 101) #110, 180, 66)4 ELIMINAR = wx.Colour(240, 73, 80) #238,89,945 AGREGAR_A_LISTA = wx.Colour(254, 230, 90)6class ColorsFondoCellGrilla():7 ## amarillos8 RESALTE_1 = wx.Colour(255, 255, 90)9 RESALTE_2 = wx.Colour(255, 255, 120)10 RESALTE_3 = wx.Colour(255, 255, 150)11 RESALTE_4 = wx.Colour(255, 255, 180)12 RESALTE_5 = wx.Colour(255, 255, 210)13 RESALTE_ROSA = wx.Colour(255, 217, 230)14 RESALTE_ROSA2 = wx.Colour(255, 235, 235)15 RESALTE_AGUAMARINA = wx.Colour(208, 255, 248)16ubuntu=wx.Colour(179, 72, 168)17amarillo_claro=wx.Colour(255,255,176)18moradito=wx.Colour(192, 158, 192)19blanco=wx.WHITE20rojo=wx.RED21azul=wx.BLUE22azulMar=wx.Colour(0, 138, 255)23gris10=wx.Colour(220, 220, 220)24gris20=wx.Colour(203, 203, 203)25gris30=wx.Colour(182, 182, 182)26gris40=wx.Colour(161, 161, 161)27gris50=wx.Colour(140, 140, 140)28gris60=wx.Colour(119, 119, 119)29gris70=wx.Colour(98, 98, 98)30gris80=wx.Colour(77, 77, 77)31gris90=wx.Colour(56, 56, 56)32negro=wx.Colour(0,0,0)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeleniumBase automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful