Exemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     super(MainUi, self).__init__()
     self.ui = Ui_SyncMain()
     self.ui.setupUi(self)
     self.ui.btOpenFrom.clicked.connect(self.from_open)
     self.ui.btOpenTo.clicked.connect(self.to_open)
     self.ui.btSync.clicked.connect(self.sync)
     self.some = Communicate()
     self.some.speak.connect(self.say_words)
     self.ui.actionOpen_Folder_From.activated.connect(self.from_open)
     self.ui.actionOpen_Folder_To.activated.connect(self.to_open)
     self.ui.action_About.activated.connect(self.about_box)
     self.ui.action_License.activated.connect(self.about_license)
     self.ui.actionAbout_Qt.activated.connect(self.about_box_qt)
     self.ui.action_Exit.activated.connect(self.exit_menu)
     self.ui.actionSend_Feedback.activated.connect(self.feedback)
     self.ui.actionMake_someone_happy.activated.connect(self.paypalui)
     self.ui.btOpenTo.setIcon(QtGui.QIcon(get_file("openfolder.png")))
     self.ui.btOpenFrom.setIcon(QtGui.QIcon(get_file("openfolder.png")))
Exemplo n.º 2
0
class MainUi(QtGui.QMainWindow):
    def __init__(self, *args, **kwargs):
        super(MainUi, self).__init__()
        self.ui = Ui_SyncMain()
        self.ui.setupUi(self)
        self.ui.btOpenFrom.clicked.connect(self.from_open)
        self.ui.btOpenTo.clicked.connect(self.to_open)
        self.ui.btSync.clicked.connect(self.sync)
        self.some = Communicate()
        self.some.speak.connect(self.say_words)
        self.ui.actionOpen_Folder_From.activated.connect(self.from_open)
        self.ui.actionOpen_Folder_To.activated.connect(self.to_open)
        self.ui.action_About.activated.connect(self.about_box)
        self.ui.action_License.activated.connect(self.about_license)
        self.ui.actionAbout_Qt.activated.connect(self.about_box_qt)
        self.ui.action_Exit.activated.connect(self.exit_menu)
        self.ui.actionSend_Feedback.activated.connect(self.feedback)
        self.ui.actionMake_someone_happy.activated.connect(self.paypalui)
        self.ui.btOpenTo.setIcon(QtGui.QIcon(get_file("openfolder.png")))
        self.ui.btOpenFrom.setIcon(QtGui.QIcon(get_file("openfolder.png")))

    @Slot(str)
    def say_words(self, words):
        self.ui.textStatus.append(words)

    @staticmethod
    def paypalui():
        pay = PayPalUI()
        pay.exec_()

    @staticmethod
    def feedback():
        feed = Feedback()
        feed.exec_()

    def about_box(self):
        about = QMessageBox.about(
            self,
            "About SynchroniZeRD",
            u"""<b>SynchroniZeRD</b> v %s
        <p><b>Copyright (C) 2013</b> Ronnie Andrew.</p>
        <p>
        All rights reserved in accordance with
        GPL v3 or later - NO WARRANTIES!</p>
        <p>This application can be used to synchronize folders using <b>rsync</b> as main feature.</p>
        <p><b>Official Website:</b> <a href='http://roandigital.com/applications/synchronizerd'>Roan Digital</a></p>
        <p><b>Platform: </b>%s</p>
        """
            % (__version__, platform.system()),
        )

    def about_box_qt(self):
        QMessageBox.aboutQt(self, "About Qt")

    def about_license(self):
        try:
            f = open(get_file("GNU_HTML"))
            license = QtGui.QDialog()
            license.resize(650, 480)
            license.setWindowTitle("SynchroniZeRD License")
            licenseText = QWebView()
            licenseText.setHtml(f.read())
            layout = QtGui.QGridLayout(license)
            layout.addWidget(licenseText)
            license.exec_()
        except:
            QMessageBox.critical(self, "Error", "Unable to open GNU_HTML License file.")

    def from_open(self):
        chosen_from_dir = self.get_directory()
        self.dir_from = chosen_from_dir + "/"
        print(self.dir_from)
        self.ui.textFrom.setText(self.dir_from)
        pass

    def to_open(self):
        chosen_to_dir = self.get_directory()
        self.dir_to = chosen_to_dir + "/"
        print(self.dir_to)
        self.ui.textTo.setText(self.dir_to)
        pass

    def sync(self):
        self.thread_progress = CheckProgress(self.dir_from, self.dir_to, self.some)
        self.thread_progress.start()
        pass

    def get_directory(self):
        dialog = QtGui.QFileDialog()
        dialog.setFileMode(QtGui.QFileDialog.Directory)
        dialog.setOption(QtGui.QFileDialog.ShowDirsOnly)
        return dialog.getExistingDirectory()

    def exit_menu(self):
        self.close()