def initUI(self):
        self.container = QToolBox()
        self.setWidget(self.container)

        self.b_save_edit = QPushButton("Save current edit")
        self.b_save_edit.clicked.connect(self._applySaveEdit)
        self.container.addItem(OptionBox([self.b_save_edit]), "Save")

        self.tf_importance_point_count = QLineEdit()
        self.tf_importance_point_count.setPlaceholderText(
            "Number of Points to Sample")
        self.tf_importance_point_count.setValidator(
            QIntValidator(1, 1000000, self))
        self.b_importance_apply = QPushButton("Apply Sampling")
        self.b_importance_apply.clicked.connect(
            self._applyFaceImportanceSampling)
        self.container.addItem(
            OptionBox(
                [self.tf_importance_point_count, self.b_importance_apply]),
            "Importance Sampling (Mesh)")

        self.tf_poisson_point_count = QLineEdit()
        self.tf_poisson_point_count.setPlaceholderText(
            "Number of Points to Sample")
        self.tf_poisson_point_count.setValidator(
            QIntValidator(1, 1000000, self))
        self.tf_poisson_radius = QLineEdit()
        self.tf_poisson_radius.setPlaceholderText(
            "Radius of the poisson disks")
        self.tf_poisson_radius.setValidator(QDoubleValidator(
            0.0, 2.0, 5, self))
        self.b_poisson_apply = QPushButton("Apply Sampling")
        self.b_poisson_apply.clicked.connect(self._applyPoissonDiskSampling)
        self.container.addItem(
            OptionBox([
                self.tf_poisson_point_count, self.tf_poisson_radius,
                self.b_poisson_apply
            ]), "Poisson Sampling (Mesh)")

        self.tf_montecarlo_point_count = QLineEdit()
        self.tf_montecarlo_point_count.setPlaceholderText(
            "Number of Points to Sample")
        self.tf_montecarlo_point_count.setValidator(
            QIntValidator(1, 1000000, self))
        self.b_montecarlo_apply = QPushButton("Apply Sampling")
        self.b_montecarlo_apply.clicked.connect(self._applyMontecarloSampling)
        self.container.addItem(
            OptionBox(
                [self.tf_montecarlo_point_count, self.b_montecarlo_apply]),
            "Montecarlo Sampling (Mesh)")

        self.tf_centroid_count = QLineEdit()
        self.tf_centroid_count.setPlaceholderText("Centroid Count")
        self.tf_centroid_count.setValidator(QIntValidator(1, 1000000, self))
        self.b_show_centroids = QPushButton("Apply FPS")
        self.b_show_centroids.clicked.connect(self._applyFPS)
        self.container.addItem(
            OptionBox([self.tf_centroid_count, self.b_show_centroids]),
            "FPS Sampling (Point)")

        self.tf_show_pp2_centroids = QLineEdit()
        self.tf_show_pp2_centroids.setPlaceholderText("Number of Centroids")
        self.tf_show_pp2_centroids.setValidator(QIntValidator(
            1, 1000000, self))
        self.tf_show_pp2_centroids_with_ball = QLineEdit()
        self.tf_show_pp2_centroids_with_ball.setPlaceholderText(
            "Number of Centroids with plotted radius")
        self.tf_show_pp2_centroids_with_ball.setValidator(
            QIntValidator(1, 1000000, self))
        self.tf_show_pp2_radius = QLineEdit()
        self.tf_show_pp2_radius.setPlaceholderText(
            "Radius of the neighbour area")
        self.tf_show_pp2_radius.setValidator(
            QDoubleValidator(0.0, 2.0, 5, self))
        self.b_show_pp2_step = QPushButton("Apply Sampling")
        self.b_show_pp2_step.clicked.connect(self._show_pp2_step)
        self.container.addItem(
            OptionBox([
                self.tf_show_pp2_centroids,
                self.tf_show_pp2_centroids_with_ball, self.tf_show_pp2_radius,
                self.b_show_pp2_step
            ]), "Show PointNet2 sampling")
Example #2
0
    def __init__(self, parent):
        super(QWidget, self).__init__(parent)
        # Instantiate a reference to an animation
        self.animation = None

        # Initialise tab screen
        self.layout = QVBoxLayout(self)
        self.tabs = QTabWidget()

        # Initialise the maze runner
        self.runner_scene = MazeRunnerScene()
        self.runner_tab = QGraphicsView()
        self.runner_tab.setViewportUpdateMode(QGraphicsView.NoViewportUpdate)
        self.runner_tab.setScene(self.runner_scene)

        self.runner_load_maze_button = QPushButton(self.runner_tab)
        self.runner_load_maze_button.setGeometry(QRect(10, 10, 90, 30))
        self.runner_load_maze_button.setText("Load Maze")
        self.runner_load_maze_button.clicked.connect(self.load_maze_on_click)

        self.runner_search_combobox = QComboBox(self.runner_tab)
        self.runner_search_combobox.setGeometry(110, 11, 200, 28)
        # New solvers need to be added to this list and added to start_search in maze-runner/MazeRunner.py
        search_options = [
            'Breadth First Search', 'Bidirectional BFS', 'Depth First Search',
            'Bidirectional DFS', 'Greedy Best First', 'A*', 'Random Sampling'
        ]
        self.runner_search_combobox.addItems(search_options)

        self.runner_start_button = QPushButton(self.runner_tab)
        self.runner_start_button.setGeometry(QRect(320, 10, 90, 30))
        self.runner_start_button.setText("Start")
        self.runner_start_button.clicked.connect(self.start_search_on_click)

        self.runner_pause_button = QPushButton(self.runner_tab)
        self.runner_pause_button.setGeometry(QRect(420, 10, 90, 30))
        self.runner_pause_button.setText("Pause")
        self.runner_pause_button.setCheckable(True)
        self.runner_pause_button.clicked.connect(self.toggle_pause_runner)

        self.runner_render_progress_button = QPushButton(self.runner_tab)
        self.runner_render_progress_button.setGeometry(QRect(520, 10, 150, 30))
        self.runner_render_progress_button.setText("Show Progress")
        self.runner_render_progress_button.setCheckable(True)
        self.runner_render_progress_button.setChecked(True)
        self.runner_render_progress_button.clicked.connect(
            self.toggle_render_runner)

        self.runner_console_label = QLabel(self.runner_tab)
        self.runner_console_label.setGeometry(680, 10, 1000, 30)
        self.runner_console_label.setText('')

        # Initialise the maze generator
        self.generator_scene = MazeGeneratorScene()
        self.generator_tab = QGraphicsView()
        self.generator_tab.setViewportUpdateMode(
            QGraphicsView.NoViewportUpdate)
        self.generator_tab.setScene(self.generator_scene)

        self.generator_columns_label = QLabel(self.generator_tab)
        self.generator_columns_label.setText('Columns:')
        self.generator_columns_label.setGeometry(10, 10, 45, 30)
        self.generator_columns_line_edit = QLineEdit(self.generator_tab)
        self.generator_columns_line_edit.setGeometry(QRect(65, 10, 90, 30))
        self.generator_columns_line_edit.setValidator(QIntValidator(1, 99))
        self.generator_columns_line_edit.setText(
            str(Config.DEFAULT_MAZE_COLUMNS))

        self.generator_rows_label = QLabel(self.generator_tab)
        self.generator_rows_label.setText('Rows:')
        self.generator_rows_label.setGeometry(165, 10, 30, 30)
        self.generator_rows_line_edit = QLineEdit(self.generator_tab)
        self.generator_rows_line_edit.setGeometry(QRect(205, 10, 90, 30))
        self.generator_rows_line_edit.setValidator(QIntValidator(1, 99))
        self.generator_rows_line_edit.setText(str(Config.DEFAULT_MAZE_ROWS))

        self.generator_start_button = QPushButton(self.generator_tab)
        self.generator_start_button.setGeometry(QRect(305, 10, 90, 30))
        self.generator_start_button.setText("Generate")
        self.generator_start_button.clicked.connect(
            self.start_generation_on_click)

        self.generator_save_button = QPushButton(self.generator_tab)
        self.generator_save_button.setGeometry(QRect(405, 10, 90, 30))
        self.generator_save_button.setText("Save Maze")
        self.generator_save_button.clicked.connect(self.save_maze_on_click)

        self.generator_pause_button = QPushButton(self.generator_tab)
        self.generator_pause_button.setGeometry(QRect(505, 10, 90, 30))
        self.generator_pause_button.setText("Pause")
        self.generator_pause_button.setCheckable(True)
        self.generator_pause_button.clicked.connect(
            self.toggle_pause_generator)

        self.generator_render_progress_button = QPushButton(self.generator_tab)
        self.generator_render_progress_button.setGeometry(
            QRect(605, 10, 150, 30))
        self.generator_render_progress_button.setText("Show Progress")
        self.generator_render_progress_button.setCheckable(True)
        self.generator_render_progress_button.setChecked(True)
        self.generator_render_progress_button.clicked.connect(
            self.toggle_render_generator)

        self.generator_console_label = QLabel(self.generator_tab)
        self.generator_console_label.setGeometry(765, 10, 1000, 30)
        self.generator_console_label.setText('')

        # Add tabs to layout
        self.tabs.addTab(self.runner_tab, "Maze Runner")
        self.tabs.addTab(self.generator_tab, "Maze Generator")
        self.layout.addWidget(self.tabs)
        self.setLayout(self.layout)
Example #3
0
    def __init__(self):
        super(self.__class__, self).__init__()
        self.setupUi(self)

        self.e_post.setValidator(QIntValidator(0, 99999, self))
Example #4
0
    def __init__(self):
        """Constructor"""
        QMainWindow.__init__(self)
        global_properties = GlobalProperties.get_instance()
        self.connection_table = ConnectionTableWidget()
        global_properties.add_listener(self.connection_table)
        self.setCentralWidget(self.connection_table)
        self.connection_table.update()

        self.menu_bar = self.menuBar()
        self.menu_file = self.menu_bar.addMenu('File')
        self.menu_file.addAction('New', file_new_clicked)
        self.menu_file.addAction('Open', self.file_load)
        self.menu_file.addSeparator()
        self.menu_file.addAction('Save', self.file_save)
        self.menu_file.addAction('Save as', self.file_save_as)
        self.menu_file.addSeparator()
        self.menu_file.addAction('Exit', sys.exit)

        self.menu_file = self.menu_bar.addMenu('Connections')
        self.make_birectional_menu = self.menu_file.addMenu(
            'Make bidirectional')
        self.make_birectional_menu.addAction("with and",
                                             make_bidirectional_and)
        self.make_birectional_menu.addAction("with or", make_bidirectional_or)

        self.menu_selection = self.menu_bar.addMenu('Selections')
        self.action_add_selection = self.menu_selection.addAction(
            'Add Selection')
        self.action_add_selection.triggered.connect(
            create_add_selection_window)
        self.action_merge_selections = self.menu_selection.addAction(
            'Merge Selections')
        self.action_merge_selections.triggered.connect(
            create_merge_selectoon_window)
        self.setMenuBar(self.menu_bar)
        self.statusBar().showMessage('Welcome to mpdj!', 5000)

        self.mpdj_options_dock = QDockWidget("MPDJ Options Panel", self)
        self.mpdj_options_dock_layout = QFormLayout()
        self.mpdj_docked_widget = QWidget()

        self.tf_min_global_song_duration = QLineEdit()
        self.tf_min_global_song_duration.setValidator(
            QIntValidator(0, 2147483647))
        self.mpdj_options_dock_layout.addRow('Global min song duration:',
                                             self.tf_min_global_song_duration)
        self.tf_min_global_song_duration.editingFinished.connect(
            self.write_min_global_song_duration_to_mpdj)

        self.tf_max_global_song_duration = QLineEdit()
        self.tf_max_global_song_duration.setValidator(
            QIntValidator(0, 2147483647))
        self.mpdj_options_dock_layout.addRow('Global max song duration:',
                                             self.tf_max_global_song_duration)
        self.tf_max_global_song_duration.editingFinished.connect(
            self.write_max_global_song_duration_to_mpdj)

        self.tf_min_per_selection = QLineEdit()
        self.tf_min_per_selection.setValidator(QIntValidator(0, 2147483647))
        self.mpdj_options_dock_layout.addRow('Min per Node touch:',
                                             self.tf_min_per_selection)
        self.tf_min_per_selection.editingFinished.connect(
            self.write_min_per_note_to_mpdj)

        self.tf_max_per_selection = QLineEdit()
        self.tf_max_per_selection.setValidator(QIntValidator(0, 2147483647))
        self.mpdj_options_dock_layout.addRow('Max per Node touch:',
                                             self.tf_max_per_selection)
        self.tf_max_per_selection.editingFinished.connect(
            self.write_max_per_note_to_mpdj)

        self.combo_box_minutes_or_titles = QComboBox()
        self.combo_box_minutes_or_titles.addItems(
            [unit.gui_representation() for unit in UnitPerNodeTouch])
        self.mpdj_options_dock_layout.addRow('Unit:',
                                             self.combo_box_minutes_or_titles)
        self.combo_box_minutes_or_titles.currentTextChanged.connect(
            self.write_unit_per_node_touch_to_mpdj)

        self.tf_global_node_max_overflow_minutes = QLineEdit()
        self.tf_global_node_max_overflow_minutes.setValidator(
            QIntValidator(0, 2147483647))
        self.tf_global_node_max_overflow_minutes.editingFinished.connect(
            self.write_global_node_max_overflow_to_mpdj)
        self.cb_global_limit_overflow = QCheckBox()
        self.cb_global_limit_overflow.stateChanged.connect(lambda: list(
            map(lambda m: m(), [
                lambda: self.tf_global_node_max_overflow_minutes.setDisabled(
                    not self.cb_global_limit_overflow.isChecked()), self.
                write_limit_overspill_to_mpdj
            ])))
        self.overflow_layoout = QHBoxLayout()

        self.overflow_layoout.addWidget(self.cb_global_limit_overflow)
        self.overflow_layoout.addWidget(
            self.tf_global_node_max_overflow_minutes)
        self.mpdj_options_dock_layout.addRow("Limit overflow:",
                                             self.overflow_layoout)

        self.mpdj_docked_widget.setLayout(self.mpdj_options_dock_layout)
        self.mpdj_options_dock.setWidget(self.mpdj_docked_widget)
        self.addDockWidget(Qt.LeftDockWidgetArea, self.mpdj_options_dock)

        self.chk_box_graph_is_directed = QCheckBox()
        self.chk_box_graph_is_directed.stateChanged.connect(
            self.write_graph_is_directed_to_mpdj)
        self.mpdj_options_dock_layout.addRow(QLabel('Graph is directed'),
                                             self.chk_box_graph_is_directed)
        self.opened_selection_window = None
        global_properties.add_listener(self)
        self.update()
    def __init__(self):
        QWidget.__init__(self)

        self.main_layout = QVBoxLayout()
        self.l = QFormLayout()
        self.l2 = QHBoxLayout()
        self.l3 = QHBoxLayout()

        self.group_box = QGroupBox('Ustawienia ogólne')
        self.group_box2 = QGroupBox('Pobieraj metadane')
        self.group_box3 = QGroupBox(
            'Pobieraj dodatkowe metadane i dołącz je do komentarza')

        # general settings
        self.max_results_label = QLabel('Maksymalna liczba wyników')
        self.max_results_label.setToolTip(
            'Maksymalna liczba pobieranych metadanych. Dla książek o nieunikalnych tytułach \
pierwszy wynik może być niepoprawny')
        self.max_results = QLineEdit(self)
        self.max_results.setValidator(QIntValidator())
        self.max_results.setText(str(PREFS['max_results']))
        self.max_results_label.setBuddy(self.max_results)
        self.l.addRow(self.max_results_label, self.max_results)

        self.authors_search_label = QLabel('Używaj autorów do wyszukiwań')
        self.authors_search_label.setToolTip(
            'Wyszukuj uwzględniając autorów. Może poprawić trafność wyników, ale błędni autorzy spowodują brak wyników'
        )
        self.authors_search = QCheckBox()
        self.authors_search.setChecked(PREFS['authors_search'])
        self.authors_search_label.setBuddy(self.authors_search)
        self.l.addRow(self.authors_search_label, self.authors_search)

        self.only_first_author_label = QLabel(
            'Używaj tylko pierwszego autora do wyszukiwania')
        self.only_first_author_label.setToolTip(
            'Używaj tylko pierwszego autora do wyszukiwań, obowiązuje tylko gdy wyszukiwanie z autorami jest aktywowane'
        )
        self.only_first_author = QCheckBox()
        self.only_first_author.setChecked(PREFS['only_first_author'])
        self.only_first_author_label.setBuddy(self.only_first_author)
        self.l.addRow(self.only_first_author_label, self.only_first_author)

        self.covers_label = QLabel('Pobieraj okładki')
        self.covers = QCheckBox()
        self.covers.setChecked(PREFS['covers'])
        self.covers_label.setBuddy(self.covers)
        self.l.addRow(self.covers_label, self.covers)

        self.max_covers_label = QLabel('Maksymalna liczba okładek')
        self.max_covers_label.setToolTip(
            'Maksymalna liczba pobieranych okładek')
        self.max_covers = QLineEdit(self)
        self.max_covers.setValidator(QIntValidator())
        self.max_covers.setText(str(PREFS['max_covers']))
        self.max_covers_label.setBuddy(self.max_covers)
        self.l.addRow(self.max_covers_label, self.max_covers)

        self.threads_label = QLabel('Wielowątkowe przetwarzanie')
        self.threads_label.setToolTip(
            'Przyśpiesza pracę używając wielu wątków')
        self.threads = QCheckBox()
        self.threads.setChecked(PREFS['threads'])
        self.threads_label.setBuddy(self.threads)
        self.l.addRow(self.threads_label, self.threads)

        self.max_threads_label = QLabel('Maksymalna liczba wątków')
        self.max_threads = QLineEdit(self)
        self.max_threads.setValidator(QIntValidator())
        self.max_threads.setText(str(PREFS['max_threads']))
        self.max_threads_label.setBuddy(self.max_threads)
        self.l.addRow(self.max_threads_label, self.max_threads)

        self.thread_delay_label = QLabel('Opóźnienie wątku')
        self.thread_delay_label.setToolTip(
            'Czas oczekiwania na uruchomienie kolejnego wątku')
        self.thread_delay = QLineEdit(self)
        self.thread_delay.setValidator(QDoubleValidator())
        self.thread_delay.setText(str(PREFS['thread_delay']))
        self.thread_delay_label.setBuddy(self.thread_delay)
        self.l.addRow(self.thread_delay_label, self.thread_delay)

        # metadata settings
        if 'title' in PREFS.defaults:
            self.title = QCheckBox('Tytuł')
            self.title.setChecked(PREFS['title'])
            self.l2.addWidget(self.title)

        if 'authors' in PREFS.defaults:
            self.authors = QCheckBox('Autorzy')
            self.authors.setChecked(PREFS['authors'])
            self.l2.addWidget(self.authors)

        if 'pubdate' in PREFS.defaults:
            self.pubdate = QCheckBox('Data wydania')
            self.pubdate.setChecked(PREFS['pubdate'])
            self.l2.addWidget(self.pubdate)

        if 'publisher' in PREFS.defaults:
            self.publisher = QCheckBox('Wydawca')
            self.publisher.setChecked(PREFS['publisher'])
            self.l2.addWidget(self.publisher)

        if 'isbn' in PREFS.defaults:
            self.isbn = QCheckBox('ISBN')
            self.isbn.setChecked(PREFS['isbn'])
            self.l2.addWidget(self.isbn)

        if 'comments' in PREFS.defaults:
            self.comments = QCheckBox('Opis')
            self.comments.setChecked(PREFS['comments'])
            self.l2.addWidget(self.comments)

        if 'languages' in PREFS.defaults:
            self.languages = QCheckBox('Języki')
            self.languages.setChecked(PREFS['languages'])
            self.l2.addWidget(self.languages)

        if 'rating' in PREFS.defaults:
            self.rating = QCheckBox('Ocena')
            self.rating.setChecked(PREFS['rating'])
            self.l2.addWidget(self.rating)

        if 'tags' in PREFS.defaults:
            self.tags = QCheckBox('Etykiety (tagi)')
            self.tags.setChecked(PREFS['tags'])
            self.l2.addWidget(self.tags)

        if 'series' in PREFS.defaults:
            self.series = QCheckBox('Cykle')
            self.series.setChecked(PREFS['series'])
            self.l2.addWidget(self.series)

        if 'identifier' in PREFS.defaults:
            self.identifier = QCheckBox('Identyfikator')
            self.identifier.setChecked(PREFS['identifier'])
            self.l2.addWidget(self.identifier)

        # custom metadata
        if 'translators' in PREFS.defaults:
            self.translators = QCheckBox('Tłumaczenie')
            self.translators.setChecked(PREFS['translators'])
            self.l3.addWidget(self.translators)

        if 'original_title' in PREFS.defaults:
            self.original_title = QCheckBox('Tytuł oryginału')
            self.original_title.setChecked(PREFS['original_title'])
            self.l3.addWidget(self.original_title)

        if 'categories' in PREFS.defaults:
            self.categories = QCheckBox('Kategorie')
            self.categories.setChecked(PREFS['categories'])
            self.l3.addWidget(self.categories)

        if 'genres' in PREFS.defaults:
            self.genres = QCheckBox('Gatunki')
            self.genres.setChecked(PREFS['genres'])
            self.l3.addWidget(self.genres)

        self.group_box.setLayout(self.l)
        self.group_box2.setLayout(self.l2)
        self.group_box3.setLayout(self.l3)
        self.main_layout.addWidget(self.group_box)
        self.main_layout.addWidget(self.group_box2)
        self.main_layout.addWidget(self.group_box3)
        self.main_layout.setAlignment(Qt.AlignTop)
        self.setLayout(self.main_layout)