def main():
	import os
	app=QtGui.QApplication(sys.argv)
	print(sys.argv)

	qss_file_path=os.path.join(thlib.get_pyfile_dirname(__file__),'skin','qss','teal.qss')
	getQss,qss=thlib.getQssFile(qss_file_path) # './skin/qss/black.qss'

	if getQss:
		app.setStyleSheet(qss)
		pass

	w=ThCloudDiskWindow(app)
	w.setGeometry(100,100,800,600)
	w.show()
	sys.exit(app.exec_())
Пример #2
0
	def initSkinData(self):
		self.setObjectName('ThSkinDialog')
		#self.setWindowFlags(QtCore.Qt.FramelessWindowHint or QtCore.Qt.Tool)
		#self.setWindowModality(QtCore.Qt.ApplicationModal)
		self.setWindowFlags(QtCore.Qt.Popup)
		self.themeDict={}
		self.themeObjList=[]
		self.themeNameList=[]

		icon_dirname=os.path.dirname(thlib.get_pyfile_dirname(__file__))
		icon_dirname=os.path.dirname(icon_dirname)
		self.hoverIcon=QtGui.QIcon(
			os.path.join(icon_dirname,'skin','icons','appbar.camera.flash.off.selected.png'))
			 # ('./skin/icons/appbar.camera.flash.off.selected.png')

		self.selectedIcon=QtGui.QIcon(
			os.path.join(icon_dirname,'skin','icons','appbar.camera.flash.auto.selected.png'))
Пример #3
0
    def initSkinData(self):
        self.setObjectName('ThSkinDialog')
        #self.setWindowFlags(QtCore.Qt.FramelessWindowHint or QtCore.Qt.Tool)
        #self.setWindowModality(QtCore.Qt.ApplicationModal)
        self.setWindowFlags(QtCore.Qt.Popup)
        self.themeDict = {}
        self.themeObjList = []
        self.themeNameList = []

        icon_dirname = os.path.dirname(thlib.get_pyfile_dirname(__file__))
        icon_dirname = os.path.dirname(icon_dirname)
        self.hoverIcon = QtGui.QIcon(
            os.path.join(icon_dirname, 'skin', 'icons',
                         'appbar.camera.flash.off.selected.png'))
        # ('./skin/icons/appbar.camera.flash.off.selected.png')

        self.selectedIcon = QtGui.QIcon(
            os.path.join(icon_dirname, 'skin', 'icons',
                         'appbar.camera.flash.auto.selected.png'))
Пример #4
0
	def eventFilter(self,obj,event):
		if event.type()==QtCore.QEvent.MouseButtonPress:
			self.close()
			return True
	
		#return super(ThSkinDialog,self).eventFilter(obj,event)
	
		if obj in self.themeObjList:
			if event.type()==QtCore.QEvent.HoverEnter or\
				event.type()==QtCore.QEvent.HoverMove or\
				event.type()==QtCore.QEvent.Enter:
					if 1 != obj.selectedButton.iconFlag:
						obj.selectedButton.setIcon(self.hoverIcon)
						obj.selectedButton.setIconSize(QtCore.QSize(20,20))
						obj.selectedButton.iconFlag=1

					if not obj.selectedButton.isVisible():
						obj.selectedButton.show()

					#改变皮肤
					qss_file_dirname=thlib.get_pyfile_dirname(__file__)
					qss_file_dirname=os.path.dirname(qss_file_dirname)
					qss_file_dirname=os.path.join(qss_file_dirname,'skin','qss')

					getQss,qss=thlib.getQssFile(
						os.path.join(qss_file_dirname,'./skin/qss/%s.qss' % obj.color))
					if getQss:
						self.application.setStyleSheet(qss)

					return True

			if event.type()==QtCore.QEvent.HoverLeave or\
				event.type()==QtCore.QEvent.Leave:
				if 2==obj.selectedButton.iconFlag or obj==self.themeDict[self.currentTheme]:
				#if obj==self.themeDict[self.currentTheme]:
					obj.selectedButton.iconFlag=2
					obj.selectedButton.setIcon(self.selectedIcon)
					obj.selectedButton.setIconSize(QtCore.QSize(20,20))
					obj.selectedButton.show()
				else:
					obj.selectedButton.iconFlag=0
					obj.selectedButton.hide()

					#改变皮肤
					getQss,qss=thlib.getQssFile('./skin/qss/%s.qss' % self.currentTheme)
					if getQss:
						self.application.setStyleSheet(qss)

				return True


			if event.type()==QtCore.QEvent.MouseButtonPress or\
				event.type()==QtCore.QEvent.MouseButtonRelease or\
				event.type()==QtCore.QEvent.MouseButtonDblClick:

				if 2 != obj.selectedButton.iconFlag:
					self.themeDict[self.currentTheme].selectedButton.iconFlag=0
					self.themeDict[self.currentTheme].selectedButton.hide()

					obj.selectedButton.setIcon(self.selectedIcon)
					obj.selectedButton.setIconSize(QtCore.QSize(20,20))
					obj.selectedButton.show()
					obj.selectedButton.iconFlag=2
					self.currentTheme=self.themeNameList[self.themeObjList.index(obj)]
					getQss,qss=thlib.getQssFile('./skin/qss/%s.qss' % self.currentTheme)
					if getQss:
						self.application.setStyleSheet(qss)
					#obj.selectedTheme=1

				return True

		return super(ThSkinDialog,self).eventFilter(obj,event)
Пример #5
0
#!usr/bin/env python
# -*- coding:utf8 -*-

import os
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
from thFrame import thframe
from thLib import thlib
from thclouddiskwindow import ThCloudDiskWindow

if __name__=='__main__':
	
	app=QtGui.QApplication(sys.argv)

	qss_file_path=os.path.join(thlib.get_pyfile_dirname(__file__),'skin','qss','teal.qss')
	getQss,qss=thlib.getQssFile(qss_file_path) # './skin/qss/teal.qss'

	if getQss:
		app.setStyleSheet(qss)
		pass

	w=ThCloudDiskWindow(app)
	w.setGeometry(100,100,800,600)
	w.show()
	sys.exit(app.exec_())
	
Пример #6
0
    def eventFilter(self, obj, event):
        if event.type() == QtCore.QEvent.MouseButtonPress:
            self.close()
            return True

        #return super(ThSkinDialog,self).eventFilter(obj,event)

        if obj in self.themeObjList:
            if event.type()==QtCore.QEvent.HoverEnter or\
             event.type()==QtCore.QEvent.HoverMove or\
             event.type()==QtCore.QEvent.Enter:
                if 1 != obj.selectedButton.iconFlag:
                    obj.selectedButton.setIcon(self.hoverIcon)
                    obj.selectedButton.setIconSize(QtCore.QSize(20, 20))
                    obj.selectedButton.iconFlag = 1

                if not obj.selectedButton.isVisible():
                    obj.selectedButton.show()

                #改变皮肤
                qss_file_dirname = thlib.get_pyfile_dirname(__file__)
                qss_file_dirname = os.path.dirname(qss_file_dirname)
                qss_file_dirname = os.path.join(qss_file_dirname, 'skin',
                                                'qss')

                getQss, qss = thlib.getQssFile(
                    os.path.join(qss_file_dirname,
                                 './skin/qss/%s.qss' % obj.color))
                if getQss:
                    self.application.setStyleSheet(qss)

                return True

            if event.type()==QtCore.QEvent.HoverLeave or\
             event.type()==QtCore.QEvent.Leave:
                if 2 == obj.selectedButton.iconFlag or obj == self.themeDict[
                        self.currentTheme]:
                    #if obj==self.themeDict[self.currentTheme]:
                    obj.selectedButton.iconFlag = 2
                    obj.selectedButton.setIcon(self.selectedIcon)
                    obj.selectedButton.setIconSize(QtCore.QSize(20, 20))
                    obj.selectedButton.show()
                else:
                    obj.selectedButton.iconFlag = 0
                    obj.selectedButton.hide()

                    #改变皮肤
                    getQss, qss = thlib.getQssFile('./skin/qss/%s.qss' %
                                                   self.currentTheme)
                    if getQss:
                        self.application.setStyleSheet(qss)

                return True


            if event.type()==QtCore.QEvent.MouseButtonPress or\
             event.type()==QtCore.QEvent.MouseButtonRelease or\
             event.type()==QtCore.QEvent.MouseButtonDblClick:

                if 2 != obj.selectedButton.iconFlag:
                    self.themeDict[
                        self.currentTheme].selectedButton.iconFlag = 0
                    self.themeDict[self.currentTheme].selectedButton.hide()

                    obj.selectedButton.setIcon(self.selectedIcon)
                    obj.selectedButton.setIconSize(QtCore.QSize(20, 20))
                    obj.selectedButton.show()
                    obj.selectedButton.iconFlag = 2
                    self.currentTheme = self.themeNameList[
                        self.themeObjList.index(obj)]
                    getQss, qss = thlib.getQssFile('./skin/qss/%s.qss' %
                                                   self.currentTheme)
                    if getQss:
                        self.application.setStyleSheet(qss)
                    #obj.selectedTheme=1

                return True

        return super(ThSkinDialog, self).eventFilter(obj, event)