diff options
author | Francois Andriot <albator78@libertysurf.fr> | 2014-09-23 18:28:49 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-09-23 18:28:49 -0500 |
commit | 138f1893d0aa1fa54f9fd55674a5fc8e24aa07b5 (patch) | |
tree | ddedd4611a10dbf3475cdaf6a1ae21b24b3dfff1 /mountconfig/sizeview.py | |
parent | 499a99b5822f3e219b9817b4bed1e7737e1c31db (diff) | |
download | tde-guidance-138f1893d0aa1fa54f9fd55674a5fc8e24aa07b5.tar.gz tde-guidance-138f1893d0aa1fa54f9fd55674a5fc8e24aa07b5.zip |
Convert mountconfig module to TQt3
This relates to Bug 2261
Diffstat (limited to 'mountconfig/sizeview.py')
-rw-r--r-- | mountconfig/sizeview.py | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/mountconfig/sizeview.py b/mountconfig/sizeview.py index fa96437..05c5115 100644 --- a/mountconfig/sizeview.py +++ b/mountconfig/sizeview.py @@ -22,17 +22,17 @@ def getLabel(blocks): return i18n("%1 Tb").arg(round(float(blocks)/1024.0,1)) -class SizeViewApplication(QApplication): +class SizeViewApplication(TQApplication): """ Boilerplate """ def __init__(self,devicename,devicepath,args=[]): - QApplication.__init__(self,args) + TQApplication.__init__(self,args) self.maindialog = SizeView(None,devicename,devicepath) self.setMainWidget(self.maindialog) self.maindialog.show() self.exec_loop() -class SizeView(QDialog): +class SizeView(TQDialog): """ A SizeView represents a horizontal list of PartitionGroupWidgets. It supplies the code to read the sizes and the values that have to be filled in, using the /proc filesystem and the program "df". @@ -50,7 +50,7 @@ class SizeView(QDialog): def __init__(self,parent,devicename,devicepath=None): self.partitionwidgets = [] - QDialog.__init__(self,None,None,0,0) + TQDialog.__init__(self,None,None,0,0) self.dialogtitle = i18n("Diskspace & Partitions") self.setCaption(self.dialogtitle) self.devicename = devicename @@ -84,7 +84,7 @@ class SizeView(QDialog): pwidg.setMountPoint(mountpoint) pwidg.setUsed(used) pwidg.setAvailable(available) - pwidg.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.MinimumExpanding,0,0, + pwidg.setSizePolicy(TQSizePolicy(TQSizePolicy.MinimumExpanding,TQSizePolicy.MinimumExpanding,0,0, pwidg.sizePolicy().hasHeightForWidth())) self.partitionwidgets.append(pwidg) number += 1 @@ -103,13 +103,13 @@ class SizeView(QDialog): # Build main Gridlayout. total_rows = rows+2 - self.grid = QGridLayout(self,total_rows,2,5) + self.grid = TQGridLayout(self,total_rows,2,5) #self.setSizeGripEnabled(1) - self.buttonCancel = QPushButton(i18n("Close"),self,"buttonCancel") + self.buttonCancel = TQPushButton(i18n("Close"),self,"buttonCancel") self.buttonCancel.setAutoDefault(1) self.buttonCancel.setFixedWidth(80) - self.grid.addWidget(self.buttonCancel,total_rows-1,1,Qt.AlignRight) + self.grid.addWidget(self.buttonCancel,total_rows-1,1,TQt.AlignRight) self.grid.setRowStretch(0,0) self.grid.setRowStretch(total_rows-1,0) @@ -118,10 +118,10 @@ class SizeView(QDialog): for row in range(1,total_rows-1): self.grid.setRowStretch(row,5) - self.clearWState(Qt.WState_Polished) + self.clearWState(TQt.WState_Polished) self.connect(self.buttonCancel,SIGNAL("clicked()"),self.hide) - #self.mainlabel = QLabel("<font size=+2><b>"+self.dialogtitle+"</b></font>",self) + #self.mainlabel = TQLabel("<font size=+2><b>"+self.dialogtitle+"</b></font>",self) #self.grid.addWidget(self.mainlabel,0,0) self.diskgroup = DiskGroup(self,self.devicename,self.dev_path,self.partitions,self.totalsize,self.mountpoints) @@ -187,22 +187,22 @@ class SizeView(QDialog): for p in self.partitions: print p, self.partitions[p], self.partitions[p] """ -class DiskGroup(QGroupBox): +class DiskGroup(TQGroupBox): """ Shows an overview of the physical layout of the disks, with the different partitions on it. """ def __init__(self,parent,device,dev_path,partitions,totalsize,mountpoints): - QGroupBox.__init__(self,parent,"DiskViewGroup") + TQGroupBox.__init__(self,parent,"DiskViewGroup") self.setTitle(i18n("Disk %1%2").arg(dev_path).arg(device)) self.mountpoints = mountpoints self.partitions = partitions self.totalsize = totalsize - self.setColumnLayout(0,Qt.Vertical) + self.setColumnLayout(0,TQt.Vertical) self.layout().setSpacing(6) self.layout().setMargin(11) - DiskViewGroupLayout = QVBoxLayout(self.layout()) - DiskViewGroupLayout.setAlignment(Qt.AlignTop) + DiskViewGroupLayout = TQVBoxLayout(self.layout()) + DiskViewGroupLayout.setAlignment(TQt.AlignTop) colors = ["dark orange","dodger blue","gold","green","firebrick","navy","darkorange","darkblue"] self.diskview = DiskView(self,self.percentages(),colors) @@ -221,7 +221,7 @@ class DiskGroup(QGroupBox): # We multiply the number of cols by 3, first for the colorlabel, second for the name, third for spacing. cols = cols*3 - DiskViewPartitionListLayout = QGridLayout(DiskViewGroupLayout,rows,cols) + DiskViewPartitionListLayout = TQGridLayout(DiskViewGroupLayout,rows,cols) i = cl = r = c = 0 ps = ls = {} @@ -232,7 +232,7 @@ class DiskGroup(QGroupBox): lbl = self.mountpoints[dev] except KeyError: lbl = "not mounted" - ls[i] = QLabel(self,lbl+'<br /> ('+dev_path+dev+')',self) + ls[i] = TQLabel(self,lbl+'<br /> ('+dev_path+dev+')',self) DiskViewPartitionListLayout.addWidget(ls[i],r,c+1) cl += 1 if cl == len(colors): @@ -256,7 +256,7 @@ class DiskGroup(QGroupBox): return self.perc -class PartitionGroup(QGroupBox): +class PartitionGroup(TQGroupBox): """ Represents a groupbox with the filled bar and a couple of labels with information about the partition in it.""" @@ -264,49 +264,49 @@ class PartitionGroup(QGroupBox): title = str(i18n("Partition")) def __init__(self,device,parent,fill_percent,number,part_types,dev_path): - QGroupBox.__init__(self,parent) + TQGroupBox.__init__(self,parent) self.part_types = part_types self.dev_path = dev_path - self.setGeometry(QRect(110,100,370,203)) - self.setColumnLayout(0,Qt.Vertical) + self.setGeometry(TQRect(110,100,370,203)) + self.setColumnLayout(0,TQt.Vertical) self.layout().setSpacing(3) self.layout().setMargin(5) self.setMinimumSize(280,120) - partitiongroup_layout = QGridLayout(self.layout()) - partitiongroup_layout.setAlignment(Qt.AlignTop) - self.available = QLabel(i18n("available"),self) + partitiongroup_layout = TQGridLayout(self.layout()) + partitiongroup_layout.setAlignment(TQt.AlignTop) + self.available = TQLabel(i18n("available"),self) partitiongroup_layout.addWidget(self.available,3,4) - self.device = QLabel(i18n("device"),self) + self.device = TQLabel(i18n("device"),self) partitiongroup_layout.addMultiCellWidget(self.device,1,1,3,4) self.partpixmap = PartitionView(self,fill_percent,self.part_types,device) self.partpixmap.setScaledContents(1) partitiongroup_layout.addMultiCellWidget(self.partpixmap,0,0,0,4) - self.textLabel1_3 = QLabel("textLabel1_3",self) + self.textLabel1_3 = TQLabel("textLabel1_3",self) partitiongroup_layout.addWidget(self.textLabel1_3,3,0) - self.totalsize = QLabel("totalsize",self) + self.totalsize = TQLabel("totalsize",self) partitiongroup_layout.addWidget(self.totalsize,2,1) - self.textLabel1_2 = QLabel(self,"textLabel1_2") + self.textLabel1_2 = TQLabel(self,"textLabel1_2") partitiongroup_layout.addWidget(self.textLabel1_2,2,0) - self.textLabel1 = QLabel(self,"textLabel1") + self.textLabel1 = TQLabel(self,"textLabel1") partitiongroup_layout.addWidget(self.textLabel1,1,0) - self.textLabel3_2 = QLabel(self,"textLabel3_2") + self.textLabel3_2 = TQLabel(self,"textLabel3_2") partitiongroup_layout.addMultiCellWidget(self.textLabel3_2,2,2,2,3) - self.percentfilled = QLabel(self,"percentfree") + self.percentfilled = TQLabel(self,"percentfree") partitiongroup_layout.addWidget(self.percentfilled,2,4) - self.textLabel3_3 = QLabel(self,"textLabel3_3") + self.textLabel3_3 = TQLabel(self,"textLabel3_3") partitiongroup_layout.addWidget(self.textLabel3_3,3,2) - self.textLabel3 = QLabel(self,"textLabel3") + self.textLabel3 = TQLabel(self,"textLabel3") partitiongroup_layout.addWidget(self.textLabel3,1,2) - self.used = QLabel(self,"used") + self.used = TQLabel(self,"used") partitiongroup_layout.addWidget(self.used,3,1) - self.mountpoint = QLabel(self,"mountpoint") - self.mountpoint.setMinimumSize(QSize(60,0)) + self.mountpoint = TQLabel(self,"mountpoint") + self.mountpoint.setMinimumSize(TQSize(60,0)) partitiongroup_layout.addWidget(self.mountpoint,1,1) - self.clearWState(Qt.WState_Polished) + self.clearWState(TQt.WState_Polished) self.setTitle(i18n("%1. Partition").arg(number)) self.textLabel1_3.setText(i18n("Used:")) @@ -345,33 +345,33 @@ class PartitionGroup(QGroupBox): def setAvailable(self,available): self.available.setText(getLabel(available)) -class LegendLabel(QLabel): +class LegendLabel(TQLabel): """ Show some color in the DiskView legend """ - def __init__(self,parent,color="green",style=QBrush.SolidPattern): - QLabel.__init__(self,parent,"bla") + def __init__(self,parent,color="green",style=TQBrush.SolidPattern): + TQLabel.__init__(self,parent,"bla") self.w = 40 self.h = 20 - self.pmsize = QSize(self.w,self.h) - self.pm = QPixmap(self.pmsize) + self.pmsize = TQSize(self.w,self.h) + self.pm = TQPixmap(self.pmsize) self.linewidth = 2 - self.color = QColor(color) + self.color = TQColor(color) self.style = style - self.framecolor = QColor("black") + self.framecolor = TQColor("black") self.paintMe() self.setPixmap(self.pm) self.setScaledContents(1) - self.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0, + self.setSizePolicy(TQSizePolicy(TQSizePolicy.Fixed,TQSizePolicy.Fixed,0,0, self.sizePolicy().hasHeightForWidth())) def paintMe(self): - p = QPainter(self.pm) - p.fillRect(0,0,self.w,self.h,QBrush(self.color,self.style)) - p.setPen(QPen(QColor("black"),self.linewidth)) + p = TQPainter(self.pm) + p.fillRect(0,0,self.w,self.h,TQBrush(self.color,self.style)) + p.setPen(TQPen(TQColor("black"),self.linewidth)) p.drawRect(self.linewidth/2,self.linewidth/2,self.w-self.linewidth/2,self.h-self.linewidth/2) p.end() -class PartitionView(QLabel): +class PartitionView(TQLabel): """ PartitionView is a label carryig a pixmap. This class's main purpose is handlig layout of the underlying pixmap.""" w = 250 @@ -379,13 +379,13 @@ class PartitionView(QLabel): def __init__(self,parent,fill_percent,part_types,device): self.part_types = part_types self.fill_percent = fill_percent - QLabel.__init__(self,parent,"pview") - self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding,0,0, + TQLabel.__init__(self,parent,"pview") + self.setSizePolicy(TQSizePolicy(TQSizePolicy.Expanding,TQSizePolicy.Expanding,0,0, self.sizePolicy().hasHeightForWidth())) - self.setMinimumSize(QSize(self.w,self.h)) - self.setPixmap(PartitionPixmap(QSize(self.w,self.h),self.fill_percent,self.part_types,device)) + self.setMinimumSize(TQSize(self.w,self.h)) + self.setPixmap(PartitionPixmap(TQSize(self.w,self.h),self.fill_percent,self.part_types,device)) self.setScaledContents(1) - self.setAlignment(QLabel.AlignCenter) + self.setAlignment(TQLabel.AlignCenter) class DiskView(PartitionView): """ PartitionView is a label carryig a pixmap. This class's main purpose is handlig layout @@ -396,15 +396,15 @@ class DiskView(PartitionView): linewidth = 2 def __init__(self,parent,percents,colors): - QLabel.__init__(self,parent) + TQLabel.__init__(self,parent) - self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding,0,0, + self.setSizePolicy(TQSizePolicy(TQSizePolicy.Expanding,TQSizePolicy.Expanding,0,0, self.sizePolicy().hasHeightForWidth())) self.setPixmap(DiskPixmap(percents,colors,(self.w,self.h))) self.setScaledContents(1) - self.setAlignment(QLabel.AlignCenter) + self.setAlignment(TQLabel.AlignCenter) -class DiskPixmap(QPixmap): +class DiskPixmap(TQPixmap): linewidth = 2 # Width of surrounding frame @@ -412,18 +412,18 @@ class DiskPixmap(QPixmap): self.percents = percents self.w,self.h = w,h self.colors = colors - QPixmap.__init__(self,w,h) + TQPixmap.__init__(self,w,h) self.paintMe() def paintMe(self): - p = QPainter(self) + p = TQPainter(self) w,h = self.w,self.h i = 0 x0 = 0 y = 0 # Paint background, this is interesting for empty partitions. - p.fillRect(0,0,w,h,QBrush(QColor("white"))) + p.fillRect(0,0,w,h,TQBrush(TQColor("white"))) parts = self.percents.keys() parts.sort() @@ -433,23 +433,23 @@ class DiskPixmap(QPixmap): # We need to adjust a little to avoid to get wholes. if x0>0: xa = 2 if W < self.w: wa = 2 - p.fillRect(x0-xa,0,W+wa,h,QBrush(QColor(self.colors[i]))) + p.fillRect(x0-xa,0,W+wa,h,TQBrush(TQColor(self.colors[i]))) i += 1 x0 += W # Paint Frame around it. - p.setPen(QPen(QColor("black"),self.linewidth)) + p.setPen(TQPen(TQColor("black"),self.linewidth)) p.drawRect(self.linewidth/2,self.linewidth/2,self.width()-self.linewidth/2,self.height()-self.linewidth/2) p.end() -class PartitionPixmap(QPixmap): +class PartitionPixmap(TQPixmap): """ A PartitionPixmap is a two colored bar with a black frame. The first color represents the percentage that's used, the second one the free percentage.""" linewidth = 2 # Width of surrounding frame def __init__(self,pmsize,fill_percent,part_types,device): - QPixmap.__init__(self,pmsize) + TQPixmap.__init__(self,pmsize) self.pmsize = pmsize # Size of the pixmap self.part_types = part_types # Array to look up the type of the partition @@ -461,21 +461,21 @@ class PartitionPixmap(QPixmap): self.paintMe() def paintMe(self): - p = QPainter(self) + p = TQPainter(self) try: fill_percent = int(self.fill_percent) if self.part_types[self.device] == "swap": # Swap partitions get blueish colors. - color_used = QColor("blue") - color_free = QColor("lightblue") + color_used = TQColor("blue") + color_free = TQColor("lightblue") else: # Regular partitions get a red / green color combo. - color_used = QColor("red") - color_free = QColor("forest green") + color_used = TQColor("red") + color_free = TQColor("forest green") except (KeyError,TypeError): # Partition has no fillsize, might be empty or not mounted partition - p.fillRect(0,0,self.w,self.h,QBrush(QColor("darkgrey"))) - p.setPen(QPen(QColor("black"),self.linewidth)) + p.fillRect(0,0,self.w,self.h,TQBrush(TQColor("darkgrey"))) + p.setPen(TQPen(TQColor("black"),self.linewidth)) p.drawRect(self.linewidth/2,self.linewidth/2,self.w-self.linewidth/2,self.h-self.linewidth/2) p.end() return @@ -486,15 +486,15 @@ class PartitionPixmap(QPixmap): x = y = 0 w = W - (W*(1-(fill_percent/100.00))) h = H - p.fillRect(x,y,w,h,QBrush(color_used)) + p.fillRect(x,y,w,h,TQBrush(color_used)) # Paint green part == space left x = w w = W - w - p.fillRect(x,y,w,h,QBrush(color_free)) + p.fillRect(x,y,w,h,TQBrush(color_free)) # Paint Frame around it. - p.setPen(QPen(QColor("black"),self.linewidth)) + p.setPen(TQPen(TQColor("black"),self.linewidth)) p.drawRect(self.linewidth/2,self.linewidth/2,W-self.linewidth/2,H-self.linewidth/2) p.end() |