コード例 #1
0
ファイル: SubjectTile.py プロジェクト: caelan-a/AutoLecture
    def __init__(self, title, semester, year, subject_icon, size):
        QWidget.__init__(self)

        self.confirm_bool = False

        self.main_layout = QVBoxLayout(self)
        self.layout = QVBoxLayout()
        self.policy = QSizePolicy.Maximum
        self.setSizePolicy(self.policy, self.policy)

        self.frame = QPushButton()
        self.frame.setObjectName("subjectFrame")
        self.frame.clicked.connect(self.toggleSelected)

        setStyleSheet(self, "subject_tile")

        self.title = QLabel(title, self)
        self.semester = QLabel("Semester " + semester, self)
        self.year = QLabel(year, self)
        self.year.setObjectName("year")

        if size == "big":
            self.frame.setMinimumSize(BIG_TILE_SIZE[0], BIG_TILE_SIZE[1])
            self.title.setObjectName("title_big")
            self.semester.setObjectName("subtext_big")
            self.year.setObjectName("subtext_big")
        else:
            self.frame.setMinimumSize(SMALL_TILE_SIZE[0], SMALL_TILE_SIZE[1])
            self.title.setObjectName("title_small")
            self.semester.setObjectName("subtext_small")
            self.year.setObjectName("subtext_small")

        #	Setup shadow/glow effect for subject tile
        self.shadow = QGraphicsDropShadowEffect(self)
        self.shadow.setBlurRadius(3)
        self.shadow.setOffset(1, 5)
        self.shadow.setColor(QColor(0, 0, 0, 100))

        self.frame.setGraphicsEffect(self.shadow)

        #	Setup animation for smooth glow effect
        self.shadow_anim = QPropertyAnimation(self.shadow, "blurRadius")
        self.shadow_anim.setDuration(200)
        self.shadow_anim.setEasingCurve(QEasingCurve.OutQuad)

        #	QPushButton used to hold subject specific icon
        self.button_confirm = QPushButton()
        self.button_confirm.setIcon(subject_icon)
        self.button_confirm.setObjectName(
            "tickButton")  #	Refactor/fix object name
        self.button_confirm.clicked.connect(self.toggleSelected)

        self.layout.addWidget(self.button_confirm, 0, Qt.AlignCenter)
        self.layout.addWidget(self.title, 0, Qt.AlignCenter)
        self.layout.addStretch()
        self.layout.addWidget(self.semester, 0, Qt.AlignCenter)
        self.layout.addWidget(self.year, 0, Qt.AlignCenter)
        self.frame.setLayout(self.layout)

        self.main_layout.addWidget(self.frame)
コード例 #2
0
    def __init__(self, assets):
        QWidget.__init__(self)

        setStyleSheet(self, "subject_tile")

        self.setObjectName("downArrow")

        # Size policy
        self.main_layout = QVBoxLayout()
        self.layout = QVBoxLayout()
        self.frame = QPushButton()
        self.frame.setObjectName("downArrow")

        self.down_arrow_widget = FloatingDownArrow(self, "downArrow",
                                                   assets.icon_down_icon)

        self.label_showmore = QLabel("Show Previous Subjects")
        self.label_showmore.setObjectName("greyText")

        self.layout.addWidget(self.label_showmore, 0, Qt.AlignCenter)
        self.layout.addWidget(self.down_arrow_widget, 0, Qt.AlignCenter)

        self.frame.setLayout(self.layout)
        self.main_layout.addWidget(self.frame)
        self.setLayout(self.main_layout)
コード例 #3
0
	def __init__(self, backend_app, width, height):
		QWidget.__init__(self)

		self.backend_app = backend_app

		# Setup Assets
		assets = Assets()

		setStyleSheet(self, "main")

		QApplication.setStyle(QStyleFactory.create('Cleanlooks'))

		self.setMinimumSize(QSize(WIDTH_SCALE_FACTOR*width,HEIGHT_SCALE_FACTOR*height))
		self.setMaximumSize(QSize(WIDTH_SCALE_FACTOR*width,HEIGHT_SCALE_FACTOR*height))

		self.setWindowIcon(QIcon('resources/icons/logo_taskbar.png'))  
		self.setWindowTitle(' ') 

		self.layout = QVBoxLayout()
		self.layout.setContentsMargins(0,0,0,0)
		
		#	Screens 
		self.screen_setup = SetupScreen(backend_app, assets)
		self.screen_settings = SettingsScreen(assets)
		self.screen_menu = MenuScreen(assets)

		self.layout.addWidget(self.screen_setup)
		self.layout.addWidget(self.screen_settings)
		self.layout.addWidget(self.screen_menu)
		
		self.screen_setup.hide()
		self.screen_settings.hide()
		self.screen_menu.hide()

		self.setLayout(self.layout)
コード例 #4
0
    def __init__(self, parent, assets, subject_schedule_frame):
        QWidget.__init__(self)
        self.setParent(parent)
        self.subject_schedule_frame = subject_schedule_frame

        self.layout = QVBoxLayout()

        setStyleSheet(self, "subject_tile")

        # Initialise widget assets
        self.label_question = QLabel("Choose Subjects to Add")
        self.label_question.setObjectName("question")
        self.button_confirm = NextButton("Next")
        self.button_confirm.clicked.connect(self.scheduleSelectedSubjects)

        self.showMoreWidget = ShowMoreWidget(assets)
        self.showMoreWidget.frame.clicked.connect(self.showPastSubjects)

        #	Subject tilesets
        self.current_subjects_tileset = SubjectTileSet(5, assets, "big")
        self.past_subjects_horizontal_list = HorizontalWidgetList(
            assets, "small")

        #	Horizontal scroll area for past subjects
        self.scroll = QScrollArea()
        self.scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.scroll.setFrameShape(QFrame.NoFrame)

        #	Widget Layout
        self.layout.addStretch()
        self.layout.addWidget(self.label_question, 0, Qt.AlignCenter)
        self.layout.addStretch()
        self.layout.addWidget(self.current_subjects_tileset)
        self.layout.addStretch()
        self.layout.addWidget(self.scroll)
        self.layout.addStretch()
        self.layout.addWidget(self.button_confirm, 0, Qt.AlignCenter)

        self.setLayout(self.layout)
コード例 #5
0
ファイル: UserFrame.py プロジェクト: caelan-a/AutoLecture
    def __init__(self, parent):
        super(UserFrame, self).__init__(parent)

        #	Confirmation box for reset
        self.buttonBox = QMessageBox()
        self.buttonBox.addButton(QPushButton("Yes", self),
                                 QMessageBox.AcceptRole)
        self.buttonBox.setText("	Are you sure?")
        self.buttonBox.setWindowTitle(' ')
        self.buttonBox.setWindowIcon(QIcon('resources/icons/logo_taskbar.png'))
        self.buttonBox.setIcon(QMessageBox.NoIcon)

        setStyleSheet(self, "main")

        self.layout = QVBoxLayout()
        self.input_username = InputField("Username", "caelana")
        self.input_password = InputField("Password", "cael1998")
        self.input_downloadpath = InputField("Download Path",
                                             "C:/Users/caelan/Videos")
        self.button_reset = QPushButton("Reset Account")
        self.button_reset.setObjectName("criticalButton")
        self.button_reset.clicked.connect(self.buttonBox.exec_)

        #self.buttonBox.accepted.connect(self.accept)
        #self.buttonBox.rejected.connect(self.reject)

        self.button_save = QPushButton("Save")

        self.layout.addStretch()
        self.layout.addWidget(self.input_username)
        self.layout.addWidget(self.input_password)
        self.layout.addStretch()
        self.layout.addWidget(self.input_downloadpath)
        self.layout.addStretch()
        self.layout.addWidget(self.button_reset, 0, Qt.AlignCenter)
        self.layout.addStretch()
        self.layout.addWidget(self.button_save)

        self.setLayout(self.layout)