forked from auzanmuh/vehicle_detection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_main_init.py
executable file
·674 lines (530 loc) · 23.4 KB
/
_main_init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
import time
import psutil
import _capture_init as cap_init
from PyQt4 import uic
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from _help_init import HelpInit
from _preview_init import PreviewInit
from _coordinate_init import GetCoordinate
# Interface Load
main_ui = uic.loadUiType("gtk/main.ui")[0]
class MainInit(QMainWindow, main_ui):
def __init__(self, parent=None):
# Initialization main interface from QT to Python
QMainWindow.__init__(self, parent)
# Variable
self.setupUi(self)
self.capture = None
self.fileLoc = 0
port_cam = ["0", "1", "2"]
# Configuration [Open Setting and Save Setting]
self.pushButton_openSetting.clicked.connect(self.openConfigFile)
self.pushButton_saveSetting.clicked.connect(self.saveConfigFile)
# 1. Setting
self.tabWidget.setCurrentIndex(0)
self.tabWidget.setTabEnabled(1, False)
self.tabWidget.setTabEnabled(2, True)
# 1.1. VideoInput
self.radioButton_choseDevice.setChecked(True)
self.radioButton_choseFile.setChecked(False)
self.checkBox_saveOutput.setChecked(False)
self.radioButton_choseFile.toggled.connect(self.selectFile)
self.radioButton_choseDevice.toggled.connect(self.selectDevice)
self.comboBox_choseDevice.setEnabled(True)
self.comboBox_choseDevice.addItems(port_cam)
self.comboBox_choseDevice.currentIndexChanged.connect(self.selectionDevice)
self.label_selectFile.setText('')
self.pushButton_selectFile.setVisible(False)
self.pushButton_selectFile.setEnabled(False)
self.pushButton_selectFile.clicked.connect(self.selectVideoFile)
# 1.2. VideoMode
self.radioButton_rgbVM.setChecked(True)
self.radioButton_binVM.setChecked(False)
self.checkBox_showboundaryVM.setChecked(False)
self.checkBox_showroiVM.setChecked(False)
self.checkBox_shadowRemoval.setChecked(False)
self.radioButton_binVM.toggled.connect(self.selectBinary)
# 1.3 Background Subtraction
self.radioButton_BsMA.setChecked(True)
self.radioButton_BsMOG.setChecked(False)
# 1.4 Data Input
# 1.4.1 Camera
sensorType = ["Nikon APS-C", "1/3.2'"]
croppingFactor = ["1.56 x", "2.0 x"]
self.setAlt(7.4)
self.setElevated(72)
self.setFps(30)
self.setFocal(18)
self.comboBox_sensor.addItems(sensorType)
self.comboBox_sensor.setCurrentIndex(0)
self.comboBox_sensor.currentIndexChanged.connect(self.getSensoryType)
self.comboBox_croppingFactor.setEnabled(True)
self.comboBox_croppingFactor.addItems(croppingFactor)
self.comboBox_croppingFactor.setCurrentIndex(0)
self.comboBox_croppingFactor.currentIndexChanged.connect(self.getCroppingFactor)
# 1.4.2 Vehicle Input
# 1.4.2.1 Light Vehicle
self.setLengthLV(6.2)
self.setWidthLV(2.1)
self.setHighLV(1.6)
# 1.4.2.1 Heavy Vehicle
self.setLengthHV(18)
self.setWidthHV(2.5)
self.setHighHV(3.2)
# 1.4.3 Registration and Detection Line
self.pushButton_preview.clicked.connect(self.previewVideo)
self.pushButton_calculate.clicked.connect(self.calculateCoordinate)
# 1.4.3.1 Detection Line
self.setDetectionLine("480", "122", "635", "122")
# 1.4.3.2 Registration Line
self.setRegistrationLine("365", "424", "772", "424")
# 1.5 Button Help and Set
self.pushButton_helpSetting.clicked.connect(self.helpSetting)
self.pushButton_setSetting.clicked.connect(self.setSetting)
# 2. Video
# 2.1 Video Player
self.pushButton_startVideo.clicked.connect(self.startVideo)
self.pushButton_showLog.setVisible(False)
self.pushButton_showLog.clicked.connect(self.showLog)
# 2.2 Capture
self.startThread()
self.startCountFrame()
# Count
self.setTotalLV(0)
self.setTotalHV(0)
self.setFrameCount(0)
self.setRealFPS(0)
# 3. Log
# 3.1 Search
self.dateEdit_fromDate.setDateTime(QDateTime.currentDateTime())
self.dateEdit_fromDate.setCalendarPopup(True)
self.dateEdit_untilDate.setDateTime(QDateTime.currentDateTime())
self.dateEdit_untilDate.setCalendarPopup(True)
self.pushButton_searchLog.clicked.connect(self.searchLog)
self.pushButton_clearLog.clicked.connect(self.clearLog)
# 3.2 View Log
# self.tableView_searchLog()
self.setLogCountLV("0")
self.setLogCountHV("0")
# Set Variable
def setAlt(self, value):
self.lineEdit_altitudeCam.setText(format(value))
def getAlt(self):
return self.lineEdit_altitudeCam.text()
def setElevated(self, value):
self.lineEdit_elevatedCam.setText(format(value))
def getElevated(self):
return self.lineEdit_elevatedCam.text()
def setFps(self, value):
self.lineEdit_fps.setText(format(value))
def getFps(self):
return self.lineEdit_fps.text()
def setFocal(self, value):
self.lineEdit_focalCam.setText(format(value))
def getFocal(self):
return self.lineEdit_focalCam.text()
def setCurrentIndexSensorType(self, value):
self.comboBox_sensor.setCurrentIndex(int(value))
def getCurrentIndexSensorType(self):
return self.comboBox_sensor.currentIndex()
def setLengthLV(self, value):
self.lineEdit_pLV.setText(format(value))
def getLengthLV(self):
return self.lineEdit_pLV.text()
def setWidthLV(self, value):
self.lineEdit_lLV.setText(format(value))
def getWidthLV(self):
return self.lineEdit_lLV.text()
def setHighLV(self, value):
self.lineEdit_tLV.setText(format(value))
def getHighLV(self):
return self.lineEdit_tLV.text()
def setLengthHV(self, value):
self.lineEdit_pHV.setText(format(value))
def getLengthHV(self):
return self.lineEdit_pHV.text()
def setWidthHV(self, value):
self.lineEdit_lHV.setText(format(value))
def getWidthHV(self):
return self.lineEdit_lHV.text()
def setHighHV(self, value):
self.lineEdit_tHV.setText(format(value))
def getHighHV(self):
return self.lineEdit_tHV.text()
def setTotalLV(self, value):
self.label_countShortVehicle.setText(format(value))
def setTotalHV(self, value):
self.label_countLongVehicle.setText(format(value))
def setDetectionLine(self, x1, y1, x2, y2):
self.lineEdit_detectX1.setText(format(x1))
self.lineEdit_detectY1.setText(format(y1))
self.lineEdit_detectX2.setText(format(x2))
self.lineEdit_detectY2.setText(format(y2))
def getDetectLine(self):
detectX1 = self.lineEdit_detectX1.text()
detectY1 = self.lineEdit_detectY1.text()
detectX2 = self.lineEdit_detectX2.text()
detectY2 = self.lineEdit_detectY2.text()
return detectX1, detectY1, detectX2, detectY2
def setRegistrationLine(self, x1, y1, x2, y2):
self.lineEdit_registX1.setText(format(x1))
self.lineEdit_registY1.setText(format(y1))
self.lineEdit_registX2.setText(format(x2))
self.lineEdit_registY2.setText(format(y2))
def getRegistrationLine(self):
registX1 = self.lineEdit_registX1.text()
registY1 = self.lineEdit_registY1.text()
registX2 = self.lineEdit_registX2.text()
registY2 = self.lineEdit_registY2.text()
return registX1, registY1, registX2, registY2
def setFrameCount(self, value):
self.label_frameCount.setText(": {0}".format(value))
def setLogCountLV(self, value):
self.label_logcountShortVehicle.setText(value)
def setLogCountHV(self, value):
self.label_logcountLongVehicle.setText(value)
def setRealFPS(self, value):
self.label_realFPS.setText(": {0}".format(value))
def setCPUProcess(self):
value = psutil.cpu_percent()
self.progressBar_cpuPercentage.setValue(value)
# Get Variable
def getVideoMode(self):
if self.radioButton_rgbVM.isChecked():
video_mode = "RGB"
elif self.radioButton_binVM.isChecked():
video_mode = "BIN"
return video_mode
def getSensoryType(self):
select = self.comboBox_choseDevice.currentIndex()
if select == 0:
sensorHeight = 15.4
sensorWidth = 23.1
else:
sensorHeight = 0
sensorWidth = 0
return sensorHeight, sensorWidth
def getCroppingFactor(self):
select = self.comboBox_croppingFactor.currentIndex()
if select == 0:
croppingFactor = 1.56
elif select == 1:
croppingFactor = 2.0
else:
croppingFactor = 0
return croppingFactor
def getSavingOutput(self):
return self.checkBox_saveOutput.isChecked()
def getBoundary(self):
return self.checkBox_showboundaryVM.isChecked()
def getRoi(self):
return self.checkBox_showroiVM.isChecked()
def getShadowRemoval(self):
return self.checkBox_shadowRemoval.isChecked()
def getBackgroundSubtraction(self):
if self.radioButton_BsMOG.isChecked():
background_subtraction = "MOG"
elif self.radioButton_BsMA.isChecked():
background_subtraction = "MA"
return background_subtraction
def getTotalVehicleFromVideo(self):
if self.capture:
totalLV = self.capture.getTotalLV()
totalHV = self.capture.getTotalHV()
self.setTotalLV(totalLV)
self.setTotalHV(totalHV)
def getFrameCountFromVideo(self):
if self.capture:
frame = self.capture.getFrameCount()
self.setFrameCount(frame)
def getRealFPSFromVideo(self):
if self.capture:
timeEnd = self.capture.timeEndFrame()
realFps = round(1.0 / timeEnd, 2)
self.setRealFPS(realFps)
def startThread(self):
self.timerThread = QTimer()
self.timerThread.timeout.connect(self.setCPUProcess)
self.timerThread.timeout.connect(self.getTotalVehicleFromVideo)
self.timerThread.timeout.connect(self.getRealFPSFromVideo)
self.timerThread.start(800)
def startCountFrame(self):
self.timerFrame = QTimer()
fps = int(self.getFps())
self.timerFrame.timeout.connect(self.getFrameCountFromVideo)
self.timerFrame.start(1000. / fps)
# Function Menu Bar
# Menu File
def openConfigFile(self):
openConfigFilename = QFileDialog.getOpenFileName(self, "Open config file", 'conf', "*.conf", None)
if openConfigFilename:
parsing = open(openConfigFilename, "r").read()
split = parsing.split(" ")
altitude, elevated, fps, focal = split[0], split[1], split[2], split[3]
length_LV, width_LV, high_LV = split[4], split[5], split[6]
length_HV, width_HV, high_HV = split[7], split[8], split[9]
detectX1, detectY1, detectX2, detectY2 = split[10], split[11], split[12], split[13]
registX1, registY1, registX2, registY2 = split[14], split[14], split[15], split[17]
if focal != "0":
self.radioButton_focalLength.setChecked(True)
else:
self.radioButton_fieldofview.setChecked(True)
# 1.4.1 Camera
self.setAlt(altitude)
self.setElevated(elevated)
self.setFps(fps)
self.setFocal(focal)
# 1.4.2 Vehicle Input
# 1.4.2.1 Light Vehicle
self.setLengthLV(length_LV)
self.setWidthLV(width_LV)
self.setHighLV(high_LV)
# 1.4.2.1 Heavy Vehicle
self.setLengthHV(length_HV)
self.setWidthHV(width_HV)
self.setHighHV(high_HV)
# 1.4.3 Registration and Detection Line
# 1.4.3.1 Detection Line
self.setDetectionLine(detectX1, detectY1, detectX2, detectY2)
# 1.4.3.2 Registration Line
self.setRegistrationLine(registX1, registY1, registX2, registY2)
print "Success open file config"
def saveConfigFile(self):
saveConfigFilename = QFileDialog.getSaveFileName(self, "Save config file", 'conf', "*.conf", None)
if saveConfigFilename:
saveFile = open("{0}.conf".format(saveConfigFilename), "a")
# Camera
alt = self.getAlt()
elevated = self.getElevated()
fps = self.getFps()
focal = self.getFocal()
# Light vehicle dimension
length_LV = self.getLengthLV()
width_LV = self.getWidthLV()
high_LV = self.getHighLV()
# Heavy vehicle dimension
length_HV = self.getLengthHV()
width_HV = self.getWidthHV()
high_HV = self.getHighHV()
# Registration and detection line
detectX1, detectY1, detectX2, detectY2 = self.getDetectLine()
registX1, registY1, registX2, registY2 = self.getRegistrationLine()
saveFile.write(
"{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15} {16} {17}".format(
alt, elevated, fps, focal, length_LV, width_LV, high_LV, length_HV, width_HV,
high_HV,
detectX1, detectY1, detectX2, detectY2, registX1, registY1, registX2, registY2
))
saveFile.flush()
saveFile.close()
print "Success saving config"
# Function Tab 1. Setting
def selectVideoFile(self):
file_filter = "Movie (*.mp4 *.avi *.mkv *.MOV)"
videoFilename = QFileDialog.getOpenFileName(self, "Open video file", 'samples', file_filter, None,
QFileDialog.DontUseNativeDialog)
if videoFilename:
print "file yg di select {0}".format(videoFilename)
self.label_selectFile.setText(format(videoFilename))
self.fileLoc = format(videoFilename)
return self.fileLoc
def selectionDevice(self):
select = self.comboBox_choseDevice.currentText()
print "Current index selection ", select
self.fileLoc = int(select)
return self.fileLoc
def selectFile(self, enabled):
if enabled:
self.pushButton_selectFile.setEnabled(True)
self.selectVideoFile()
self.pushButton_selectFile.setVisible(True)
else:
self.pushButton_selectFile.setEnabled(False)
def selectBinary(self, enabled):
if enabled:
self.checkBox_showboundaryVM.setChecked(False)
self.checkBox_showroiVM.setChecked(False)
self.checkBox_showboundaryVM.setEnabled(False)
self.checkBox_showroiVM.setEnabled(False)
else:
self.checkBox_showboundaryVM.setEnabled(True)
self.checkBox_showroiVM.setEnabled(True)
def selectDevice(self, enabled):
if enabled:
self.comboBox_choseDevice.setEnabled(True)
self.fileLoc = 0
else:
self.comboBox_choseDevice.setEnabled(False)
def setSetting(self):
# Get video mode
video_mode = self.getVideoMode()
savingOutput = self.getSavingOutput()
boundary = self.getBoundary()
roi = self.getRoi()
shadow = self.getShadowRemoval()
# Get background subtraction
background_subtraction = self.getBackgroundSubtraction()
# Camera
alt = float(self.getAlt())
elevated = float(self.getElevated())
fps = float(self.getFps())
sensorHeight, sensorWidth = self.getSensoryType()
croppingFactor = self.getCroppingFactor()
focal = float(self.getFocal())
# Light vehicle dimension
length_LV = float(self.getLengthLV())
width_LV = float(self.getWidthLV())
high_LV = float(self.getHighLV())
# Heavy vehicle dimension
length_HV = float(self.getLengthHV())
width_HV = float(self.getWidthHV())
high_HV = float(self.getHighHV())
# Registration and detection line
detectX1, detectY1, detectX2, detectY2 = self.getDetectLine()
registX1, registY1, registX2, registY2 = self.getRegistrationLine()
print "Camera Input"
print "video input: {0}".format(self.fileLoc)
print "video mode: {0}".format(video_mode)
print "saving output: {0}".format(savingOutput)
print "background subtraction: {0}".format(background_subtraction)
print "boundary: {0} | roi: {1} | shadow removal: {2}".format(boundary, roi, shadow)
print "sensor height: {0} | sensor width: {1} | cropping factor: {2} ".format(sensorHeight, sensorWidth, croppingFactor)
print "alt: {0} | elevated: {1} | fps: {2} | focal:{3}".format(alt, elevated, fps, focal)
print "Vehicle Input"
print "LV >> length: {0} | width: {1} | high: {2}".format(length_LV, width_LV, high_LV)
print "HV >> length: {0} | width: {1} | high: {2}".format(length_HV, width_HV, high_HV)
print "Registration and Detection Line"
print "Detection Line >> ({0},{1}) | ({2},{3})".format(detectX1, detectY1, detectX2, detectY2)
print "Registration Line >> ({0},{1}) | ({2},{3})".format(registX1, registY1, registX2, registY2)
time.sleep(1)
self.tabWidget.setTabEnabled(1, True)
self.tabWidget.setCurrentIndex(1)
def helpSetting(self):
title = "Panduan Singkat"
filename = "conf/help.txt"
print "Open new popup help"
self.help_win = HelpInit(title, filename, None)
self.help_win.show()
def previewVideo(self):
self.preview = PreviewInit(self.fileLoc)
self.preview.start()
self.preview.show()
def calculateCoordinate(self):
# Variable
altitude = float(self.getAlt())
focal = float(self.getFocal())
theta = int(self.getElevated())
# Set threshold distance for registration and detection line
distanceRegistrationLine = 1.5
distanceDetectionLine = 2 * float(self.getLengthHV())
self.getCoordinate = GetCoordinate(altitude, focal, theta)
OB = self.getCoordinate.getDistanceOB()
# Get distance Lreg and Ldet
Lreg = OB + distanceRegistrationLine
Ldet = OB + distanceRegistrationLine + distanceDetectionLine
# Get coordinate Yreg and Ydet
Yreg = int(self.getCoordinate.getCoordinate(Lreg))
Ydet = int(self.getCoordinate.getCoordinate(Ldet))
# Set to variable detection line and registration line
detectX1, detectY1, detectX2, detectY2 = self.getDetectLine()
registX1, registY1, registX2, registY2 = self.getRegistrationLine()
self.setRegistrationLine(registX1, Yreg, registX2, Yreg)
self.setDetectionLine(detectX1, Ydet, detectX2, Ydet)
print "registration line distance: {0} | detection line distance: {1}".format(distanceRegistrationLine, distanceDetectionLine)
print "distance |OB|: {0}".format(OB)
print "distance Lreg: {0} | distance Ldet :{1}".format(Lreg, Ldet)
print "Coordinate Yreg: {0} | Ydet: {1}".format(Yreg, Ydet)
# Function Tab 2. Video
def startVideo(self):
# Get video mode
video_mode = self.getVideoMode()
savingOutput = self.getSavingOutput()
boundary = self.getBoundary()
roi = self.getRoi()
shadow = self.getShadowRemoval()
# Get background subtraction
background_subtraction = self.getBackgroundSubtraction()
# Camera
alt = float(self.getAlt())
elevated = int(self.getElevated())
fps = float(self.getFps())
sensorHeight, sensorWidth = self.getSensoryType()
croppingFactor = self.getCroppingFactor()
focal = float(self.getFocal())
# Light vehicle dimension
length_LV = float(self.getLengthLV())
width_LV = float(self.getWidthLV())
high_LV = float(self.getHighLV())
# Heavy vehicle dimension
length_HV = float(self.getLengthHV())
width_HV = float(self.getWidthHV())
high_HV = float(self.getHighHV())
# Registration and detection line
detectX1, detectY1, detectX2, detectY2 = self.getDetectLine()
registX1, registY1, registX2, registY2 = self.getRegistrationLine()
self.tabWidget.setTabEnabled(0, True)
self.tabWidget.setTabEnabled(1, True)
self.tabWidget.setCurrentIndex(1)
time.sleep(1)
if not self.capture:
self.capture = cap_init.QtCapture(self.fileLoc, self.video_frame)
self.pushButton_pauseVideo.clicked.connect(self.capture.stop)
self.pushButton_stopVideo.clicked.connect(self.stopVideo)
self.tabWidget.setTabEnabled(2, False)
self.capture.setVideoMode(video_mode)
self.capture.setVideoOutput(savingOutput)
self.capture.setBackgroundSubtraction(background_subtraction)
self.capture.setROI(roi)
self.capture.setBoundary(boundary)
self.capture.setShadow(shadow)
self.capture.setFPS(fps)
self.capture.setAlt(alt)
self.capture.setElevated(elevated)
self.capture.setFocal(focal)
self.capture.setSensorSize(sensorHeight, sensorWidth)
self.capture.setCroppingFactor(croppingFactor)
self.capture.setLengthLV(length_LV)
self.capture.setWidthLV(width_LV)
self.capture.setHighLV(high_LV)
self.capture.setLengthHV(length_HV)
self.capture.setWidthHV(width_HV)
self.capture.setHighHV(high_HV)
self.capture.setDetectionLine(detectX1, detectY1, detectX2, detectY2)
self.capture.setRegistrationLine(registX1, registY1, registX2, registY2)
self.capture.start()
def stopVideo(self):
if self.capture:
self.capture.stop()
time.sleep(0.1)
self.capture.deleteLater()
self.capture = None
self.tabWidget.setTabEnabled(0, True)
self.pushButton_showLog.setVisible(True)
def showLog(self):
time.sleep(1)
self.tabWidget.setTabEnabled(2, True)
self.tabWidget.setCurrentIndex(2)
# Function Tab 3. Log
def searchLog(self):
hLabel = ["No", "Date", "Time", "Type", "Speed", "Picture"]
row = 4
column = 6
fromDate = self.dateEdit_untilDate.date().toPyDate()
untilDate = self.dateEdit_untilDate.date().toPyDate()
self.tableWidget_searchLog.setRowCount(row)
self.tableWidget_searchLog.setColumnCount(column)
self.tableWidget_searchLog.setHorizontalHeaderLabels(hLabel)
self.tableWidget_searchLog.setItem(0, 0, QTableWidgetItem("Item (0,0)"))
self.tableWidget_searchLog.setItem(0, 1, QTableWidgetItem("Item (3,0)"))
self.tableWidget_searchLog.setItem(2, 3, QTableWidgetItem("Item (1,0)"))
print "mulai dari tanggal {0}".format(fromDate)
print "hingga tanggal {0}".format(untilDate)
self.label_logcountShortVehicle.setText("20")
self.label_logcountLongVehicle.setText("100")
def clearLog(self):
self.tableWidget_searchLog.clear()
hLabel = ["No", "Date", "Time", "Type", "Speed", "Picture"]
self.tableWidget_searchLog.setHorizontalHeaderLabels(hLabel)
self.label_logcountShortVehicle.setText("0")
self.label_logcountLongVehicle.setText("0")