示例#1
0
 def init_tab_widget(self, tab_widget):
     #
     # Tab 'List':
     tab_list = QtGui.QWidget()
     tab_list_grid_layout = QtGui.QGridLayout(tab_list)
     tab_widget.addTab(tab_list, from_utf8("List"))
     quotation_view = QuotationView()
     self._quotation_view = quotation_view
     tab_list_grid_layout.addWidget(
         quotation_view,
         0, 0, 1, 1
     )
     #
     # Tab 'K-Line':
     tab_k_line_view = QtGui.QWidget()
     tab_k_line_view_grid_layout = QtGui.QGridLayout(tab_k_line_view)
     tab_widget.addTab(tab_k_line_view, from_utf8("K-Line"))
     container_view = ContainerView()
     self._container_view = container_view
     tab_k_line_view_grid_layout.addWidget(
         container_view,
         0, 0, 1, 1
     )
     QtCore.QObject.connect(
         container_view,
         QtCore.SIGNAL("updateSeries(PyQt_PyObject)"),
         container_view.update_k_line
     )
     QtCore.QObject.connect(
         container_view,
         QtCore.SIGNAL("appendDataFrame(PyQt_PyObject)"),
         container_view.append_k_line
     )
示例#2
0
 def update_data(self, updated_data):
     for i in range(len(updated_data)):
         for j in range(len(updated_data[0])):
             if self._model.item(i, j).text()\
                     .compare(
                         from_utf8(str(updated_data[i][j]))
                     ) != 0:
                 self._model.setData(
                     self._model.index(i, j),
                     QtCore.QVariant(from_utf8(str(updated_data[i][j])))
                 )
                 self._model.setData(
                     self._model.index(i, j),
                     QtGui.QColor(QtCore.Qt.red), QtCore.Qt.BackgroundRole
                 )
                 self._model.setData(
                     self._model.index(i, j),
                     QtGui.QColor(QtCore.Qt.black), QtCore.Qt.ForegroundRole
                 )
示例#3
0
 def init_tab_widget(self, tab_widget):
     # 蜡烛线
     tab_k_line_view = QWidget()
     tab_k_line_view_grid_layout = QGridLayout(tab_k_line_view)
     tab_widget.addTab(tab_k_line_view, from_utf8("K-Line"))
     container_view = ContainerView()
     self._container_view = container_view
     tab_k_line_view_grid_layout.addWidget(container_view, 0, 0, 1, 1)
     QObject.connect(container_view, SIGNAL("updateSeries(PyQt_PyObject)"),
                     container_view.update_k_line)
     QObject.connect(container_view,
                     SIGNAL("appendDataFrame(PyQt_PyObject)"),
                     container_view.append_k_line)
示例#4
0
 def __init__(self, from_index=0, to_index=99):
     super(IndexRangeSelector, self).__init__()
     #
     main_grid_layout = QGridLayout(self)
     #
     label_from = QLabel(from_utf8("From"))
     label_to = QLabel(from_utf8("To"))
     spin_box_from = QSpinBox()
     spin_box_to = QSpinBox()
     #
     main_grid_layout.addWidget(label_from, 0, 0, 1, 1)
     main_grid_layout.addWidget(spin_box_from, 0, 1, 1, 1)
     main_grid_layout.addWidget(label_to, 1, 0, 1, 1)
     main_grid_layout.addWidget(spin_box_to, 1, 1, 1, 1)
     #
     spin_box_from.setMinimum(from_index + 1)
     spin_box_from.setMaximum(to_index + 1)
     spin_box_to.setMinimum(from_index + 1)
     spin_box_to.setMaximum(to_index + 1)
     #
     self._spin_box_from = spin_box_from
     self._spin_box_to = spin_box_to
示例#5
0
 def __init__(self, from_index=0, to_index=99):
     super(IndexRangeSelector, self).__init__()
     #
     main_grid_layout = QtGui.QGridLayout(self)
     #
     label_from = QtGui.QLabel(from_utf8("From"))
     label_to = QtGui.QLabel(from_utf8("To"))
     spin_box_from = QtGui.QSpinBox()
     spin_box_to = QtGui.QSpinBox()
     #
     main_grid_layout.addWidget(label_from, 0, 0, 1, 1)
     main_grid_layout.addWidget(spin_box_from, 0, 1, 1, 1)
     main_grid_layout.addWidget(label_to, 1, 0, 1, 1)
     main_grid_layout.addWidget(spin_box_to, 1, 1, 1, 1)
     #
     spin_box_from.setMinimum(from_index + 1)
     spin_box_from.setMaximum(to_index + 1)
     spin_box_to.setMinimum(from_index + 1)
     spin_box_to.setMaximum(to_index + 1)
     #
     self._spin_box_from = spin_box_from
     self._spin_box_to = spin_box_to
示例#6
0
 def set_data(self, data):
     #
     self.clean_data()
     #
     for each_row in data:
         each_row_items = \
             [
                 QtGui.QStandardItem(from_utf8(str(item)))
                 for item in each_row
             ]
         self._model.appendRow(each_row_items)
     #
     self._is_data_loaded = True
     self.show_header()
示例#7
0
 def init_tab_widget(self, tab_widget):
     # 蜡烛线
     tab_k_line_view = QWidget()
     tab_k_line_view_grid_layout = QGridLayout(tab_k_line_view)
     tab_widget.addTab(tab_k_line_view, from_utf8("K-Line"))
     container_view = ContainerView()
     self._container_view = container_view
     tab_k_line_view_grid_layout.addWidget( container_view, 0, 0, 1, 1)
     QObject.connect(
         container_view,
         SIGNAL("updateSeries(PyQt_PyObject)"),
         container_view.update_k_line
     )
     QObject.connect(
         container_view,
         SIGNAL("appendDataFrame(PyQt_PyObject)"),
         container_view.append_k_line
     )
示例#8
0
 def set_vertical_header(self, vertical_header_info):
     for i in range(len(vertical_header_info)):
         self._model.setHeaderData(
             i, QtCore.Qt.Vertical,
             QtCore.QVariant(from_utf8(str(vertical_header_info[i])))
         )
示例#9
0
 def set_horizontal_header(self, horizontal_header_info):
     for i in range(len(horizontal_header_info)):
         self._model.setHeaderData(
             i, QtCore.Qt.Horizontal,
             QtCore.QVariant(from_utf8(str(horizontal_header_info[i])))
         )