-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqlist_client_job.py
78 lines (62 loc) · 2.44 KB
/
qlist_client_job.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import sys
import os
from PyQt4 import QtGui
from PyQt4 import uic
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtCore import pyqtSlot
from PyQt4.QtGui import QAbstractItemView
import time
base, form = uic.loadUiType('tester1.ui')
class Window(base, form):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.setupUi(self)
self.group_modes = QtGui.QButtonGroup()
# adds the QRadioButton widgets to the QButtonGroup container, and
# sets a selection mode constant to each widget id
self.group_modes.addButton(self.rb_single_selection,QAbstractItemView.SingleSelection)
#self.group_modes.addButton(self.test)
#self.group_modes.addButton(self.rb_extended_selection,QAbstractItemView.ExtendedSelection)
#self.group_modes.addButton(self.rb_multi_selection,QAbstractItemView.MultiSelection)
#self.group_modes.addButton(self.rb_no_selection,QAbstractItemView.NoSelection)
# 'buttonClicked()' signal
self.listwidget.setSelectionMode(QAbstractItemView.MultiSelection)
self.group_modes.buttonClicked['int'].connect(self.test)
f=open("iplist.txt","r")
#os.system("rm -f datanodes.txt")
#os.system("touch datanodes.txt")
#g=open("datanodes.txt","w")
line=f.readlines()
strlist = [format(i) for i in line]
self.listwidget.addItems(strlist)
#g.write(format(i))
#self.QListWidget.currentRow(print_info())
#[x.row() for x in self.listwidget.selectedIndexes()]
#time.sleep(5)
#y = self.listwidget.selectedIndexes()
#print y
#print dir(strlist)
@pyqtSlot(int)
def button_clicked(self, id_):
self.listwidget.setSelectionMode(QAbstractItemView.MultiSelection)
def print_info():
print myListWidget.currentRow()
def test(self):
y = [x.row() for x in self.listwidget.selectedIndexes()]
print y
p=open("iplist.txt","r")
o=open("client.txt","a")
line=p.readlines()
for k in y:
o.write(line[k])
o.close()
o=open("client.txt","r")
line=o.readlines()
line[0]=line[0].replace("\n","")
line[1]=line[1].replace("\n","")
os.system("python clientlogin.py "+line[0]+" "+line[1])
application = QtGui.QApplication(sys.argv)
window = Window()
window.show()
sys.exit(application.exec_())