개정판 f18045e5
issue #655:
- modified pyqtgraph chart
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
328 | 328 |
except Exception as ex: |
329 | 329 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
330 | 330 |
self.addMessage.emit(MessageType.Error, message) |
331 |
|
|
332 |
return |
|
333 | 331 |
|
334 | 332 |
''' |
335 | 333 |
@brief show unknownitem's count |
DTI_PID/DTI_PID/TrainingImageListDialog.py | ||
---|---|---|
524 | 524 |
|
525 | 525 |
categoriesDict = [list(zip(range(len(categories)), categories))] |
526 | 526 |
|
527 |
win = pg.PlotWidget(background = 'w', title = 'Trained Characters') |
|
528 |
win.setMouseEnabled(False, False) |
|
529 |
#plot = pg.plot(range(len(categories)), barList, title = 'Trained Characters', pen = 'b') |
|
530 |
plot = pg.BarGraphItem(x = range(len(categories)), height = barList, width = 0.6, brush = 'b') |
|
531 |
win.addItem(plot) |
|
532 |
#win.resize(self.ui.splitter.widget(0).width(), 110) |
|
533 |
xax = win.getAxis('bottom') |
|
534 |
yax = win.getAxis('left') |
|
535 |
xax.setPen('k') |
|
536 |
yax.setPen('k') |
|
537 |
xax.setTicks(categoriesDict) |
|
538 |
win.showGrid(x = True, y = True) |
|
539 |
|
|
540 |
if self.ui.splitter.replaceWidget(1, win) is None: |
|
541 |
self.ui.splitter.addWidget(win) |
|
542 |
#self.ui.splitter.widget(1).resize(self.ui.splitter.widget(1).width(), 200) |
|
527 |
if not hasattr(self, '_winChart'): |
|
528 |
self._winChart = pg.PlotWidget(background = 'w', title = 'Trained Characters') |
|
529 |
self._winChart.setMouseEnabled(False, False) |
|
530 |
plot = pg.BarGraphItem(x = range(len(categories)), height = barList, width = 0.6, brush = 'b') |
|
531 |
self._winChart.addItem(plot) |
|
532 |
xax = self._winChart.getAxis('bottom') |
|
533 |
yax = self._winChart.getAxis('left') |
|
534 |
xax.setPen('k') |
|
535 |
yax.setPen('k') |
|
536 |
xax.setTicks(categoriesDict) |
|
537 |
self._winChart.showGrid(x = True, y = True) |
|
538 |
|
|
539 |
self.ui.horizontalLayoutChart.addWidget(self._winChart) |
|
540 |
else: |
|
541 |
self._winChart.removeItem(self._winChart.currentItem) |
|
542 |
|
|
543 |
plot = pg.BarGraphItem(x = range(len(categories)), height = barList, width = 0.6, brush = 'b') |
|
544 |
xax = self._winChart.getAxis('bottom') |
|
545 |
yax = self._winChart.getAxis('left') |
|
546 |
xax.setPen('k') |
|
547 |
yax.setPen('k') |
|
548 |
xax.setTicks(categoriesDict) |
|
549 |
self._winChart.showGrid(x = True, y = True) |
|
543 | 550 |
except Exception as ex: |
544 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
545 | 551 |
from App import App |
546 | 552 |
from AppDocData import MessageType |
547 | 553 |
|
548 | 554 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
549 | 555 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
550 |
''' |
|
551 |
barList = [] |
|
552 |
categories = [] |
|
553 |
chart = QChart() |
|
554 |
bar = QBarSet('char') |
|
555 |
axis = QBarCategoryAxis() |
|
556 |
series = QBarSeries() |
|
557 |
for char in self.charList: |
|
558 |
categories.append(char[0]) |
|
559 |
barList.append(char[1]) |
|
560 |
bar.append(barList) |
|
561 |
series.append(bar) |
|
562 |
chart.addSeries(series) |
|
563 |
axis.append(categories) |
|
564 |
|
|
565 |
chart.setTitle('Trained Characters') |
|
566 |
chart.createDefaultAxes() |
|
567 |
chart.setAxisX(axis, series) |
|
568 |
chart.legend().setAlignment(Qt.AlignBottom) |
|
569 |
|
|
570 |
chartView = QChartView(chart) |
|
571 |
#chartView.setMinimumHeight(500) |
|
572 |
if self.ui.splitter.replaceWidget(1, chartView) is None: |
|
573 |
self.ui.splitter.addWidget(chartView) |
|
574 |
self.ui.splitter.widget(1).resize(self.ui.splitter.widget(1).width(), 110) |
|
575 |
''' |
|
576 | 556 |
|
577 | 557 |
''' |
578 | 558 |
@brief delete Mid Process File |
... | ... | |
592 | 572 |
if os.path.isfile(os.path.join(dataPath, self.oCRLang + '.unicharset')): |
593 | 573 |
os.remove(os.path.join(dataPath, self.oCRLang + '.unicharset')) |
594 | 574 |
except Exception as ex: |
595 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
596 | 575 |
from App import App |
597 | 576 |
from AppDocData import MessageType |
598 | 577 |
|
DTI_PID/DTI_PID/TrainingImageList_UI.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
|
3 |
# Form implementation generated from reading ui file './UI/TrainingImageList.ui'
|
|
3 |
# Form implementation generated from reading ui file '.\UI\TrainingImageList.ui'
|
|
4 | 4 |
# |
5 | 5 |
# Created by: PyQt5 UI code generator 5.11.3 |
6 | 6 |
# |
... | ... | |
110 | 110 |
self.splitter.setOrientation(QtCore.Qt.Vertical) |
111 | 111 |
self.splitter.setObjectName("splitter") |
112 | 112 |
self.tableWidgetList = QtWidgets.QTableWidget(self.splitter) |
113 |
self.tableWidgetList.setMinimumSize(QtCore.QSize(0, 400)) |
|
113 | 114 |
self.tableWidgetList.setColumnCount(1) |
114 | 115 |
self.tableWidgetList.setObjectName("tableWidgetList") |
115 | 116 |
self.tableWidgetList.setRowCount(0) |
116 | 117 |
self.tableWidgetList.horizontalHeader().setSortIndicatorShown(True) |
117 | 118 |
self.tableWidgetList.verticalHeader().setVisible(False) |
119 |
self.horizontalLayoutWidget = QtWidgets.QWidget(self.splitter) |
|
120 |
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") |
|
121 |
self.horizontalLayoutChart = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget) |
|
122 |
self.horizontalLayoutChart.setContentsMargins(0, 0, 0, 0) |
|
123 |
self.horizontalLayoutChart.setObjectName("horizontalLayoutChart") |
|
118 | 124 |
self.gridLayout.addWidget(self.splitter, 2, 0, 1, 1) |
119 | 125 |
|
120 | 126 |
self.retranslateUi(TraingingImageListDialog) |
DTI_PID/DTI_PID/UI/Configuration_Area.ui | ||
---|---|---|
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 | 9 |
<width>598</width> |
10 |
<height>544</height>
|
|
10 |
<height>750</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="font"> |
... | ... | |
349 | 349 |
</layout> |
350 | 350 |
</widget> |
351 | 351 |
</item> |
352 |
<item row="4" column="0"> |
|
353 |
<widget class="QDialogButtonBox" name="buttonBox"> |
|
354 |
<property name="orientation"> |
|
355 |
<enum>Qt::Horizontal</enum> |
|
356 |
</property> |
|
357 |
<property name="standardButtons"> |
|
358 |
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|
359 |
</property> |
|
360 |
</widget> |
|
361 |
</item> |
|
362 | 352 |
<item row="2" column="0"> |
363 | 353 |
<widget class="QGroupBox" name="groupBoxTitleBlock"> |
364 | 354 |
<property name="title"> |
... | ... | |
440 | 430 |
</layout> |
441 | 431 |
</widget> |
442 | 432 |
</item> |
433 |
<item row="5" column="0"> |
|
434 |
<widget class="QDialogButtonBox" name="buttonBox"> |
|
435 |
<property name="orientation"> |
|
436 |
<enum>Qt::Horizontal</enum> |
|
437 |
</property> |
|
438 |
<property name="standardButtons"> |
|
439 |
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|
440 |
</property> |
|
441 |
</widget> |
|
442 |
</item> |
|
443 |
<item row="4" column="0"> |
|
444 |
<widget class="QGroupBox" name="groupBoxTypicalArea"> |
|
445 |
<property name="title"> |
|
446 |
<string>Typical 영역</string> |
|
447 |
</property> |
|
448 |
<layout class="QGridLayout" name="gridLayout_5"> |
|
449 |
<item row="0" column="0"> |
|
450 |
<layout class="QVBoxLayout" name="verticalLayout_2"> |
|
451 |
<item> |
|
452 |
<layout class="QHBoxLayout" name="horizontalLayout_5"> |
|
453 |
<item> |
|
454 |
<widget class="QLineEdit" name="lineEditTypicalArea"/> |
|
455 |
</item> |
|
456 |
<item> |
|
457 |
<widget class="QPushButton" name="pushButtonAddTypicalArea"> |
|
458 |
<property name="minimumSize"> |
|
459 |
<size> |
|
460 |
<width>22</width> |
|
461 |
<height>0</height> |
|
462 |
</size> |
|
463 |
</property> |
|
464 |
<property name="maximumSize"> |
|
465 |
<size> |
|
466 |
<width>22</width> |
|
467 |
<height>16777215</height> |
|
468 |
</size> |
|
469 |
</property> |
|
470 |
<property name="text"> |
|
471 |
<string>+</string> |
|
472 |
</property> |
|
473 |
</widget> |
|
474 |
</item> |
|
475 |
<item> |
|
476 |
<widget class="QPushButton" name="pushButtonDelTypicalArea"> |
|
477 |
<property name="minimumSize"> |
|
478 |
<size> |
|
479 |
<width>22</width> |
|
480 |
<height>0</height> |
|
481 |
</size> |
|
482 |
</property> |
|
483 |
<property name="maximumSize"> |
|
484 |
<size> |
|
485 |
<width>22</width> |
|
486 |
<height>16777215</height> |
|
487 |
</size> |
|
488 |
</property> |
|
489 |
<property name="text"> |
|
490 |
<string>-</string> |
|
491 |
</property> |
|
492 |
</widget> |
|
493 |
</item> |
|
494 |
</layout> |
|
495 |
</item> |
|
496 |
<item> |
|
497 |
<layout class="QHBoxLayout" name="horizontalLayout_6"> |
|
498 |
<item> |
|
499 |
<widget class="QTableWidget" name="tableWidgetTypicalArea"> |
|
500 |
<property name="columnCount"> |
|
501 |
<number>3</number> |
|
502 |
</property> |
|
503 |
<column/> |
|
504 |
<column/> |
|
505 |
<column/> |
|
506 |
</widget> |
|
507 |
</item> |
|
508 |
</layout> |
|
509 |
</item> |
|
510 |
</layout> |
|
511 |
</item> |
|
512 |
</layout> |
|
513 |
</widget> |
|
514 |
</item> |
|
443 | 515 |
</layout> |
444 | 516 |
</widget> |
445 | 517 |
<resources> |
DTI_PID/DTI_PID/UI/TrainingImageList.ui | ||
---|---|---|
242 | 242 |
<enum>Qt::Vertical</enum> |
243 | 243 |
</property> |
244 | 244 |
<widget class="QTableWidget" name="tableWidgetList"> |
245 |
<property name="minimumSize"> |
|
246 |
<size> |
|
247 |
<width>0</width> |
|
248 |
<height>400</height> |
|
249 |
</size> |
|
250 |
</property> |
|
245 | 251 |
<property name="sortingEnabled"> |
246 | 252 |
<bool>true</bool> |
247 | 253 |
</property> |
... | ... | |
256 | 262 |
</attribute> |
257 | 263 |
<column/> |
258 | 264 |
</widget> |
265 |
<widget class="QWidget" name="horizontalLayoutWidget"> |
|
266 |
<layout class="QHBoxLayout" name="horizontalLayoutChart"/> |
|
267 |
</widget> |
|
259 | 268 |
</widget> |
260 | 269 |
</item> |
261 | 270 |
</layout> |
내보내기 Unified diff