예제 #1
0
    def init_ui(self):

        self.version_submit_info_layout = QtWidgets.QHBoxLayout()

        self.user_icon_layout = QtWidgets.QVBoxLayout()
        self.user_icon = UserIconLabel()
        self.user_icon_layout.setAlignment(QtCore.Qt.AlignTop)
        self.user_icon_layout.addWidget(self.user_icon)

        self.version_layout = QtWidgets.QVBoxLayout()
        self.version_layout.setAlignment(QtCore.Qt.AlignTop)
        self.version_layout.setSpacing(0)
        self.user_time_layout = QtWidgets.QHBoxLayout()
        self.user_time_layout.setAlignment(QtCore.Qt.AlignLeft)
        self.user_label = QtWidgets.QLabel()
        self.user_time_layout.addWidget(self.user_label)
        self.user_time_layout.addSpacing(15)
        self.user_time_label = QtWidgets.QLabel()
        self.user_time_label.setStyleSheet(
            'color: rgb({}, {}, {}, 125)'.format(
                self.text_color.red(),
                self.text_color.green(),
                self.text_color.blue(),
            ))
        self.user_time_layout.addWidget(self.user_time_label)
        self.version_description_edit = AutoResizeTextEdit()
        self.version_layout.addLayout(self.user_time_layout)
        self.version_layout.addWidget(self.version_description_edit)
        # self.version_layout.addStretch()
        self.version_submit_info_layout.setAlignment(QtCore.Qt.AlignLeft)
        self.version_submit_info_layout.setContentsMargins(4, 0, 0, 0)
        self.version_submit_info_layout.addLayout(self.user_icon_layout)
        self.version_submit_info_layout.addLayout(self.version_layout)

        self.setLayout(self.version_submit_info_layout)

        self.setSizePolicy(
            QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                  QtWidgets.QSizePolicy.Maximum))

        self.user_label.linkActivated.connect(self.open_link)
예제 #2
0
    def init_ui(self):
        self.user_icon_layout = QtWidgets.QVBoxLayout()
        self.user_icon = UserIconLabel()
        self.user_icon.set_user(self.note_user)
        self.user_icon_layout.setAlignment(QtCore.Qt.AlignTop)
        self.user_icon_layout.addWidget(self.user_icon)

        self.note_layout = QtWidgets.QVBoxLayout()
        self.note_layout.setAlignment(QtCore.Qt.AlignTop)
        self.note_layout.setSpacing(0)
        self.user_time_layout = QtWidgets.QHBoxLayout()
        self.user_time_layout.setAlignment(QtCore.Qt.AlignLeft)
        self.user_time_layout.addSpacing(4)
        self.note_user_name_label = QtWidgets.QLabel(self.note_user_name)
        self.user_time_layout.addWidget(self.note_user_name_label)
        self.user_time_layout.addSpacing(15)
        note_date_label = QtWidgets.QLabel(
            self.note_date.strftime('%Y-%m-%d %H:%M:%S'))
        note_date_label.setStyleSheet('color: rgb({}, {}, {}, 125)'.format(
            self.text_color.red(),
            self.text_color.green(),
            self.text_color.blue(),
        ))
        self.user_time_layout.addWidget(note_date_label)
        self.note_content_edit = AutoResizeTextEdit()
        self.note_content_edit.setText(
            u'{content}'.format(content=self.note_content))
        self.note_layout.addLayout(self.user_time_layout)
        self.note_layout.addWidget(self.note_content_edit)

        self.current_note_layout = QtWidgets.QHBoxLayout()
        self.current_note_layout.addLayout(self.user_icon_layout)
        self.current_note_layout.addSpacing(5)
        self.current_note_layout.addLayout(self.note_layout)

        self.setSizePolicy(
            QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                  QtWidgets.QSizePolicy.Maximum))
예제 #3
0
    def init_ui(self):

        self.version_info_widget = VersionInfoWidget(text_color=self.text_color)
        if self.show_version:
            self.version_info_widget.show()
        else:
            self.version_info_widget.hide()

        self.notes_layout = QtWidgets.QVBoxLayout()
        self.notes_layout.setAlignment(QtCore.Qt.AlignTop)
        self.notes_layout.setContentsMargins(0, 0, 0, 0)

        self.add_note_layout = QtWidgets.QHBoxLayout()

        self.user_icon_layout = QtWidgets.QVBoxLayout()
        self.user_icon = UserIconLabel()
        self.user_icon.set_user(self.current_user)
        self.user_icon_layout.setAlignment(QtCore.Qt.AlignTop)
        self.user_icon_layout.addWidget(self.user_icon)

        self.add_note_edit = AddNoteTextEdit()
        self.add_note_layout.addLayout(self.user_icon_layout)
        self.add_note_layout.addSpacing(8)
        self.add_note_layout.addWidget(self.add_note_edit)
        self.add_note_layout.addStretch()
        self.add_note_layout.setContentsMargins(3, 0, 0, 0)

        self.unsupport_label = QtWidgets.QLabel('unsupported version!')
        self.unsupport_label.setAlignment(QtCore.Qt.AlignCenter)
        self.unsupport_label.setVisible(False)
        self.unsupport_label.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                                                 QtWidgets.QSizePolicy.MinimumExpanding))

        self.show_all_notes_button = QtWidgets.QPushButton('Show All Notes')
        self.show_all_notes_button.clicked.connect(self.show_all_notes)
        self.show_all_notes_button.setStyleSheet("""
        QPushButton{
            background:transparent;
            border:none;
            color: rgb(%s, %s, %s, 100);
        }
        QPushButton:hover{
            color: rgb(%s, %s, %s, 150);
        }
        
        """ % (self.text_color.red(),
               self.text_color.green(),
               self.text_color.blue(),
               self.text_color.red(),
               self.text_color.green(),
               self.text_color.blue(),
               ))
        self.show_all_notes_button.setCursor(QtCore.Qt.PointingHandCursor)
        self.show_all_notes_button.hide()

        self.masterLayout = QtWidgets.QVBoxLayout()
        self.masterLayout.setAlignment(QtCore.Qt.AlignTop)
        self.masterLayout.addWidget(self.version_info_widget)
        self.masterLayout.addWidget(self.show_all_notes_button)
        self.masterLayout.addLayout(self.notes_layout)
        self.masterLayout.addLayout(self.add_note_layout)
        self.masterLayout.addWidget(self.unsupport_label)
        self.masterLayout.addStretch()
        self.setLayout(self.masterLayout)

        self.user_icon.hide()
        self.add_note_edit.hide()

        self.add_note_edit.applyNote.connect(self.add_new_note)