Ejemplo n.º 1
0
 def dayRun(self):
     current_date = self.comboDayDate.currentText()
     Controler = PhysicoControl(self.pManage)
     day_excel = Controler.makeDayExcelData(int(current_date[:8]))
     day_model = PandasModel(day_excel['day'])
     position_model = PandasModel(day_excel['position'])
     self.tableViewDay.setModel(day_model)
     self.tableViewPosition.setModel(position_model)
Ejemplo n.º 2
0
    def __init__(self, df):
        QWidget.__init__(self, parent=None)

        self.df = copy.copy(self.prepare_df(df))

        v_layout = QVBoxLayout()
        h_layout = QHBoxLayout()

        self.search_textbox = QLineEdit(self)
        self.search_textbox.setPlaceholderText("Enter searched name")
        h_layout.addWidget(self.search_textbox)

        self.search_min_age = QLineEdit(self)
        self.search_min_age.setPlaceholderText("Min Age")
        h_layout.addWidget(self.search_min_age)

        self.search_max_age = QLineEdit(self)
        self.search_max_age.setPlaceholderText("Max Age")
        h_layout.addWidget(self.search_max_age)

        self.overall_min = QLineEdit(self)
        self.overall_min.setPlaceholderText("Minimal Overall")
        h_layout.addWidget(self.overall_min)

        self.overall_max = QLineEdit(self)
        self.overall_max.setPlaceholderText("Maximal Overall")
        h_layout.addWidget(self.overall_max)

        self.skill_moves_min = QLineEdit(self)
        self.skill_moves_min.setPlaceholderText("Minimall skill moves")
        h_layout.addWidget(self.skill_moves_min)

        self.skill_moves_max = QLineEdit(self)
        self.skill_moves_max.setPlaceholderText("Max skill moves")
        h_layout.addWidget(self.skill_moves_max)

        self.combo_box_position = QComboBox()
        positions = list(self.df['Position'].dropna().unique())
        positions.append('Any')
        self.combo_box_position.addItems(positions)
        h_layout.addWidget(self.combo_box_position)

        self.search_button = QPushButton("Search", self)
        h_layout.addWidget(self.search_button)

        v_layout.addLayout(h_layout)

        self.table = QTableView(self)
        v_layout.addWidget(self.table)

        self.setLayout(v_layout)

        self.model = PandasModel(self.df)
        self.table.setModel(self.model)

        self.search_button.clicked.connect(self.search_clicked)
        self.table.setSortingEnabled(True)
Ejemplo n.º 3
0
 def matchRun(self):
     current_match = self.comboMatchDate.currentText()
     current_camp, current_date, current_info = current_match.split(':')
     Matcher = PhysicoMatch(self.pManage)
     day_excel, _, _ = Matcher.matchTeamData(current_camp, current_date,
                                             current_info)
     day_model = PandasModel(day_excel['day'])
     position_model = PandasModel(day_excel['position'][[
         'Position', 'RPE', 'TR Time', 'Total Dist.', 'Dist. per min',
         'HSR+Sprint', 'MSR', 'HSR', 'Sprint', 'Accel Cnt.', 'Decel Cnt.',
         'Max Speed', 'GPS PL', 'Load'
     ]])
     self.tableViewMatch.setModel(day_model)
     self.tableViewMatchPosition.setModel(position_model)
Ejemplo n.º 4
0
 def playerRun(self):
     current_player = self.comboPlayerName.currentText()
     Controler = PhysicoControl(self.pManage)
     player_excel = Controler.makePlayerExcelData()
     player_df = player_excel[current_player]
     model = PandasModel(player_df)
     self.tableViewPlayer.setModel(model)
 def set_model(self, df):
     """ Sets model data to respective Tableview in the GUI
     args:
         df: Dataframe of polymer levels per column
     """
     self.dataset = df
     self.table_model = PandasModel(df)
     self.ui.polymer_level.setModel(self.table_model)
Ejemplo n.º 6
0
 def load_price_for_product_to_table(self, handler_index,
                                     product_listitem_id, tableWidget):
     # view = QtGui.QTableView()
     # print('trying load to table...')
     cur_data = self.data[handler_index][0][
         self.indexmap[product_listitem_id]]
     # print('cur_data :', self.data[handler_index][0])
     model = PandasModel(
         self.data[handler_index][0][self.indexmap[product_listitem_id]])
     tableWidget.setModel(model)
     tableWidget.show()
Ejemplo n.º 7
0
    def _update_table(self, polygon_object):
        """
        Displays the final/true data points on table
        Before displaying the data, we must first generate N number of random points withing
            the polygon.
        Then we map the x-axis pixel coordinates to decimal degree longitude coordinates.
        Next we take the newly generated longitude coordinates and compute their corresponding latitude
            coordinates using user inputs for longitude and latitude ranges and the equation of a line.
        Next we map the z-axis pixel coordinates to meters.
        Finally we generate a dataframe containing the processed data points and display them.
        :param polygon_object: Polygon to be used for generating N random points within.
        :return:
        """
        random_points = np.asarray([self.random_points_inside_polygon(polygon_object) for j in range(1000)]).T

        lon = [self.x_range_lon[random_points[0][j]] for j in range(len(random_points[0]))]
        z_value = [self.z_range_elv[random_points[1][j]] for j in range(len(random_points[1]))]
        classifier = [self.intClassValue] * 1000

        lat = self.compute_latitudes(self.x_range_lon[0], self.x_range_lon[-1],
                                     self.y_range_lat[0], self.y_range_lat[1],
                                     lon)

        self.generated_longitude = np.hstack((self.generated_longitude, lon))
        self.generated_latitude = np.hstack((self.generated_latitude, lat))
        self.generated_zvalues = np.hstack((self.generated_zvalues, z_value))
        self.generated_classifier = np.hstack((self.generated_classifier, classifier))

        self.generated_data_df = pd.DataFrame({'Longitude': self.generated_longitude,
                                               'Latitude': self.generated_latitude,
                                               'Z_value': self.generated_zvalues,
                                               'Classifier': self.generated_classifier
                                               })

        model = PandasModel(self.generated_data_df)
        self.TableView.setModel(model)
        self.TableView.resizeColumnsToContents()
Ejemplo n.º 8
0
class WindowSearch(QWidget):
    def __init__(self, df):
        QWidget.__init__(self, parent=None)

        self.df = copy.copy(self.prepare_df(df))

        v_layout = QVBoxLayout()
        h_layout = QHBoxLayout()

        self.search_textbox = QLineEdit(self)
        self.search_textbox.setPlaceholderText("Enter searched name")
        h_layout.addWidget(self.search_textbox)

        self.search_min_age = QLineEdit(self)
        self.search_min_age.setPlaceholderText("Min Age")
        h_layout.addWidget(self.search_min_age)

        self.search_max_age = QLineEdit(self)
        self.search_max_age.setPlaceholderText("Max Age")
        h_layout.addWidget(self.search_max_age)

        self.overall_min = QLineEdit(self)
        self.overall_min.setPlaceholderText("Minimal Overall")
        h_layout.addWidget(self.overall_min)

        self.overall_max = QLineEdit(self)
        self.overall_max.setPlaceholderText("Maximal Overall")
        h_layout.addWidget(self.overall_max)

        self.skill_moves_min = QLineEdit(self)
        self.skill_moves_min.setPlaceholderText("Minimall skill moves")
        h_layout.addWidget(self.skill_moves_min)

        self.skill_moves_max = QLineEdit(self)
        self.skill_moves_max.setPlaceholderText("Max skill moves")
        h_layout.addWidget(self.skill_moves_max)

        self.combo_box_position = QComboBox()
        positions = list(self.df['Position'].dropna().unique())
        positions.append('Any')
        self.combo_box_position.addItems(positions)
        h_layout.addWidget(self.combo_box_position)

        self.search_button = QPushButton("Search", self)
        h_layout.addWidget(self.search_button)

        v_layout.addLayout(h_layout)

        self.table = QTableView(self)
        v_layout.addWidget(self.table)

        self.setLayout(v_layout)

        self.model = PandasModel(self.df)
        self.table.setModel(self.model)

        self.search_button.clicked.connect(self.search_clicked)
        self.table.setSortingEnabled(True)

    def search_clicked(self):
        entered_text = self.search_textbox.text()
        entered_position = [self.combo_box_position.currentText()] if self.combo_box_position.currentText() != 'Any' \
            else list(self.df['Position'].dropna().unique())
        try:
            min_age = float(self.search_min_age.text()
                            ) if self.search_min_age.text() else 10
            max_age = float(self.search_max_age.text()
                            ) if self.search_max_age.text() else 50
            min_overall = float(
                self.overall_min.text()) if self.overall_min.text() else 20
            max_overall = float(
                self.overall_max.text()) if self.overall_max.text() else 100
            min_skill_moves = float(self.skill_moves_min.text()
                                    ) if self.skill_moves_min.text() else 1.0
            max_skill_moves = float(self.skill_moves_max.text()
                                    ) if self.skill_moves_max.text() else 5.0

        except ValueError:
            msg_box = QMessageBox()
            msg_box.setIcon(QMessageBox.Information)
            msg_box.setText("Wrong parameters entered")
            msg_box.setWindowTitle("Error")
            msg_box.exec()
            return

        result = self.df[(self.df['Name'].str.contains(entered_text, na=False))
                         & (self.df['Position'].isin(entered_position)) &
                         (self.df['Age'] <= max_age) &
                         (self.df['Age'] >= min_age) &
                         (self.df['Skill Moves'] <= max_skill_moves) &
                         (self.df['Skill Moves'] >= min_skill_moves) &
                         (self.df['Overall'] < max_overall) &
                         (self.df['Overall'] > min_overall)]

        self.model.update(result)

    @staticmethod
    def prepare_df(df):
        columns = [
            'Name', 'Age', 'Nationality', 'Overall', 'Club', 'Value', 'Wage',
            'Skill Moves', 'Position', 'Height', 'Weight'
        ]

        return df[columns]
 def populate_table(self, df):
     self.model = PandasModel(self.ui.tbl_data, df)
 def QTable_setModel(self, pandasData, qtable):
     model = PandasModel(pandasData)
     qtable.setModel(model)