Esempio n. 1
0
 def __init__(self, title, labels):
     QGroupBox.__init__(self, title)
     self.layout = QBoxLayout(QBoxLayout.LeftToRight)
     self.buttons = {}
     for label in labels:
         button = QRadioButton(label)
         self.buttons[label] = button
         self.layout.addWidget(button)
     self.setLayout(self.layout)
Esempio n. 2
0
 def __init__(self, title, labels):
     QGroupBox.__init__(self, title)
     self.layout = QBoxLayout(QBoxLayout.LeftToRight)
     self.buttons = {}
     for label in labels:
         button = QRadioButton(label)
         self.buttons[label] = button
         self.layout.addWidget(button)
     self.setLayout(self.layout)
Esempio n. 3
0
 def __init__(self):
     super(MainWindow, self).__init__()
     layout = QBoxLayout(QBoxLayout.LeftToRight)
     layout.setContentsMargins(0, 0, 0, 0)
     self.hebel = Stellwerkshebel()
     layout.addWidget(self.hebel)
     layout.addStretch()
     self.setLayout(layout)
     self.resize(101, 500)
     self.move(100, 150)
     self.setWindowTitle("Stellwerkshebel Testprogramm")
     self.show()
Esempio n. 4
0
class RadioButtonGroup(QGroupBox):
    def __init__(self, title, labels):
        QGroupBox.__init__(self, title)
        self.layout = QBoxLayout(QBoxLayout.LeftToRight)
        self.buttons = {}
        for label in labels:
            button = QRadioButton(label)
            self.buttons[label] = button
            self.layout.addWidget(button)
        self.setLayout(self.layout)

    def __getitem__(self, label):
        return self.buttons[str(label)]
            
    def __iter__(self):
        return self.buttons.itervalues()
        
    def setVertical(self):
        self.layout.setDirection(QBoxLayout.TopToBottom)
    
    def setHorizontal(self):
        self.layout.setDirection(QBoxLayout.LeftToRight)
            
    def checkedText(self):
        for button in self:
            if button.isChecked():
                return button.text()
Esempio n. 5
0
class RadioButtonGroup(QGroupBox):
    def __init__(self, title, labels):
        QGroupBox.__init__(self, title)
        self.layout = QBoxLayout(QBoxLayout.LeftToRight)
        self.buttons = {}
        for label in labels:
            button = QRadioButton(label)
            self.buttons[label] = button
            self.layout.addWidget(button)
        self.setLayout(self.layout)

    def __getitem__(self, label):
        return self.buttons[str(label)]

    def __iter__(self):
        return self.buttons.itervalues()

    def setVertical(self):
        self.layout.setDirection(QBoxLayout.TopToBottom)

    def setHorizontal(self):
        self.layout.setDirection(QBoxLayout.LeftToRight)

    def checkedText(self):
        for button in self:
            if button.isChecked():
                return button.text()
Esempio n. 6
0
 def __init__(self, sync_manager, network_access_manager, url=None, username=None, password=None, certificate=""):
     self.sync_manager = sync_manager
     self.nam = network_access_manager
     self.certificate = certificate
     self.replies = set()
     super(SettingsWindow, self).__init__()
     self.setWindowIcon(QIcon(os.path.join('icons', 'Logo_sync.png')))
     self.setGeometry(70, 60, 300, 250)
     self.setWindowTitle("c't SESAM Sync Settings")
     layout = QBoxLayout(QBoxLayout.TopToBottom)
     layout.setContentsMargins(0, 0, 0, 0)
     # Header bar
     header_bar = QFrame()
     header_bar.setStyleSheet("QWidget { background: rgb(40, 40, 40); } " +
                              "QToolButton { background: rgb(40, 40, 40); }" +
                              "QToolTip { color: rgb(255, 255, 255); background-color: rgb(20, 20, 20); " +
                              "border: 1px solid white; }")
     header_bar.setAutoFillBackground(True)
     header_bar.setFixedHeight(45)
     header_bar_layout = QBoxLayout(QBoxLayout.RightToLeft)
     header_bar_layout.addStretch()
     header_bar.setLayout(header_bar_layout)
     layout.addWidget(header_bar)
     self.create_header_bar(header_bar_layout)
     self.certificate_loaded.connect(self.test_connection)
     # Main area
     main_area = QFrame()
     main_layout = QBoxLayout(QBoxLayout.TopToBottom)
     main_area.setLayout(main_layout)
     layout.addWidget(main_area)
     self.create_main_area(main_layout, url, username, password)
     # Show the window
     layout.addStretch()
     self.setLayout(layout)
     self.show()
    def init_ui(self):
        # geometry is x offset, y offset, x width, y width
        self.setGeometry(150, 150, 640, 300)
        self.setWindowTitle(self.title)

        menu_bar = self.menuBar()
        file_menu = menu_bar.addMenu('&File')
        exitAction = QAction('E&xit', self)
        exitAction.setStatusTip('Exit the application.')
        exitAction.triggered.connect(self.handle_exit)
        file_menu.addAction(exitAction)

        main_layout_container = QWidget()
        main_layout = QBoxLayout(QBoxLayout.TopToBottom)

        image_layout = QBoxLayout(QBoxLayout.LeftToRight)
        image_layout.addStretch(1)
        self.image1 = QLabel()
        self.image1.setAlignment(Qt.AlignCenter)
        image_layout.addWidget(self.image1)

        image_layout.addWidget(QLabel("vs."))

        self.image2 = QLabel()
        self.image2.setAlignment(Qt.AlignCenter)
        image_layout.addWidget(self.image2)
        image_layout.addStretch(1)

        main_layout.addLayout(image_layout)
        main_layout.addStretch(1)

        button_layout = QBoxLayout(QBoxLayout.LeftToRight)
        button_layout.addStretch(1)
        self.yes_button = QPushButton("Yes")
        button_layout.addWidget(self.yes_button)
        self.yes_button.clicked.connect(self.handle_yes_pressed)

        self.no_button = QPushButton("No")
        button_layout.addWidget(self.no_button)
        self.no_button.clicked.connect(self.handle_no_pressed)
        button_layout.addStretch(1)
        main_layout.addLayout(button_layout)

        main_layout_container.setLayout(main_layout)

        self.image1_filepath = ""
        self.image2_filepath = ""

        self.load_more_images()
        self.setCentralWidget(main_layout_container)
Esempio n. 8
0
 def __init__(self, clipboard):
     super().__init__()
     self.clipboard = clipboard
     self.setWindowIcon(QIcon('Logo_rendered_edited.png'))
     self.layout = QBoxLayout(QBoxLayout.TopToBottom, self)
     self.generator = CtSesam()
     self.iterations = 4096
     # Master password
     self.master_password_label = QLabel("&Master-Passwort:")
     self.maser_password_edit = QLineEdit()
     self.maser_password_edit.setEchoMode(QLineEdit.EchoMode.Password)
     self.maser_password_edit.textChanged.connect(self.reset_iterations)
     self.maser_password_edit.returnPressed.connect(self.move_focus)
     self.maser_password_edit.setMaximumHeight(28)
     self.master_password_label.setBuddy(self.maser_password_edit)
     self.layout.addWidget(self.master_password_label)
     self.layout.addWidget(self.maser_password_edit)
     # Domain
     self.domain_label = QLabel("&Domain:")
     self.domain_edit = QLineEdit()
     self.domain_edit.textChanged.connect(self.reset_iterations)
     self.domain_edit.returnPressed.connect(self.move_focus)
     self.domain_edit.setMaximumHeight(28)
     self.domain_label.setBuddy(self.domain_edit)
     self.layout.addWidget(self.domain_label)
     self.layout.addWidget(self.domain_edit)
     # Username
     self.username_label = QLabel("&Username:"******"Sonderzeichen")
     self.special_characters_checkbox.setChecked(True)
     self.special_characters_checkbox.stateChanged.connect(self.reset_iterations)
     self.layout.addWidget(self.special_characters_checkbox)
     self.letters_checkbox = QCheckBox("Buchstaben")
     self.letters_checkbox.setChecked(True)
     self.letters_checkbox.stateChanged.connect(self.reset_iterations)
     self.layout.addWidget(self.letters_checkbox)
     self.digits_checkbox = QCheckBox("Zahlen")
     self.digits_checkbox.setChecked(True)
     self.digits_checkbox.stateChanged.connect(self.reset_iterations)
     self.layout.addWidget(self.digits_checkbox)
     # Length slider
     self.length_label = QLabel("&Länge:")
     self.length_display = QLabel()
     self.length_label_layout = QBoxLayout(QBoxLayout.LeftToRight)
     self.length_label_layout.addWidget(self.length_label)
     self.length_label_layout.addWidget(self.length_display)
     self.length_label_layout.addStretch()
     self.length_slider = QSlider(Qt.Horizontal)
     self.length_slider.setMinimum(4)
     self.length_slider.setMaximum(20)
     self.length_slider.setPageStep(1)
     self.length_slider.setValue(10)
     self.length_display.setText(str(self.length_slider.sliderPosition()))
     self.length_slider.valueChanged.connect(self.length_slider_changed)
     self.length_label.setBuddy(self.length_slider)
     self.layout.addLayout(self.length_label_layout)
     self.layout.addWidget(self.length_slider)
     # Button
     self.generate_button = QPushButton("Erzeugen")
     self.generate_button.clicked.connect(self.generate_password)
     self.generate_button.setAutoDefault(True)
     self.layout.addWidget(self.generate_button)
     # Password
     self.password_label = QLabel("&Passwort:")
     self.password = QLabel()
     self.password.setTextFormat(Qt.PlainText)
     self.password.setAlignment(Qt.AlignCenter)
     self.password.setFont(QFont("Helvetica", 18, QFont.Bold))
     self.password_label.setBuddy(self.password)
     self.layout.addWidget(self.password_label)
     self.layout.addWidget(self.password)
     # Iteration display
     self.message_label = QLabel()
     self.message_label.setTextFormat(Qt.RichText)
     self.message_label.setVisible(False)
     self.layout.addWidget(self.message_label)
     # Window layout
     self.layout.addStretch()
     self.setGeometry(0, 30, 300, 400)
     self.setWindowTitle("c't SESAM")
     self.maser_password_edit.setFocus()
     self.show()
Esempio n. 9
0
class MainWindow(QWidget):
    # noinspection PyUnresolvedReferences
    def __init__(self, clipboard):
        super().__init__()
        self.clipboard = clipboard
        self.setWindowIcon(QIcon('Logo_rendered_edited.png'))
        self.layout = QBoxLayout(QBoxLayout.TopToBottom, self)
        self.generator = CtSesam()
        self.iterations = 4096
        # Master password
        self.master_password_label = QLabel("&Master-Passwort:")
        self.maser_password_edit = QLineEdit()
        self.maser_password_edit.setEchoMode(QLineEdit.EchoMode.Password)
        self.maser_password_edit.textChanged.connect(self.reset_iterations)
        self.maser_password_edit.returnPressed.connect(self.move_focus)
        self.maser_password_edit.setMaximumHeight(28)
        self.master_password_label.setBuddy(self.maser_password_edit)
        self.layout.addWidget(self.master_password_label)
        self.layout.addWidget(self.maser_password_edit)
        # Domain
        self.domain_label = QLabel("&Domain:")
        self.domain_edit = QLineEdit()
        self.domain_edit.textChanged.connect(self.reset_iterations)
        self.domain_edit.returnPressed.connect(self.move_focus)
        self.domain_edit.setMaximumHeight(28)
        self.domain_label.setBuddy(self.domain_edit)
        self.layout.addWidget(self.domain_label)
        self.layout.addWidget(self.domain_edit)
        # Username
        self.username_label = QLabel("&Username:"******"Sonderzeichen")
        self.special_characters_checkbox.setChecked(True)
        self.special_characters_checkbox.stateChanged.connect(self.reset_iterations)
        self.layout.addWidget(self.special_characters_checkbox)
        self.letters_checkbox = QCheckBox("Buchstaben")
        self.letters_checkbox.setChecked(True)
        self.letters_checkbox.stateChanged.connect(self.reset_iterations)
        self.layout.addWidget(self.letters_checkbox)
        self.digits_checkbox = QCheckBox("Zahlen")
        self.digits_checkbox.setChecked(True)
        self.digits_checkbox.stateChanged.connect(self.reset_iterations)
        self.layout.addWidget(self.digits_checkbox)
        # Length slider
        self.length_label = QLabel("&Länge:")
        self.length_display = QLabel()
        self.length_label_layout = QBoxLayout(QBoxLayout.LeftToRight)
        self.length_label_layout.addWidget(self.length_label)
        self.length_label_layout.addWidget(self.length_display)
        self.length_label_layout.addStretch()
        self.length_slider = QSlider(Qt.Horizontal)
        self.length_slider.setMinimum(4)
        self.length_slider.setMaximum(20)
        self.length_slider.setPageStep(1)
        self.length_slider.setValue(10)
        self.length_display.setText(str(self.length_slider.sliderPosition()))
        self.length_slider.valueChanged.connect(self.length_slider_changed)
        self.length_label.setBuddy(self.length_slider)
        self.layout.addLayout(self.length_label_layout)
        self.layout.addWidget(self.length_slider)
        # Button
        self.generate_button = QPushButton("Erzeugen")
        self.generate_button.clicked.connect(self.generate_password)
        self.generate_button.setAutoDefault(True)
        self.layout.addWidget(self.generate_button)
        # Password
        self.password_label = QLabel("&Passwort:")
        self.password = QLabel()
        self.password.setTextFormat(Qt.PlainText)
        self.password.setAlignment(Qt.AlignCenter)
        self.password.setFont(QFont("Helvetica", 18, QFont.Bold))
        self.password_label.setBuddy(self.password)
        self.layout.addWidget(self.password_label)
        self.layout.addWidget(self.password)
        # Iteration display
        self.message_label = QLabel()
        self.message_label.setTextFormat(Qt.RichText)
        self.message_label.setVisible(False)
        self.layout.addWidget(self.message_label)
        # Window layout
        self.layout.addStretch()
        self.setGeometry(0, 30, 300, 400)
        self.setWindowTitle("c't SESAM")
        self.maser_password_edit.setFocus()
        self.show()

    def length_slider_changed(self):
        self.length_display.setText(str(self.length_slider.sliderPosition()))
        self.reset_iterations()

    def reset_iterations(self):
        self.iterations = 4096
        self.message_label.setVisible(False)
        self.password.setText('')
        self.clipboard.setText('')

    def move_focus(self):
        line_edits = [self.maser_password_edit, self.domain_edit, self.username_edit]
        for i, edit in enumerate(line_edits):
            if edit.hasFocus() and i + 1 < len(line_edits):
                line_edits[i + 1].setFocus()
                return True
        self.generate_button.setFocus()

    def generate_password(self):
        if len(self.domain_edit.text()) <= 0:
            self.reset_iterations()
            self.message_label.setText(
                '<span style="font-size: 10px; color: #aa0000;">Bitte geben Sie eine Domain an.</span>')
            self.message_label.setVisible(True)
            return False
        if self.letters_checkbox.isChecked() or \
           self.digits_checkbox.isChecked() or \
           self.special_characters_checkbox.isChecked():
            self.generator.set_password_characters(
                use_letters=self.letters_checkbox.isChecked(),
                use_digits=self.digits_checkbox.isChecked(),
                use_special_characters=self.special_characters_checkbox.isChecked())
        else:
            self.reset_iterations()
            self.message_label.setText(
                '<span style="font-size: 10px; color: #aa0000;">Bei den aktuellen Einstellungen ' +
                'kann kein Passwort berechnet werden.</span>')
            self.message_label.setVisible(True)
            return False
        password = self.generator.generate(
            master_password=self.maser_password_edit.text(),
            domain=self.domain_edit.text(),
            username=self.username_edit.text(),
            length=self.length_slider.sliderPosition(),
            iterations=self.iterations
        )
        self.password.setText(password)
        self.password.setTextInteractionFlags(Qt.TextSelectableByMouse | Qt.TextSelectableByKeyboard)
        self.clipboard.setText(password)
        self.message_label.setText(
            '<span style="font-size: 10px; color: #888888;">Das Passwort wurde ' + str(self.iterations) +
            ' mal gehasht <br />und in die Zwischenablage kopiert.</span>')
        self.message_label.setVisible(True)
        self.iterations += 1
Esempio n. 10
0
 def __init__(self):
     super(MainWindow, self).__init__()
     self.clip_filename = None
     self.audio_filename = None
     layout = QBoxLayout(QBoxLayout.TopToBottom)
     clip_row = QBoxLayout(QBoxLayout.LeftToRight)
     self.clip_button = QPushButton()
     self.clip_button.clicked.connect(self.open_clip)
     self.clip_button.setText(self.tr("Open clip"))
     clip_row.addWidget(self.clip_button)
     self.clip_view = QLabel()
     clip_row.addWidget(self.clip_view)
     clip_frame = QFrame()
     clip_frame.setLayout(clip_row)
     layout.addWidget(clip_frame)
     audio_row = QBoxLayout(QBoxLayout.LeftToRight)
     self.audio_button = QPushButton()
     self.audio_button.clicked.connect(self.open_audio)
     self.audio_button.setText(self.tr("Open audio"))
     audio_row.addWidget(self.audio_button)
     self.audio_view = QLabel()
     audio_row.addWidget(self.audio_view)
     audio_frame = QFrame()
     audio_frame.setLayout(audio_row)
     layout.addWidget(audio_frame)
     save_row = QBoxLayout(QBoxLayout.LeftToRight)
     self.save_button = QPushButton()
     self.save_button.clicked.connect(self.save)
     self.save_button.setText(self.tr("Save synced clip"))
     save_row.addWidget(self.save_button)
     save_frame = QFrame()
     save_frame.setLayout(save_row)
     layout.addWidget(save_frame)
     self.update_save_button()
     layout.addStretch()
     self.setLayout(layout)
     self.show()
Esempio n. 11
0
 def __init__(self):
     super(MainWindow, self).__init__()
     self.nam = QNetworkAccessManager()
     self.setWindowIcon(QIcon(os.path.join('icons', 'Logo_rendered_edited.png')))
     layout = QBoxLayout(QBoxLayout.TopToBottom)
     layout.setContentsMargins(0, 0, 0, 0)
     self.preference_manager = PreferenceManager()
     self.kgk_manager = KgkManager()
     self.kgk_manager.set_preference_manager(self.preference_manager)
     self.settings_manager = PasswordSettingsManager(self.preference_manager)
     self.setting_dirty = True
     # Header bar
     header_bar = QFrame()
     header_bar.setStyleSheet(
         "QWidget { background: rgb(40, 40, 40); } " +
         "QToolButton { background: rgb(40, 40, 40); }" +
         "QToolTip { color: rgb(255, 255, 255); background-color: rgb(20, 20, 20); " +
         "border: 1px solid white; }")
     header_bar.setAutoFillBackground(True)
     header_bar.setFixedHeight(45)
     header_bar_layout = QBoxLayout(QBoxLayout.LeftToRight)
     header_bar_layout.addStretch()
     header_bar.setLayout(header_bar_layout)
     layout.addWidget(header_bar)
     self.create_header_bar(header_bar_layout)
     # Widget area
     main_area = QFrame()
     main_layout = QBoxLayout(QBoxLayout.TopToBottom)
     main_area.setLayout(main_layout)
     layout.addWidget(main_area)
     self.create_main_area(main_layout)
     # Window layout
     layout.addStretch()
     main_layout.addStretch()
     self.setLayout(layout)
     settings = QSettings()
     size = settings.value("MainWindow/size")
     if not size:
         size = QSize(350, 450)
     self.resize(size)
     position = settings.value("MainWindow/pos")
     if not position:
         position = QPoint(0, 24)
     self.move(position)
     self.setWindowTitle("c't SESAM")
     self.master_password_edit.setFocus()
     self.show()
Esempio n. 12
0
 def __init__(self,
              sync_manager,
              network_access_manager,
              url=None,
              username=None,
              password=None,
              certificate=""):
     self.sync_manager = sync_manager
     self.nam = network_access_manager
     self.certificate = certificate
     self.replies = set()
     super(SettingsWindow, self).__init__()
     self.setWindowIcon(QIcon(os.path.join('icons', 'Logo_sync.png')))
     self.setGeometry(70, 60, 300, 250)
     self.setWindowTitle("c't SESAM Sync Settings")
     layout = QBoxLayout(QBoxLayout.TopToBottom)
     layout.setContentsMargins(0, 0, 0, 0)
     # Header bar
     header_bar = QFrame()
     header_bar.setStyleSheet(
         "QWidget { background: rgb(40, 40, 40); } " +
         "QToolButton { background: rgb(40, 40, 40); }" +
         "QToolTip { color: rgb(255, 255, 255); background-color: rgb(20, 20, 20); "
         + "border: 1px solid white; }")
     header_bar.setAutoFillBackground(True)
     header_bar.setFixedHeight(45)
     header_bar_layout = QBoxLayout(QBoxLayout.RightToLeft)
     header_bar_layout.addStretch()
     header_bar.setLayout(header_bar_layout)
     layout.addWidget(header_bar)
     self.create_header_bar(header_bar_layout)
     self.certificate_loaded.connect(self.test_connection)
     # Main area
     main_area = QFrame()
     main_layout = QBoxLayout(QBoxLayout.TopToBottom)
     main_area.setLayout(main_layout)
     layout.addWidget(main_area)
     self.create_main_area(main_layout, url, username, password)
     # Show the window
     layout.addStretch()
     self.setLayout(layout)
     self.show()
Esempio n. 13
0
 def __init__(self):
     super(MainWindow, self).__init__()
     self.clip_filename = None
     self.audio_filename = None
     layout = QBoxLayout(QBoxLayout.TopToBottom)
     clip_row = QBoxLayout(QBoxLayout.LeftToRight)
     self.clip_button = QPushButton()
     self.clip_button.clicked.connect(self.open_clip)
     self.clip_button.setText(self.tr("Open clip"))
     clip_row.addWidget(self.clip_button)
     self.clip_view = QLabel()
     clip_row.addWidget(self.clip_view)
     clip_frame = QFrame()
     clip_frame.setLayout(clip_row)
     layout.addWidget(clip_frame)
     audio_row = QBoxLayout(QBoxLayout.LeftToRight)
     self.audio_button = QPushButton()
     self.audio_button.clicked.connect(self.open_audio)
     self.audio_button.setText(self.tr("Open audio"))
     audio_row.addWidget(self.audio_button)
     self.audio_view = QLabel()
     audio_row.addWidget(self.audio_view)
     audio_frame = QFrame()
     audio_frame.setLayout(audio_row)
     layout.addWidget(audio_frame)
     save_row = QBoxLayout(QBoxLayout.LeftToRight)
     self.save_button = QPushButton()
     self.save_button.clicked.connect(self.save)
     self.save_button.setText(self.tr("Save synced clip"))
     save_row.addWidget(self.save_button)
     save_frame = QFrame()
     save_frame.setLayout(save_row)
     layout.addWidget(save_frame)
     self.update_save_button()
     layout.addStretch()
     self.setLayout(layout)
     self.show()