Example #1
0
 def _load_dir_images_for_scroll_down(self, sd_id, serial, count):
     # self._clear_thumbs()
     load_count = self.listView_thumbs.get_visible_thumb_count(
         self.hslider_thumb_size.value() + 20)
     self._loader_load_scandir.emit(sd_id, serial, count,
                                    ScrollDirection.Down)
     QScroller.grabGesture(self.listView_thumbs.viewport(),
                           QScroller.LeftMouseButtonGesture)
Example #2
0
 def _load_dir_images(self, sd_id):
     self._clear_thumbs()
     load_count = self.listView_thumbs.get_visible_thumb_count(
         self.hslider_thumb_size.value() + 20)
     print("load count %d" % load_count)
     self._loader_load_scandir.emit(sd_id, 0, load_count,
                                    ScrollDirection.Down)
     QScroller.grabGesture(self.listView_thumbs.viewport(),
                           QScroller.LeftMouseButtonGesture)
Example #3
0
 def __init__(self, parent):
     QListWidget.__init__(self, parent)
     self.setViewMode(self.ListMode)
     self.setFlow(self.LeftToRight)
     self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setHorizontalScrollMode(self.ScrollPerItem)
     QScroller.grabGesture(self, QScroller.LeftMouseButtonGesture)
     self.setMaximumHeight(30)
     self.setFocusPolicy(Qt.NoFocus)
Example #4
0
    def __init__(self):
        # Application Settings:
        self.app = QApplication(sys.argv)
        self.app.setStyle("Fusion")
        #self.app.setWindowIcon(QIcon("gear_drop.ico"))
        super(Window, self).__init__()
        self.setWindowTitle("Nerd Lab - HTML Replace")
        self.main_widget = QWidget(self)
        self.main_layout = QGridLayout(self.main_widget)
        self.setStyleSheet("background-color: #333333; color: #dedede;")

        self.exit_command = QAction("Exit", self)
        self.exit_command.triggered.connect(self.close)

        self.main_menu = self.menuBar()
        self.file_menu = self.main_menu.addMenu("File")
        self.file_menu.addAction(self.exit_command)
        self.help_menu = self.main_menu.addMenu("Help")

        self.scroll_area = QScrollArea()
        self.scroll_area.setWidgetResizable(True)
        self.scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.scroll_area.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.scroll_widget = QWidget()
        self.scroll_area.setWidget(self.scroll_widget)
        QScroller.grabGesture(self.scroll_area.viewport(),
                              QScroller.LeftMouseButtonGesture)

        html_dir_row = QWidget()
        html_dir_layout = QGridLayout(html_dir_row)
        self.html_dir_label = QLabel("Directory containing the Html files:")
        self.html_dir_entry = QLineEdit()
        self.html_dir_entry.setStyleSheet(
            "background-color: #434343; selection-background-color: darkgray;")
        self.html_dir_entry.setReadOnly(True)
        self.html_dir_entry.setCursor(Qt.IBeamCursor)
        self.html_dir_button = QPushButton("Browse")
        self.html_dir_button.clicked.connect(self.setHTMLDir)
        html_dir_layout.addWidget(self.html_dir_label, 0, 0)
        html_dir_layout.addWidget(self.html_dir_entry, 1, 0)
        html_dir_layout.addWidget(self.html_dir_button, 1, 1)

        self.html_files = []
        self.dir_name = "Replaced Html Files"

        self.scroll_layout = QGridLayout(self.scroll_widget)

        self.add_replace_button = QPushButton("Add Replace Entry")
        self.add_replace_button.clicked.connect(self.addReplaceRow)
        self.rmv_replace_button = QPushButton("Remove Replace Entry")
        self.rmv_replace_button.clicked.connect(self.removeReplaceRow)
        replace_button_row = QWidget()
        replace_button_row_layout = QGridLayout(replace_button_row)
        replace_button_row_layout.addWidget(self.add_replace_button, 0, 0)
        replace_button_row_layout.addWidget(self.rmv_replace_button, 0, 1)
        replace_button_row_layout.addWidget(self.filler(False), 0, 2)

        self.status_box = QTextEdit()
        self.status_box.setReadOnly(True)
        self.status_box.setCursor(Qt.IBeamCursor)
        self.status_box.setStyleSheet("background-color: #434343;")

        replace_row = QWidget()
        replace_layout = QGridLayout(replace_row)
        self.replace_button = QPushButton("Replace")
        self.replace_button.clicked.connect(self.replaceHTML)
        self.replace_button.setDisabled(True)
        replace_layout.addWidget(self.filler(False), 0, 0)
        replace_layout.addWidget(self.replace_button, 0, 1)

        self.replace_grid = QWidget()
        self.replace_grid_layout = QGridLayout(self.replace_grid)
        self.current_row = 0
        self.scroll_layout.addWidget(self.replace_grid)
        self.scroll_layout.addWidget(self.filler())

        self.main_layout.addWidget(html_dir_row)
        self.main_layout.addWidget(
            QLabel(
                'Enter the exact line of Html you want to replace in the "Find What:" entry.\nIn the "Replace With:" entry, enter the Html that will be replacing the found line of Html.'
            ))
        self.main_layout.addWidget(self.scroll_area)
        self.main_layout.addWidget(replace_button_row)
        self.main_layout.addWidget(self.status_box)
        self.main_layout.addWidget(replace_row)

        self.setCentralWidget(self.main_widget)

        self.replace_rows = []
        self.addReplaceRow()
        self.rmv_replace_button.setDisabled(True)
        self.createReplaceFolder()