예제 #1
0
    def __init__(self, model, parent=None):
        super(MainWindowView, self).__init__(parent=parent)
        self.model = model

        self.ui = main_window_view_ui.Ui_MainWindowView()
        self.ui.setupUi(self)

        MainWindowView.MAX_RECENT_FILES = len(
            self.ui.menu_recent_files.actions())

        MainWindowView.MAX_BOOKMARK_FILES = \
            len(self.ui.menu_recent_bookmarks.actions())

        self.ui.menu_recent_files.menuAction().setVisible(False)

        self.global_shortcuts = self._define_global_shortcuts()
        self.create_connections()
        self.centralize_window()

        self.update_recent_file_actions()

        self.model.load_progress.connect(
            self.ui.statusbar.set_progressbar_value)

        self.vertical_animation = QtCore.QPropertyAnimation(
            self.ui.qscroll_area_viewer.verticalScrollBar())

        self.last_scroll_position = 0
예제 #2
0
 def __init__(
     self, callback,
 ):
     """
     Args:
         callback func(bool): The callback function will receive the current
             state after it is changed due to a click.
     """
     super().__init__()
     self.callback = callback
     self.onBrush = QtGui.QBrush(QtGui.QColor("#569167"))
     self.slotBrush = QtGui.QBrush(QtGui.QColor("#999999"))
     self.switchBrush = self.slotBrush
     self.disabledBrush = QtGui.QBrush(QtGui.QColor("#666666"))
     self.on = False
     self.fullHeight = 18
     self.halfHeight = self.xPos = self.fullHeight / 2
     self.fullWidth = 34
     self.setFixedWidth(self.fullWidth)
     self.slotMargin = 3
     self.slotHeight = self.fullHeight - 2 * self.slotMargin
     self.travel = self.fullWidth - self.fullHeight
     self.slotRect = QtCore.QRect(
         self.slotMargin,
         self.slotMargin,
         self.fullWidth - 2 * self.slotMargin,
         self.slotHeight,
     )
     self.animation = QtCore.QPropertyAnimation(self, b"pqProp", self)
     self.animation.setDuration(120)
     self.setCursor(QtCore.Qt.PointingHandCursor)
예제 #3
0
    def __init__(self, viewer):
        self.viewer = viewer

        # define text
        intro_text = "This is an SN2 reaction with Alkyl Halides involving the nucleophile Hydroxide and the Alkyl Halide Bromomethane."
        self.text_frame0 = TextItem(intro_text, 0, -5)

        step1_text = "The hydroxide molecule approaches Bromomethane."
        self.text_frame1 = TextItem(step1_text, -6, -4.5, step=1)

        step2_text = "Since the hydroxide molecule is negatively charged, one of the electron pairs on the Oxygen attacks the positvely charged Carbon."
        self.text_frame2 = TextItem(step2_text, -6, -4.5, step=2)

        step3_text = "At the same time as the Oxygen attacks the Carbon and begins forming a new bond, the Carbon-Bromine bond is broken since Bromine is a good leaving group."
        self.text_frame3 = TextItem(step3_text, -6, -4.5, step=3)

        step4_text = "The final result is a new bond between the Oxygen in the hydroxide group and the Carbon, and a negatively charged Bromide."
        self.text_frame4 = TextItem(step4_text, -6, -4.5, step=4)

        # define molecules
        self._CH3Br = CH3Br()
        self._OH = OH()
        self._CH3OH = CH3OH()
        self._Br = Br()
        self.molecules = [self._CH3Br, self._OH, self._CH3OH, self._Br]

        # set initial positions of chemicals
        self._OH.set_pos(4, 4)
        self._CH3Br.set_pos(-2, 0)
        self._CH3OH.set_pos(-2, 0)
        self._Br.set_pos(0, 1)

        # define arrow animations
        self.arrowAtReaction = CurveArrow(3, -1, -0.5, 0.5)

        # define molecule animations
        # animation positions are RELAVTIVE TO CURRENT. Not absolute.
        self.R2S2 = QtCore.QPropertyAnimation(self._OH, b'pos')
        self.R2S2.setDuration(1000)
        self.R2S2.setStartValue(QtCore.QPointF(0, 0))
        self.R2S2.setEndValue(QtCore.QPointF(-4, -3))

        self.R2S4 = QtCore.QPropertyAnimation(self._Br, b'pos')
        self.R2S4.setDuration(1500)
        self.R2S4.setStartValue(QtCore.QPointF(0, 0))
        self.R2S4.setKeyValueAt(0.33, QtCore.QPointF(0, 0))
        self.R2S4.setEndValue(QtCore.QPointF(4, 4))
예제 #4
0
 def leaveEvent(self, QEvent):
     #self.infoPanel.setGeometry(QtCore.QRect(0, 200, 500, 46))
     self.pushDown = QtCore.QPropertyAnimation(self.infoPanel, b'geometry')
     self.pushDown.setStartValue(QtCore.QRect(0, 135, 500, 115))
     self.pushDown.setEndValue(QtCore.QRect(0, 200, 500, 46))
     self.pushDown.setEasingCurve(QtCore.QEasingCurve.OutElastic)
     self.pushDown.setDuration(1000)
     self.pushDown.start()
예제 #5
0
파일: GUI.py 프로젝트: J4mesF/ScanMe
    def Animation_ABout_me(self):

        self.anim_AboutMe = QtCore.QPropertyAnimation(self.ABOUT_ME,
                                                      b"geometry")
        self.anim_AboutMe.setDuration(500)
        self.anim_AboutMe.setStartValue(QtCore.QRect(190, 170, 21, 41))
        self.anim_AboutMe.setEndValue(QtCore.QRect(190, 170, 675, 331))
        self.anim_AboutMe.start()
예제 #6
0
 def minFunc(self,name):
     '''最小化函数'''
     self.minAnimation = QtCore.QPropertyAnimation(self,"windowOpacity")
     self.minAnimation.finished.connect(self.showMinimized2)
     self.minAnimation.setDuration(200)
     self.minAnimation.setStartValue(1)
     self.minAnimation.setEndValue(0)
     self.minAnimation.start()
예제 #7
0
    def initLabel(self):
        self.label = MyLabel("")

        self.anim = QtCore.QPropertyAnimation(self.label, b"color")
        self.anim.setDuration(1)
        self.anim.setLoopCount(1)
        self.anim.setStartValue(QtGui.QColor(0, 0, 0))
        self.anim.setEndValue(QtGui.QColor(255, 255, 255))
예제 #8
0
 def setFade(self, widget, flag):
     self.effect = QGraphicsOpacityEffect()
     widget.setGraphicsEffect(self.effect)
     self.animation = QtCore.QPropertyAnimation(self.effect, b"opacity")
     self.animation.setDuration(3000)
     self.animation.setStartValue(flag)
     self.animation.setEndValue(not flag)
     self.animation.start()
예제 #9
0
 def newFrameAnimation(self):
     self.anim = QtCore.QPropertyAnimation(
         self.graph.scene().activeCamera(), b"xRotation")
     self.anim.setDuration(2500)
     self.anim.setStartValue(float(0))
     self.anim.setEndValue(float(100))
     self.anim.setEasingCurve(QtCore.QEasingCurve.OutExpo)
     self.anim.start()
예제 #10
0
 def closeIt(self):
     self.animation = QtCore.QPropertyAnimation(self,"windowOpacity")
     self.animation.finished.connect(QtCore.QCoreApplication.instance().quit)
     self.animation.finished.connect(self.quit)
     self.animation.setDuration(300)
     self.animation.setStartValue(1)
     self.animation.setEndValue(0)
     self.animation.start()
예제 #11
0
 def fade(self, duration: int, start_value: int, end_value: int) -> None:
     self.effect = QtWidgets.QGraphicsOpacityEffect()
     self.setGraphicsEffect(self.effect)
     self.animation = QtCore.QPropertyAnimation(self.effect, b"opacity")
     self.animation.setDuration(FADE_DURATION * 1000)
     self.animation.setStartValue(start_value)
     self.animation.setEndValue(end_value)
     self.animation.start()
예제 #12
0
    def animate(self):
        try:
            self.animated_frame = QtCore.QPropertyAnimation(
                self.frame_animation, b'geometry')
            self.animated_frame.setDuration(10000)
            self.animated_frame.setStartValue(QtCore.QRect(10, 10, 100, 100))
            self.animated_frame.setEndValue(QtCore.QRect(10, 10, 200, 200))
            self.animated_frame.start()
            self.animated_frame.finished.connect(
                lambda: self.frame_animation.setFrameStyle(QtWidgets.QFrame.Box
                                                           ))

            self.animated_lcd = QtCore.QPropertyAnimation(
                self.lcdNumber_animation, b'value')
            self.animated_lcd.setDuration(9000)
            self.animated_lcd.setStartValue(0)
            self.animated_lcd.setEndValue(999)
            self.animated_lcd.start()
            self.animated_lcd.finished.connect(
                lambda: self.lcdNumber_animation.setFrameStyle(QtWidgets.QFrame
                                                               .StyledPanel))

            self.move_toolbutton.change_palette()
            self.animated_toolbutton = QtCore.QPropertyAnimation(
                self.move_toolbutton, b'new_position')
            self.animated_toolbutton.setDuration(9000)
            self.animated_toolbutton.setStartValue(QtCore.QPoint(330, 20))
            self.animated_toolbutton.setKeyValueAt(0.2, QtCore.QPoint(398, 50))
            self.animated_toolbutton.setKeyValueAt(0.5,
                                                   QtCore.QPoint(152, 120))
            self.animated_toolbutton.setKeyValueAt(0.6,
                                                   QtCore.QPoint(420, 240))
            self.animated_toolbutton.setKeyValueAt(0.7,
                                                   QtCore.QPoint(420, 260))
            self.animated_toolbutton.setKeyValueAt(0.9,
                                                   QtCore.QPoint(330, 330))
            self.animated_toolbutton.setKeyValueAt(0.99,
                                                   QtCore.QPoint(330, 310))
            self.animated_toolbutton.setEndValue(QtCore.QPoint(490, 300))
            self.animated_toolbutton.start()

            self.animated_toolbutton.finished.connect(
                lambda: self.move_toolbutton.change_palette(
                    QColor("#00aa00"), QColor("#00aa00")))
        except Exception as e:
            print(e)
예제 #13
0
 def closeFunc(self,name):
     '''窗口关闭函数'''
     self.closeAnimation = QtCore.QPropertyAnimation(self,"windowOpacity")
     self.closeAnimation.setDuration(200)
     self.closeAnimation.setStartValue(1)
     self.closeAnimation.setEndValue(0)
     self.closeAnimation.finished.connect(self.exitFunc)
     self.closeAnimation.start()
예제 #14
0
파일: GUI.py 프로젝트: J4mesF/ScanMe
 def Animation_OUTPUT_URL(self):
     self.OUT_PUT_URL.setGeometry(QtCore.QRect(290, 300, 541, 210))
     self.URL_Out_animation = QtCore.QPropertyAnimation(
         self.OUT_PUT_URL, b"geometry")
     self.URL_Out_animation.setDuration(300)
     self.URL_Out_animation.setStartValue(QtCore.QRect(290, 300, 541, 0))
     self.URL_Out_animation.setEndValue(QtCore.QRect(290, 300, 541, 210))
     self.URL_Out_animation.start()
예제 #15
0
 def __init__(self, parent):
     super().__init__(parent)
     effect = QtWidgets.QGraphicsColorizeEffect(self)
     self.setGraphicsEffect(effect)
     self.color = ((0, 0, 0), (255, 255, 255))
     self.color_selected = 0
     self.anim = QtCore.QPropertyAnimation(effect, b"color")
     self.anim.setDuration(300)
예제 #16
0
    def __init__(self, *args, **kwargs):
        super(QToaster, self).__init__(*args, **kwargs)
        QtWidgets.QHBoxLayout(self)

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

        self.setStyleSheet('''
            QToaster {
                border: 1px solid black;
                border-radius: 0px;
                color: rgb(255, 255, 255);
                background-color: rgb(57, 66, 81);
            }
        ''')

        # alternatively:
        # self.setAutoFillBackground(True)
        # self.setFrameShape(self.Box)

        self.timer = QtCore.QTimer(singleShot=True, timeout=self.hide)

        if self.parent():
            self.opacityEffect = QtWidgets.QGraphicsOpacityEffect(opacity=0)
            self.setGraphicsEffect(self.opacityEffect)
            self.opacityAnimation = QtCore.QPropertyAnimation(
                self.opacityEffect, b"opacity")

            # We have a parent, install an eventFilter so that when it's resized
            # the notification will be correctly moved to the right corner
            self.parent().installEventFilter(self)
        else:
            # There's no parent, use the window opacity property, assuming that
            # the window manager supports it; if it doesn't, this won'd do
            # anything (besides making the hiding a bit longer by half a second)
            self.opacityAnimation = QtCore.QPropertyAnimation(
                self, b'windowOpacity')

        self.opacityAnimation.setStartValue(0.0)
        self.opacityAnimation.setEndValue(1.0)
        self.opacityAnimation.setDuration(100)
        self.opacityAnimation.finished.connect(self.checkClosed)

        self.corner = QtCore.Qt.TopLeftCorner
        self.margin = 10
예제 #17
0
    def unfade(self, widget):
        self.effect = QGraphicsOpacityEffect()
        widget.setGraphicsEffect(self.effect)

        self.animation = QtCore.QPropertyAnimation(self.effect, b"opacity")
        self.animation.setDuration(500)
        self.animation.setStartValue(0)
        self.animation.setEndValue(1)
        self.animation.start()
예제 #18
0
    def doAnim(self):

        self.anim1 = QtCore.QPropertyAnimation(self, b"windowOpacity")
        self.anim1.setDuration(400)
        self.anim1.setStartValue(1)
        self.anim1.setEndValue(0)

        self.tabWidget.setCurrentIndex(1)
        self.anim2 = QtCore.QPropertyAnimation(self, b"windowOpacity")
        self.anim2.setDuration(400)
        self.anim2.setStartValue(0)
        self.anim2.setEndValue(1)

        self.squenc_anims = QtCore.QSequentialAnimationGroup()
        self.squenc_anims.addAnimation(self.anim1)
        self.squenc_anims.addAnimation(self.anim2)

        self.squenc_anims.start(QtCore.QAbstractAnimation.DeleteWhenStopped)
예제 #19
0
	def slideInWgt(self, newwidget):
		if self.m_active:
			return

		self.m_active = True

		_now = self.currentIndex()
		_next = self.indexOf(newwidget)

		if _now == _next:
			self.m_active = False
			return

		offsetx, offsety = self.frameRect().width(), self.frameRect().height()
		self.widget(_next).setGeometry(self.frameRect())

		if not self.m_direction == QtCore.Qt.Horizontal:
			if _now < _next:
				offsetx, offsety = 0, -offsety
			else:
				offsetx = 0
		else:
			if _now < _next:
				offsetx, offsety = -offsetx, 0
			else:
				offsety = 0

		pnext = self.widget(_next).pos()
		pnow = self.widget(_now).pos()
		self.m_pnow = pnow

		offset = QtCore.QPoint(offsetx, offsety)
		self.widget(_next).move(pnext - offset)
		self.widget(_next).show()
		self.widget(_next).raise_()

		anim_group = QtCore.QParallelAnimationGroup(
			self, finished=self.animationDoneSlot
		)

		for index, start, end in zip(
			(_now, _next), (pnow, pnext - offset), (pnow + offset, pnext)
		):
			animation = QtCore.QPropertyAnimation(
				self.widget(index),
				b"pos",
				duration=self.m_speed,
				easingCurve=self.m_animationtype,
				startValue=start,
				endValue=end,
			)
			anim_group.addAnimation(animation)

		self.m_next = _next
		self.m_now = _now
		self.m_active = True
		anim_group.start(QtCore.QAbstractAnimation.DeleteWhenStopped)
예제 #20
0
파일: GUI.py 프로젝트: J4mesF/ScanMe
 def URL_Animation(self):
     self.anim_FileScan_Filename = QtCore.QPropertyAnimation(
         self.widget_URl_scan, b"geometry")
     self.anim_FileScan_Filename.setDuration(300)
     self.anim_FileScan_Filename.setStartValue(QtCore.QRect(
         290, 240, 0, 48))
     self.anim_FileScan_Filename.setEndValue(QtCore.QRect(
         290, 240, 541, 48))
     self.anim_FileScan_Filename.start()
예제 #21
0
 def unfade(self, widget):
     self.unfade_effect = QtWidgets.QGraphicsOpacityEffect()
     widget.setGraphicsEffect(self.unfade_effect)
     self.unfade_animation = QtCore.QPropertyAnimation(
         self.unfade_effect, b"opacity")
     self.unfade_animation.setDuration(250)
     self.unfade_animation.setStartValue(.1)
     self.unfade_animation.setEndValue(1)
     return self.unfade_animation
 def animate(self):
     self.animated_frame = QtCore.QPropertyAnimation(
         self.ui.frame, b'geometry')
     self.animated_frame.setDuration(10000)
     self.animated_frame.setStartValue(QtCore.QRect(10, 10, 100, 100))
     self.animated_frame.setEndValue(QtCore.QRect(10, 10, 200, 200))
     self.animated_frame.start()
     self.animated_frame.finished.connect(
         lambda: self.ui.frame.setFrameStyle(QtWidgets.QFrame.Box))
예제 #23
0
 def __init__(self, *args):
     super(AnimatedFrame, self).__init__(*args)
     bytear = QtCore.QByteArray()
     bytear.append('bgcolor')
     self.anim = QtCore.QPropertyAnimation(self, bytear)
     self.anim.setStartValue(QtGui.QColor(236, 236, 236))
     self.anim.setKeyValueAt(0.5, QtGui.QColor(117, 80, 123))
     self.anim.setEndValue(QtGui.QColor(52, 120, 184))
     self.anim.setDuration(2500)
     self.anim.setLoopCount(1)
예제 #24
0
    def fade_in(self, widget, time=1000, start=0, end=1):
        fading_effect = QtWidgets.QGraphicsOpacityEffect()
        widget.setGraphicsEffect(fading_effect)

        self.fading_in_animation = QtCore.QPropertyAnimation(
            fading_effect, b"opacity")
        self.fading_in_animation.setDuration(time)
        self.fading_in_animation.setStartValue(start)
        self.fading_in_animation.setEndValue(end)
        return self.fading_in_animation
예제 #25
0
 def anim(self):
     self.color_anim = QtCore.QPropertyAnimation(self, b'backColor')
     color1 = QtGui.QColor(255, 0, 0)
     color2 = QtGui.QColor(0, 255, 0)
     self.color_anim.setStartValue(color1)
     self.color_anim.setKeyValueAt(0.5, color2)
     self.color_anim.setEndValue(color1)
     self.color_anim.setDuration(1000)
     self.color_anim.setLoopCount(1)
     self.color_anim.start()
예제 #26
0
    def fade_in_label(self):
        self.picture_label.effect = QGraphicsOpacityEffect()
        self.picture_label.setGraphicsEffect(self.picture_label.effect)

        self.picture_label.animation = QtCore.QPropertyAnimation(
            self.picture_label.effect, b"opacity")
        self.picture_label.animation.setDuration(500)
        self.picture_label.animation.setStartValue(0)
        self.picture_label.animation.setEndValue(1)
        self.picture_label.animation.start()
예제 #27
0
 def showFullScreen3(self):
     if not self.isFullScreen():
         self.main_layout.setContentsMargins(0,0,0,0)
         self.animation = QtCore.QPropertyAnimation(self,"geometry")
         self.animation.setDuration(180)
         self.animation.setStartValue(self.geometry())
         self.animation.setEndValue(self.desktop.availableGeometry(self.desktop.screenNumber(self.widget)))
         self.animation.finished.connect(self.showFullScreen2)
         self.animationEndFlag = 0
         self.animation.start()
예제 #28
0
    def hideDetails(self):
        self._dialogGridLayout.removeWidget(self._descriptionQTextEdit)
        self._descriptionQTextEdit.hide()
        self._showMoreButton.setText('Show Details')
        self._showMoreButton.clicked.connect(self.showDetails)

        animation = QtCore.QPropertyAnimation(self, b'size', self)
        animation.setDuration(150)
        animation.setEndValue(self.sizeHint())
        animation.start()
예제 #29
0
 def DeleteTabPanelButton(self, panel):
     end_one = len(panel.Buttons) - 1
     aimBtn = ''
     for i in range(0, len(panel.Buttons) - 1, 1):
         if panel.Buttons[i].isEnabled() is False:
             aimBtn = panel.Buttons[i].text()
             panel.Buttons[i].deleteLater()
             panel.Buttons.remove(panel.Buttons[i])
         animation = QtCore.QPropertyAnimation(self)
         animation.setDuration(150)
         animation.setPropertyName(b'pos')
         animation.setTargetObject(panel.Buttons[i])
         animation.setStartValue(panel.Buttons[i].pos())
         r = i // 12
         w = i % 12
         animation.setEndValue(
             QtCore.QPoint(panel.GrimBox[w], panel.GrimBox[r]))
         animation.start()
     try:
         if panel.Buttons[end_one].isEnabled() is False:
             aimBtn = panel.Buttons[end_one].text()
             panel.Buttons[end_one].deleteLater()
             panel.Buttons.remove(panel.Buttons[end_one])
     except:
         pass
     i = len(panel.Buttons)
     animation = QtCore.QPropertyAnimation(self)
     animation.setDuration(150)
     animation.setPropertyName(b'pos')
     animation.setTargetObject(panel.TheAddButton)
     animation.setStartValue(panel.TheAddButton.pos())
     r = i // 12
     w = i % 12
     animation.setEndValue(QtCore.QPoint(panel.GrimBox[w],
                                         panel.GrimBox[r]))
     animation.start()
     if aimBtn != '':
         conn = sqlite3.connect('./Resources/DIY.sqlite')
         cu = conn.cursor()
         cu.execute('DELETE from \'' + panel.objectName() +
                    '\' where BTNNAME=\'' + aimBtn + '\';')
         conn.commit()
         conn.close()
예제 #30
0
 def __init__(self, main_ui):
     super(wizard_desktop, self).__init__()
     self.ui = Ui_Form()
     self.ui.setupUi(self)
     self.main_ui = main_ui
     self.main_ui.move_signal.connect(self.move2ScreenTop)
     self.displace_animation = QtCore.QPropertyAnimation(self, b"pos", self)
     self.init_y = -75
     self.end_y = -4
     self.connect_functions()