Python + Pyqt
Apparently, this is a note for myself to memorize something.
# -*- coding: utf8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import subprocess
buttonCancel.clicked.connect(eventB)
def eventB():
appW= subprocess.call(r'C:\Program Files\Autodesk\Maya2013\bin\maya.exe',shell=True )
- get all the drives in win
import os
dri_all = [ '%s:' % d for d in dri_all if os.path.exists('%s:' % d)]
- Decryption and Encryption
import win32com.client
def encrypt(key,content): # key,content
EncryptedData = win32com.client.Dispatch('CAPICOM.EncryptedData')
EncryptedData.Algorithm.KeyLength = 5
EncryptedData.Algorithm.Name = 2
EncryptedData.SetSecret(key)
EncryptedData.Content = content
return EncryptedData.Encrypt()
def decrypt(key,content): # key,content
EncryptedData = win32com.client.Dispatch('CAPICOM.EncryptedData')
EncryptedData.Algorithm.KeyLength = 5
EncryptedData.Algorithm.Name = 2
EncryptedData.SetSecret(key)
EncryptedData.Decrypt(content)
str = EncryptedData.Content
return str
s1 = encrypt('lovebread', 'hello world')
s2 = decrypt('lovebread', s1)
print s1,s2
# MGEGCSsGAQQBgjdYA6BUMFIGCisGAQQBgjdYAwGgRDBCAgMCAAECAmYBAgFABAgq
# GpllWj9cswQQh/fnBUZ6ijwKDTH9DLZmBgQYmfaZ3VFyS/lq391oDtjlcRFGnXpx
# lG7o
# hello world
using self.comboBox.activated.connect(self.XXX) #self.XXX is the function will be the slot
def XXX(self. idx): #idx is the singal sended from the comboBox
print 'singal is:' idx
For custom Item
itemList = []
for fileName in os.listdir(os.path.expanduser("~/"):filePath = os.path.join(os.path.expanduser("~/"), fileName)
lineCount = sum(1 for line in open(filePath))item = QtGui.QTreeWidgetItem()
item.setData(0, 0, fileName)
item.setData(1, 0, str(lineCount))
itemList.append(item)