本文整理匯總了Python中GUI.add2List方法的典型用法代碼示例。如果您正苦於以下問題:Python GUI.add2List方法的具體用法?Python GUI.add2List怎麽用?Python GUI.add2List使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GUI
的用法示例。
在下文中一共展示了GUI.add2List方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: addRemotePath
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import add2List [as 別名]
def addRemotePath(self):
self.printIf("addRemotePath: addRemotePath started...")
ip = str(self.ui.lineEdit.text())
user = str(self.ui.lineEdit_2.text())
passwd = str(self.ui.lineEdit_3.text())
remPath = str(self.ui.lineEdit_4.text())
if self.ftp(ip, user, passwd, remPath) == True:
server = str(self.ui.lineEdit.text())
user = str(self.ui.lineEdit_2.text())
passwd = str(self.ui.lineEdit_3.text())
remPath = str(self.ui.lineEdit_4.text())
if self.ui.checkBox_2.checkState() == QtCore.Qt.Checked:
res = True
else:
res = False
remotePath = "%s|%[email protected]%s|%s|%s" %(user, passwd, server, remPath, res)
GUI.add2List(self, remotePath, self.ui.listWidget_2)
self.printIf("ftp: Connection confirmed.")
self.printIf("addRemotePath: addRemotePath successfully done...")
elif self.ftp(ip, user, passwd, remPath) == False:
GUI.err(self, "Connection Failed.\nCheck the server, user name and password or your connection")
self.printIf("addRemotePath: someting went wrong...")
elif self.ftp(ip, user, passwd, remPath) == None:
GUI.err(self, "Check remote directory")
示例2: loadSetting
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import add2List [as 別名]
def loadSetting(self):
self.printIf("loadSetting: loadSetting started...")
try:
if os.path.isfile(".set"):
GUI.takeAllFromList(self, self.ui.listWidget)
GUI.takeAllFromList(self, self.ui.listWidget_2)
f = open(".set", "r")
for i in f:
ln = i.replace("\n","")
if ln.startswith("aa"):
aa = ln.split("=")[1]
isaa, inaa = aa.split("|")
self.ui.spinBox.setValue(int(inaa))
if isaa == "True":
self.ui.groupBox_3.setChecked(True)
else:
self.ui.groupBox_3.setChecked(False)
elif ln.startswith("lp"):
self.printIf("loadSetting: Local Path detected...")
lp = ln.split("=")[1]
GUI.add2List(self, lp, self.ui.listWidget)
elif ln.startswith("rp"):
self.printIf("loadSetting: Remote Path detected...")
rp = ln.split("=")[1]
GUI.add2List(self, rp, self.ui.listWidget_2)
else:
self.printIf("loadSetting: Unknown line in setting file. Skipping...")
except:
self.printIf("loadSetting: Something went wrong...")
示例3: addLocalPath
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import add2List [as 別名]
def addLocalPath(self):
self.printIf("Add local path started...")
try:
odir = GUI.dirSelect(self)
if not odir == "":
if self.ui.checkBox.checkState() == QtCore.Qt.Checked:
res = True
else:
res = False
localPath = "%s|%s" %(odir, res)
GUI.add2List(self, localPath, self.ui.listWidget)
self.printIf("addLocalPath: addLocalPath successfully done...")
else:
self.printIf("addLocalPath: path selection canceled...")
except:
self.printIf("addLocalPath: someting went wrong...")
示例4: getLists
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import add2List [as 別名]
def getLists(self):
it = -1
self.lst = []
for i in GUI.returnAllList(self, self.ui.listWidget):
it = it + 1
self.tab = QtGui.QWidget()
self.tab.setObjectName(("tab%s") %(it))
lDirPath, isRes = i.split("|")
lPath, lDir = self.pathName(lDirPath)
self.ui.tabWidget_2.addTab(self.tab, ("%s" %(lDir)))
self.gridLayout = QtGui.QGridLayout(self.tab)
self.lst.append(QtGui.QListWidget(self.tab))
self.lst[it].setObjectName(("listWidget%s" %(it)))
self.gridLayout.setObjectName("gridLayout")
self.gridLayout.addWidget(self.lst[it], 0, 0, 1, 1)
if isRes == "False":
lFiles = glob.glob("%s/*.h5" %(lDirPath))
for u in lFiles:
if self.isH5(u):
GUI.add2List(self, u, self.lst[it])
elif isRes == "True":
for u in self.listFiles(lDirPath):
if self.isH5(u):
GUI.add2List(self, u, self.lst[it])
self.lst[it].sortItems(1)
for k in GUI.returnAllList(self, self.ui.listWidget_2):
user, passwd = k.split("@")[0].split("|")
ip, rDirPath, isRes = k.split("@")[1].split("|")
if self.ftp(ip, user, passwd, rDirPath) == True:
it = it + 1
self.tab = QtGui.QWidget()
self.tab.setObjectName(("tab%s") %(it))
rPath, rDir = self.pathName(rDirPath)
self.ui.tabWidget_2.addTab(self.tab, ("FTP(%s)" %(rDir)))
self.gridLayout = QtGui.QGridLayout(self.tab)
self.lst.append(QtGui.QListWidget(self.tab))
self.lst[it].setObjectName(("listWidget%s" %(it)))
self.gridLayout.setObjectName("gridLayout")
self.gridLayout.addWidget(self.lst[it], 0, 0, 1, 1)
ftp = FTP(ip)
ftp.login(user, passwd)
self.lst[it].sortItems(1)
ftp.cwd(rDirPath)
data = []
dire = []
files = []
ftp.dir(data.append)
for i in data:
if i.startswith("-"):
files.append(i.split()[len(i.split())-1])
if i.startswith("d"):
dire.append(i.split()[len(i.split())-1])
if isRes == "False":
for u in files:
if u.endswith("h5"):
ln = "%s|%[email protected]%s|%s/%s" %(user, passwd, ip, rDirPath, u)
GUI.add2List(self, ln, self.lst[it])
elif isRes == "True":
for u in files:
if u.endswith("h5"):
ln = "%s|%[email protected]%s|%s/%s" %(user, passwd, ip, rDirPath, u)
GUI.add2List(self, ln, self.lst[it])
for u in dire:
subData = []
ftp.cwd("%s/%s" %(rDirPath, u))
ftp.dir(subData.append)
for l in subData:
if l.endswith("h5"):
ll = l.split()[len(l.split())-1]
ln = "%s|%[email protected]%s|%s/%s/%s" %(user, passwd, ip, rDirPath, u, ll)
GUI.add2List(self, ln, self.lst[it])
elif self.ftp(ip, user, passwd, remPath) == False:
self.printIf("Connection Failed.\nCheck the server, user name and password or your connection")
elif self.ftp(ip, user, passwd, remPath) == None:
self.printIf("Check remote directory")
for i in self.lst:
self.addDisplay(i)
i.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
if self.ui.tabWidget_2.count() > 0:
self.ui.pushButton_6.setEnabled(True)
else:
self.ui.pushButton_6.setEnabled(False)