예제 #1
0
    def init_ui_body(self):
        """ The ui body """
        # text info (displays rsnapshot output)
        self.text_info = QTextEdit()
        self.text_info.setReadOnly(True)
        self.text_info.setText('choose an hjson file, gringo!')
        # start button
        self.start_button = QLabel('<img src="%s" />' % icon('start-icon.png'))
        self.start_button.mousePressEvent = self.start
        self.start_button.setFixedSize(128, 136)
        # select file
        self.hjson_button = QPushButton(
            self.translate('MainWindow', 'choose hjson file'))
        self.hjson_button.clicked.connect(self.choose_hjson)
        self.hjson_button.setProperty('buttonClass', 'hjsonButton')
        self.hjson_button.setFixedSize(200, 40)
        self.hjson_value_label = QLabel('')
        self.hjson_value_label.setProperty('labelClass', 'hjsonValue')
        # loading icon
        self.loading_movie = QMovie(icon('loader.gif'))
        self.loading = QLabel()
        self.loading.setAlignment(QtCore.Qt.AlignCenter)
        self.loading.setMovie(self.loading_movie)
        self.loading.setHidden(True)

        # add all the stuff to the layout
        self.main_layout.addWidget(self.start_button)
        self.main_layout.addWidget(self.hjson_button)
        self.main_layout.addWidget(self.hjson_value_label)
        self.main_layout.addWidget(self.loading)
        self.main_layout.addWidget(self.text_info)
        self.main_layout.setAlignment(self.start_button, QtCore.Qt.AlignCenter)
        self.main_layout.setAlignment(self.hjson_button, QtCore.Qt.AlignCenter)
        self.main_layout.setAlignment(self.hjson_value_label,
                                      QtCore.Qt.AlignCenter)
예제 #2
0
    def init_ui(self):
        # styles
        ssh_file = style()
        with open(ssh_file, "r") as fh:
            self.setStyleSheet(fh.read())
        # dimensions and positioning
        self.resize(800, 500)
        self.center()
        # window props
        self.setWindowTitle('Otto Backup')
        self.setWindowIcon(QIcon(icon('icon.png')))
        # system tray icon
        self.tray_icon = QSystemTrayIcon(self)
        self.tray_icon.setIcon(QIcon(icon('icon.png')))
        settings_action = QAction(self.translate('MainWindow', 'Settings'),
                                  self)
        settings_action.triggered.connect(self.open_settings_dialog)
        quit_action = QAction(self.translate('MainWindow', 'Quit'), self)
        quit_action.triggered.connect(qApp.quit)
        tray_menu = QMenu()
        tray_menu.addAction(settings_action)
        tray_menu.addAction(quit_action)
        self.tray_icon.setContextMenu(tray_menu)
        self.tray_icon.show()
        # settings
        settingsAct = QAction(QIcon(icon('settings-icon.png')), 'Exit', self)
        settingsAct.setShortcut('Ctrl+S')
        settingsAct.triggered.connect(self.open_settings_dialog)
        # info
        infoAct = QAction(QIcon(icon('info-icon.png')), 'Exit', self)
        infoAct.triggered.connect(self.open_info_dialog)
        # toolbar
        self.toolbar = self.addToolBar('Toolbar')
        self.toolbar.addAction(settingsAct)
        self.toolbar.addAction(infoAct)
        # layout
        self.wid = QWidget(self)
        self.setCentralWidget(self.wid)
        self.main_layout = QVBoxLayout()
        self.main_layout.setSpacing(20)
        self.init_ui_body()
        self.main_layout.addStretch()
        self.wid.setLayout(self.main_layout)
        # status bar
        self.last_sync_message()

        # show
        self.show()
예제 #3
0
    def init_ui(self):
        # styles
        sshFile = style()
        with open(sshFile, "r") as fh:
            self.setStyleSheet(fh.read())
        # dimensions and positioning
        self.resize(500, 300)
        # window props
        self.setObjectName("Info")
        self.setWindowTitle(self.translate('InfoDialog', 'Info'))

        main_layout = QVBoxLayout()
        main_layout.setSpacing(20)

        title = QLabel('<h1>Feed Checker - v1.0.0</h1>')
        title.setAlignment(QtCore.Qt.AlignCenter)
        description = QLabel(
            self.translate('InfoDialog',
                           'Check news-please hjson config for bad sources.'))
        description.setAlignment(QtCore.Qt.AlignCenter)
        image = QLabel('<img src="%s" />' % icon('icon.png'))
        image.setAlignment(QtCore.Qt.AlignCenter)
        main_layout.addWidget(title)
        main_layout.addWidget(description)
        main_layout.addWidget(image)
        main_layout.addStretch()

        self.setLayout(main_layout)

        self.show()
예제 #4
0
    def init_ui(self):
        # styles
        sshFile = style()
        with open(sshFile, "r") as fh:
            self.setStyleSheet(fh.read())
        # dimensions and positioning
        self.resize(500, 300)
        # window props
        self.setObjectName("Info")
        self.setWindowTitle(self.translate('InfoDialog', 'Info'))

        main_layout = QVBoxLayout()
        main_layout.setSpacing(20)

        title = QLabel('<h1>Otto Backup - v1.0.0</h1>')
        title.setAlignment(QtCore.Qt.AlignCenter)
        description = QLabel(
            self.translate(
                'InfoDialog',
                'GUI for the rsnapshot command, manage your backups with ease.'
            ))
        description.setAlignment(QtCore.Qt.AlignCenter)
        image = QLabel('<img src="%s" />' % icon('icon.png'))
        image.setAlignment(QtCore.Qt.AlignCenter)
        main_layout.addWidget(title)
        main_layout.addWidget(description)
        main_layout.addWidget(image)
        main_layout.addStretch()

        self.setLayout(main_layout)

        self.show()
예제 #5
0
    def init_ui_body(self):
        """ The ui body """
        rsnapshot_config_path = self.settings.value('rsnapshot_config_path')
        if rsnapshot_config_path:
            # text info (displays rsnapshot output)
            self.text_info = QTextEdit()
            self.text_info.setReadOnly(True)
            self.text_info.setText('ready...')
            # start button
            self.start_button = QLabel('<img src="%s" />' %
                                       icon('backup-icon.png'))
            self.start_button.mousePressEvent = self.start_backup
            self.start_button.setFixedSize(128, 128)
            # select interval
            items = ['daily', 'weekly', 'monthly']
            self.select_interval = QComboBox(self)
            self.select_interval.addItems(items)
            self.select_interval.setCurrentIndex(0)
            self.select_interval.setFixedSize(140, 30)
            # onchange
            self.select_interval.activated[str].connect(
                self.on_change_interval)
            # noobs description
            self.start_description = QLabel(
                self.translate(
                    'MainWindow', '''<p>Select the backup type and
click the button to start syncing</p>'''))
            self.start_description.setAlignment(QtCore.Qt.AlignCenter)
            # loading icon
            self.loading_movie = QMovie(icon('loader.gif'))
            self.loading = QLabel()
            self.loading.setAlignment(QtCore.Qt.AlignCenter)
            self.loading.setMovie(self.loading_movie)
            self.loading.setHidden(True)

            # add all the stuff to the layout
            self.main_layout.addWidget(self.start_button)
            self.main_layout.addWidget(self.select_interval)
            self.main_layout.addWidget(self.start_description)
            self.main_layout.addWidget(self.loading)
            self.main_layout.addWidget(self.text_info)
            self.main_layout.setAlignment(self.start_button,
                                          QtCore.Qt.AlignCenter)
            self.main_layout.setAlignment(self.select_interval,
                                          QtCore.Qt.AlignCenter)
예제 #6
0
 def __init__(self):
     super(CDATGUIApp, self).__init__(sys.argv)
     self.setApplicationName("CDAT GUI")
     self.setApplicationVersion("0.1b")
     self.setWindowIcon(icon("beta-uvcdat-icon.png"))
     self.win = None
     self.splash = LoadingSplash()
     self.splash.show()
     self.preloadModules()
예제 #7
0
파일: application.py 프로젝트: CDAT/cdatgui
 def __init__(self):
     super(CDATGUIApp, self).__init__(sys.argv)
     self.setApplicationName("CDAT GUI")
     self.setApplicationVersion(info.version)
     self.setWindowIcon(icon(info.icon))
     self.win = None
     self.splash = LoadingSplash()
     self.splash.show()
     self.splash.raise_()
     self.splash.activateWindow()
     self.preloadModules()
예제 #8
0
    def init_ui(self):
        # styles
        sshFile = style()
        with open(sshFile, "r") as fh:
            self.setStyleSheet(fh.read())
        # dimensions and positioning
        self.resize(500, 300)
        # window props
        self.setObjectName("Settings")
        self.setWindowTitle(self.translate('SettingsDialog', 'Settings'))

        main_layout = QVBoxLayout()

        # rsnapshot configuration
        r_title = QLabel('rsnapshot')
        r_title.setProperty('labelClass', 'settingsTitle')
        # rsnapshot path
        r_bin_label = QLabel(
            self.translate('SettingsDialog', 'rsnapshot bin path'))
        r_bin_label.setProperty('labelClass', 'settingsLabel')
        self.r_bin_value = QLabel(self.settings.value('rsnapshot_bin_path'))
        self.r_bin_value.setProperty('labelClass', 'settingsValue')
        r_bin_edit = QPushButton(QIcon(icon('edit-icon.png')), '')
        r_bin_edit.clicked.connect(self.choose_rsnapshot_bin)
        # rsnapshot configuration path
        r_conf_label = QLabel(
            self.translate('SettingsDialog', 'rsnapshot configuration file'))
        r_conf_label.setProperty('labelClass', 'settingsLabel')
        self.r_conf_value = QLabel(
            self.settings.value('rsnapshot_config_path'))
        self.r_conf_value.setProperty('labelClass', 'settingsValue')
        r_conf_edit = QPushButton(QIcon(icon('edit-icon.png')), '')
        r_conf_edit.clicked.connect(self.choose_rsnapshot_config)
        # rsnapshot first interval
        r_first_interval_label = QLabel(
            self.translate('SettingsDialog', 'first backup interval'))
        r_first_interval_label.setProperty('labelClass', 'settingsLabel')
        items = ['', 'daily', 'weekly', 'monthly']
        r_first_interval_value = QComboBox(self)
        r_first_interval_value.addItems(items)
        r_first_interval_value.setProperty('labelClass', 'settingsValue')
        r_first_interval_value.setCurrentIndex(
            items.index(self.settings.value('rsnapshot_first_interval') or ''))
        # onchange
        r_first_interval_value.activated[str].connect(
            self.on_select_first_interval)

        grid = QGridLayout()

        grid.addWidget(r_title, 1, 0)
        grid.addWidget(r_bin_label, 2, 0)
        grid.addWidget(self.r_bin_value, 2, 1)
        grid.addWidget(r_bin_edit, 2, 2)
        grid.addWidget(r_conf_label, 3, 0)
        grid.addWidget(self.r_conf_value, 3, 1)
        grid.addWidget(r_conf_edit, 3, 2)
        grid.addWidget(r_first_interval_label, 4, 0)
        grid.addWidget(r_first_interval_value, 4, 1)

        main_layout.addLayout(grid)
        main_layout.addStretch()

        self.setLayout(main_layout)

        self.show()
예제 #9
0
파일: toolbars.py 프로젝트: CDAT/cdatgui
def init_icons():
    global add_icon, edit_icon, remove_icon
    if add_icon is None or edit_icon is None or remove_icon is None:
        add_icon = icon("edit_add.png")
        edit_icon = icon("edit.png")
        remove_icon = icon("editdelete.png")
예제 #10
0
def init_icons():
    global add_icon, edit_icon, remove_icon
    if add_icon is None or edit_icon is None or remove_icon is None:
        add_icon = icon("edit_add.png")
        edit_icon = icon("edit.png")
        remove_icon = icon("editdelete.png")