def __init__(self, parent=None):
super(self.__class__, self).__init__(parent=parent)
self.setObjectName('TacticDock')
self.setLayout(QtGui.QVBoxLayout())
self.window = lib.ui_main_classes.Ui_Main()
env.Inst.ui_standalone = self.window
self.layout().addWidget(self.window)
self.layout().setSpacing(0)
self.layout().setContentsMargins(0, 0, 0, 0)
self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
python类QVBoxLayout()的实例源码
def setupUi(self):
"""Bruh"""
self.setGeometry(50, 50, 450, 250)
self.setWindowTitle("ZeZe's TWTools - Updating Servers")
self.setWindowIcon(QtGui.QIcon(resource_path("images/icon.png")))
"""Background color"""
self.backgroundPalette = QtGui.QPalette()
self.backgroundColor = QtGui.QColor(217, 204, 170)
self.backgroundPalette.setColor(QtGui.QPalette.Background, self.backgroundColor)
self.setPalette(self.backgroundPalette)
"""Layout"""
self.verticalLayout = QtGui.QVBoxLayout(self)
self.text = QtGui.QLabel("Updating server list:")
self.verticalLayout.addWidget(self.text)
"""Download bar"""
self.progress_bar = QtGui.QProgressBar(self)
self.progress_bar.setMinimum(0)
self.progress_bar.setMaximum(27)
self.progress_bar.setValue(0)
self.progress_bar.setFormat("%v / %m")
self.verticalLayout.addWidget(self.progress_bar)
"""Text browser for progress"""
self.progress_text = QtGui.QTextBrowser(self)
self.verticalLayout.addWidget(self.progress_text)
"""Button"""
self.horizontalLayout = QtGui.QHBoxLayout(self)
self.verticalLayout.addLayout(self.horizontalLayout)
self.Spacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(self.Spacer)
self.cancelButton = QtGui.QPushButton("Cancel")
self.horizontalLayout.addWidget(self.cancelButton)
self.cancelButton.clicked.connect(self.cancel_function)
def runwid(text):
w=QtGui.QWidget()
w.setStyleSheet("QLabel { color: rgb(255, 0, 0); font-size: 20px; background-color: rgba(255, 255, 100, 100); border: 1px solid rgba(188, 188, 188, 250); }")
w.setGeometry(800, 400, 10, 10)
box = QtGui.QVBoxLayout()
w.setLayout(box)
w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
l=QtGui.QLabel(text)
box.addWidget(l)
return w
def dialog(fn):
w=QtGui.QWidget()
box = QtGui.QVBoxLayout()
w.setLayout(box)
w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
l=QtGui.QLabel("Path to Image" )
box.addWidget(l)
w.anz = QtGui.QLineEdit()
w.anz.setText(fn)
box.addWidget(w.anz)
loff=QtGui.QLabel("Offset Border" )
box.addWidget(loff)
w.off = QtGui.QLineEdit()
w.off.setText("100")
box.addWidget(w.off)
w.rotpos=QtGui.QCheckBox("Rot +90")
box.addWidget(w.rotpos)
w.rotneg=QtGui.QCheckBox("Rot -90")
box.addWidget(w.rotneg)
w.rot180=QtGui.QCheckBox("Rot 180")
box.addWidget(w.rot180)
w.r=QtGui.QPushButton("run")
box.addWidget(w.r)
w.r.pressed.connect(lambda :runw(w))
w.show()
return w
def __init__(self, dialer,obj,menu,noclose,*args):
QtGui.QWidget.__init__(self, *args)
obj.widget=self
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
self.vollabel =QtGui.QLabel( "<b>"+obj.Object.Label+"</b>")
if dialer:
dial = QtGui.QDial()
dial.setNotchesVisible(True)
self.dial=dial
dial.setMaximum(100)
dial.valueChanged.connect(obj.dialer);
layout = QtGui.QVBoxLayout()
layout.addWidget(self.vollabel)
for m in menu:
bt=QtGui.QPushButton(m[0])
bt.clicked.connect(m[1])
layout.addWidget(bt)
if dialer:
layout.addWidget(dial)
if not noclose:
self.pushButton02 = QtGui.QPushButton("close")
self.pushButton02.clicked.connect(self.hide)
layout.addWidget(self.pushButton02)
self.setLayout(layout)
try:
self.setWindowTitle(obj.Object.target.Label)
except:
pass
def generateWidget( self, idGDT, ContainerOfData ):
self.idGDT = idGDT
self.ContainerOfData = ContainerOfData
self.group = QtGui.QGroupBox(self.Text)
vbox = QtGui.QVBoxLayout()
for l in self.List:
vbox.addLayout(l.generateWidget(self.idGDT, self.ContainerOfData))
self.group.setLayout(vbox)
return self.group
def setupUI(self):
mainLayout = QtGui.QVBoxLayout()
self.setLayout(mainLayout)
self.buttonLayout = QtGui.QHBoxLayout()
self.msg = QtGui.QLabel()
self.addTaskButton = QtGui.QPushButton('Add Task')
self.addTaskButton.setToolTip('Add a new task to the list')
self.sortButton = QtGui.QPushButton('Reverse Sorting')
self.sortButton.setCheckable(True)
self.sortButton.setToolTip('Push to sort so highest priorities are at the top,\notherwise lowest will be at the top.')
self.helpButton = QtGui.QPushButton('?')
self.helpButton.setMaximumWidth(30)
self.helpButton.setFlat(True)
self.helpButton.setToolTip(self.__helpText())
self.hideButton = QtGui.QPushButton('Hide Finished Tasks')
self.hideButton.setCheckable(True)
self.hideButton.setToolTip('Hide finished tasks to keep the list tidy')
self.clipboardButton = QtGui.QPushButton('Copy To Clipboard')
self.clipboardButton.setToolTip('Push to copy current task info to cliboard for pasting into emails or other text documents.\nHandy to keep those coordinators happy.')
self.buttonLayout.addWidget(self.addTaskButton)
self.buttonLayout.addWidget(self.sortButton)
self.buttonLayout.addWidget(self.hideButton)
self.buttonLayout.addWidget(self.clipboardButton)
self.buttonLayout.addSpacing(20)
self.buttonLayout.addWidget(self.helpButton)
self.layout().addWidget(self.msg)
self.layout().addLayout(self.buttonLayout)
self.taskContainer = QtGui.QWidget()
self.scrollArea = QtGui.QScrollArea()
self.scrollArea.setWidget(self.taskContainer)
self.layout().addWidget(self.scrollArea)
self.createTaskWidgets()
self.update()
def mouseReleaseEvent(self, e):
super(CorrelationTableDisplay, self).mouseReleaseEvent(e)
if not(self.Selectionmode):
regionIDS = []
for i in self.selectedItems():
regionIDS.append((i.row(), i.column()))
regionIDS = np.asarray(regionIDS)
CorrelationTable = self
def newwindow(BoxWidget):
i,j = np.amin(regionIDS, axis=0)
k,l = np.amax(regionIDS, axis=0)
np.reshape(regionIDS,(k-i+1,l-j+1,2))
self.bbox = QtGui.QVBoxLayout()
# Number of region ids selected and transfered to teh new window
NewTable = NewWindowCorrelationTableDisplay(k-i+1,l-j+1,i,k,j,l,CorrelationTable,regionIDS)
self.bbox.addWidget(NewTable)
BoxWidget.setLayout(self.bbox)
# FIX me resizing table contents with hardcoded values
BoxWidget.resize(18*(l-j)+120,18*(k-i+1)+140)
# BoxWidget.resize(18*(l-j)+120,18*(k-i+1)+140)
if self.First:
self.newWindowWidget.append(QtGui.QWidget())
newwindow(self.newWindowWidget[0])
self.newWindowWidget[0].show()
self.First = False
else:
self.i = self.i + 1
self.newWindowWidget.append(QtGui.QWidget())
newwindow(self.newWindowWidget[self.i])
self.newWindowWidget[self.i].show()
def mouseReleaseEvent(self, e):
super(CorrelationTableDisplay, self).mouseReleaseEvent(e)
if not(self.Selectionmode):
regionIDS = []
for i in self.selectedItems():
regionIDS.append((i.row(), i.column()))
regionIDS = np.asarray(regionIDS)
CorrelationTable = self
def newwindow(BoxWidget):
i,j = np.amin(regionIDS, axis=0)
k,l = np.amax(regionIDS, axis=0)
np.reshape(regionIDS,(k-i+1,l-j+1,2))
self.bbox = QtGui.QVBoxLayout()
NewTable = NewWindowCorrelationTableDisplay(k-i+1,l-j+1,i,k,j,l,CorrelationTable,regionIDS)
self.bbox.addWidget(NewTable)
BoxWidget.setLayout(self.bbox)
# FIX me resizing table contents with hardcoded values
BoxWidget.resize(18*(l-j)+120,18*(k-i+1)+140)
if self.First:
self.newWindowWidget.append(QtGui.QWidget())
newwindow(self.newWindowWidget[0])
self.newWindowWidget[0].show()
self.First = False
else:
self.i = self.i + 1
self.newWindowWidget.append(QtGui.QWidget())
newwindow(self.newWindowWidget[self.i])
self.newWindowWidget[self.i].show()
def __init__(self, session, parent):
super(SummaryPlotDialog, self).__init__()
# Center it on the parent location
rect = parent.geometry()
x, y = rect.center().x(), rect.center().y()
w = 1000
h = 640
self.setGeometry(x-w/2, y-h/2, w, h)
vbox = QtGui.QVBoxLayout(self)
figure_widget = mpl.MPLWidget(None, tight_layout=True)
vbox.addWidget(figure_widget)
session.make_summary_plot(figure_widget.figure)
def __init__(self, parent=None, win=None, current_class=None, class_analysis=None):
super(XrefDialogClass, self).__init__(parent)
self.current_class = current_class
self.class_analysis = class_analysis
title = "Xrefs for the class %s" % current_class
self.setWindowTitle(title)
xrefs_list = []
ref_kind_map = {0:"Class instanciation", 1:"Class reference"}
xrefs_from = class_analysis.get_xref_from()
for ref_class in xrefs_from:
for ref_kind, ref_method in xrefs_from[ref_class]:
xrefs_list.append(('From', ref_kind_map[ref_kind], ref_method, ref_class.get_vm_class()))
xrefs_to = class_analysis.get_xref_to()
for ref_class in xrefs_to:
for ref_kind, ref_method in xrefs_to[ref_class]:
xrefs_list.append(('To', ref_kind_map[ref_kind], ref_method, ref_class.get_vm_class()))
closeButton = QtGui.QPushButton("Close")
closeButton.clicked.connect(self.close)
xreflayout = QtGui.QGridLayout()
xrefwin = XrefListView(self, win=win, xrefs=xrefs_list, headers=["Origin", "Kind", "Method"])
xreflayout.addWidget(xrefwin, 0, 0)
buttonsLayout = QtGui.QHBoxLayout()
buttonsLayout.addStretch(1)
buttonsLayout.addWidget(closeButton)
mainLayout = QtGui.QVBoxLayout()
mainLayout.addLayout(xreflayout)
mainLayout.addLayout(buttonsLayout)
self.setLayout(mainLayout)
def __init__(self, parent=None, win=None, current_class=None, class_analysis=None, method_analysis=None):
super(XrefDialogMethod, self).__init__(parent)
self.current_class = current_class
self.class_analysis = class_analysis
self.method_analysis = method_analysis
title = "Xrefs for the method %s" % self.method_analysis.method
self.setWindowTitle(title)
xrefs_list = []
xrefs_from = self.method_analysis.get_xref_from()
for ref_class, ref_method in xrefs_from:
xrefs_list.append(('From', ref_method, ref_class.get_vm_class()))
xrefs_to = self.method_analysis.get_xref_to()
for ref_class, ref_method in xrefs_to:
xrefs_list.append(('To', ref_method, ref_class.get_vm_class()))
closeButton = QtGui.QPushButton("Close")
closeButton.clicked.connect(self.close)
xreflayout = QtGui.QGridLayout()
xrefwin = XrefListView(self, win=win, xrefs=xrefs_list)
xreflayout.addWidget(xrefwin, 0, 0)
buttonsLayout = QtGui.QHBoxLayout()
buttonsLayout.addStretch(1)
buttonsLayout.addWidget(closeButton)
mainLayout = QtGui.QVBoxLayout()
mainLayout.addLayout(xreflayout)
mainLayout.addLayout(buttonsLayout)
self.setLayout(mainLayout)
def __init__(self, parent=None, win=None, current_class=None, class_analysis=None, field_analysis=None):
super(XrefDialogField, self).__init__(parent)
self.current_class = current_class
self.class_analysis = class_analysis
self.field_analysis = field_analysis
title = "Xrefs for the field %s" % self.field_analysis.field
self.setWindowTitle(title)
xrefs_list = []
xrefs_read = self.field_analysis.get_xref_read()
for ref_class, ref_method in xrefs_read:
xrefs_list.append(('Read', ref_method, ref_class.get_vm_class()))
xrefs_write = self.field_analysis.get_xref_write()
for ref_class, ref_method in xrefs_write:
xrefs_list.append(('Write', ref_method, ref_class.get_vm_class()))
closeButton = QtGui.QPushButton("Close")
closeButton.clicked.connect(self.close)
xreflayout = QtGui.QGridLayout()
xrefwin = XrefListView(self, win=win, xrefs=xrefs_list)
xreflayout.addWidget(xrefwin, 0, 0)
buttonsLayout = QtGui.QHBoxLayout()
buttonsLayout.addStretch(1)
buttonsLayout.addWidget(closeButton)
mainLayout = QtGui.QVBoxLayout()
mainLayout.addLayout(xreflayout)
mainLayout.addLayout(buttonsLayout)
self.setLayout(mainLayout)
def __init__(self, parent=None, win=None, string_analysis=None):
super(XrefDialogString, self).__init__(parent)
self.string_analysis = string_analysis
title = "Xrefs for the string %s" % self.string_analysis.value
self.setWindowTitle(title)
xrefs_list = []
xrefs_from = self.string_analysis.get_xref_from()
for ref_class, ref_method in xrefs_from:
xrefs_list.append(('From', ref_method, ref_class.get_vm_class()))
closeButton = QtGui.QPushButton("Close")
closeButton.clicked.connect(self.close)
xreflayout = QtGui.QGridLayout()
xrefwin = XrefListView(self, win=win, xrefs=xrefs_list)
xreflayout.addWidget(xrefwin, 0, 0)
buttonsLayout = QtGui.QHBoxLayout()
buttonsLayout.addStretch(1)
buttonsLayout.addWidget(closeButton)
mainLayout = QtGui.QVBoxLayout()
mainLayout.addLayout(xreflayout)
mainLayout.addLayout(buttonsLayout)
self.setLayout(mainLayout)
def __init__(self, parent=None, win=None, current_class=None, class_analysis=None):
super(XrefDialogClass, self).__init__(parent)
self.current_class = current_class
self.class_analysis = class_analysis
title = "Xrefs for the class %s" % current_class
self.setWindowTitle(title)
xrefs_list = []
ref_kind_map = {0:"Class instanciation", 1:"Class reference"}
xrefs_from = class_analysis.get_xref_from()
for ref_class in xrefs_from:
for ref_kind, ref_method in xrefs_from[ref_class]:
xrefs_list.append(('From', ref_kind_map[ref_kind], ref_method, ref_class.get_vm_class()))
xrefs_to = class_analysis.get_xref_to()
for ref_class in xrefs_to:
for ref_kind, ref_method in xrefs_to[ref_class]:
xrefs_list.append(('To', ref_kind_map[ref_kind], ref_method, ref_class.get_vm_class()))
closeButton = QtGui.QPushButton("Close")
closeButton.clicked.connect(self.close)
xreflayout = QtGui.QGridLayout()
xrefwin = XrefListView(self, win=win, xrefs=xrefs_list, headers=["Origin", "Kind", "Method"])
xreflayout.addWidget(xrefwin, 0, 0)
buttonsLayout = QtGui.QHBoxLayout()
buttonsLayout.addStretch(1)
buttonsLayout.addWidget(closeButton)
mainLayout = QtGui.QVBoxLayout()
mainLayout.addLayout(xreflayout)
mainLayout.addLayout(buttonsLayout)
self.setLayout(mainLayout)
def __init__(self, parent=None, win=None, current_class=None, class_analysis=None, method_analysis=None):
super(XrefDialogMethod, self).__init__(parent)
self.current_class = current_class
self.class_analysis = class_analysis
self.method_analysis = method_analysis
title = "Xrefs for the method %s" % self.method_analysis.method
self.setWindowTitle(title)
xrefs_list = []
xrefs_from = self.method_analysis.get_xref_from()
for ref_class, ref_method in xrefs_from:
xrefs_list.append(('From', ref_method, ref_class.get_vm_class()))
xrefs_to = self.method_analysis.get_xref_to()
for ref_class, ref_method in xrefs_to:
xrefs_list.append(('To', ref_method, ref_class.get_vm_class()))
closeButton = QtGui.QPushButton("Close")
closeButton.clicked.connect(self.close)
xreflayout = QtGui.QGridLayout()
xrefwin = XrefListView(self, win=win, xrefs=xrefs_list)
xreflayout.addWidget(xrefwin, 0, 0)
buttonsLayout = QtGui.QHBoxLayout()
buttonsLayout.addStretch(1)
buttonsLayout.addWidget(closeButton)
mainLayout = QtGui.QVBoxLayout()
mainLayout.addLayout(xreflayout)
mainLayout.addLayout(buttonsLayout)
self.setLayout(mainLayout)
def __init__(self, parent=None, win=None, current_class=None, class_analysis=None, field_analysis=None):
super(XrefDialogField, self).__init__(parent)
self.current_class = current_class
self.class_analysis = class_analysis
self.field_analysis = field_analysis
title = "Xrefs for the field %s" % self.field_analysis.field
self.setWindowTitle(title)
xrefs_list = []
xrefs_read = self.field_analysis.get_xref_read()
for ref_class, ref_method in xrefs_read:
xrefs_list.append(('Read', ref_method, ref_class.get_vm_class()))
xrefs_write = self.field_analysis.get_xref_write()
for ref_class, ref_method in xrefs_write:
xrefs_list.append(('Write', ref_method, ref_class.get_vm_class()))
closeButton = QtGui.QPushButton("Close")
closeButton.clicked.connect(self.close)
xreflayout = QtGui.QGridLayout()
xrefwin = XrefListView(self, win=win, xrefs=xrefs_list)
xreflayout.addWidget(xrefwin, 0, 0)
buttonsLayout = QtGui.QHBoxLayout()
buttonsLayout.addStretch(1)
buttonsLayout.addWidget(closeButton)
mainLayout = QtGui.QVBoxLayout()
mainLayout.addLayout(xreflayout)
mainLayout.addLayout(buttonsLayout)
self.setLayout(mainLayout)
def __init__(self, parent=None, win=None, string_analysis=None):
super(XrefDialogString, self).__init__(parent)
self.string_analysis = string_analysis
title = "Xrefs for the string %s" % self.string_analysis.value
self.setWindowTitle(title)
xrefs_list = []
xrefs_from = self.string_analysis.get_xref_from()
for ref_class, ref_method in xrefs_from:
xrefs_list.append(('From', ref_method, ref_class.get_vm_class()))
closeButton = QtGui.QPushButton("Close")
closeButton.clicked.connect(self.close)
xreflayout = QtGui.QGridLayout()
xrefwin = XrefListView(self, win=win, xrefs=xrefs_list)
xreflayout.addWidget(xrefwin, 0, 0)
buttonsLayout = QtGui.QHBoxLayout()
buttonsLayout.addStretch(1)
buttonsLayout.addWidget(closeButton)
mainLayout = QtGui.QVBoxLayout()
mainLayout.addLayout(xreflayout)
mainLayout.addLayout(buttonsLayout)
self.setLayout(mainLayout)
def mouseReleaseEvent(self, e):
super(CorrelationTableDisplay, self).mouseReleaseEvent(e)
if not(self.Selectionmode):
regionIDS = []
for i in self.selectedItems():
regionIDS.append((i.row(), i.column()))
regionIDS = np.asarray(regionIDS)
CorrelationTable = self
def newwindow(BoxWidget):
i,j = np.amin(regionIDS, axis=0)
k,l = np.amax(regionIDS, axis=0)
np.reshape(regionIDS,(k-i+1,l-j+1,2))
self.bbox = QtGui.QVBoxLayout()
# Number of region ids selected and transfered to teh new window
NewTable = NewWindowCorrelationTableDisplay(k-i+1,l-j+1,i,k,j,l,CorrelationTable,regionIDS)
self.bbox.addWidget(NewTable)
BoxWidget.setLayout(self.bbox)
# FIX me resizing table contents with hardcoded values
BoxWidget.resize(18*(l-j)+120,18*(k-i+1)+140)
# BoxWidget.resize(18*(l-j)+120,18*(k-i+1)+140)
if self.First:
self.newWindowWidget.append(QtGui.QWidget())
newwindow(self.newWindowWidget[0])
self.newWindowWidget[0].show()
self.First = False
else:
self.i = self.i + 1
self.newWindowWidget.append(QtGui.QWidget())
newwindow(self.newWindowWidget[self.i])
self.newWindowWidget[self.i].show()
def createWidgets(self):
mainVLayout = QtGui.QVBoxLayout()
self.objButton = QtGui.QPushButton(self)
self.objButton.setText("Convert to OBJ")
self.fbxButton = QtGui.QPushButton(self)
self.fbxButton.setText("Convert to FBX")
mainVLayout.addWidget(self.objButton)
mainVLayout.addWidget(self.fbxButton)
self.setLayout(mainVLayout)