Convert mountconfig module to TQt3

This relates to Bug 2261
pull/2/head
Francois Andriot 10 years ago committed by Timothy Pearson
parent 499a99b582
commit 138f1893d0

@ -36,18 +36,18 @@ class SMBShareSelectDialog(KDialogBase):
vbox = self.makeVBoxMainWidget()
hbox = QHBox(vbox)
hbox = TTQHBox(vbox)
hbox.setSpacing(self.spacingHint())
tmplabel = QLabel(hbox)
tmplabel = TQLabel(hbox)
tmplabel.setPixmap(UserIcon("hi32-samba"))
hbox.setStretchFactor(tmplabel,0)
self.headinglabel = QLabel(hbox)
self.headinglabel = TQLabel(hbox)
self.headinglabel.setText(i18n("Select a network share"))
hbox.setStretchFactor(self.headinglabel,1)
hbox2 = QHBox(vbox)
hbox2 = TQHBox(vbox)
# The main treeview where the action happens.
self.treeview = TDEListView(hbox2)
@ -55,9 +55,9 @@ class SMBShareSelectDialog(KDialogBase):
self.treeview.header().hide()
self.treeview.setRootIsDecorated(True)
self.connect(self.treeview,SIGNAL("expanded(QListViewItem *)"),self.slotNodeExpanded)
self.connect(self.treeview,SIGNAL("selectionChanged(QListViewItem *)"),self.slotNodeSelected)
self.connect(self.treeview,SIGNAL("clicked(QListViewItem *)"),self.slotClicked)
self.connect(self.treeview,SIGNAL("expanded(TQListViewItem *)"),self.slotNodeExpanded)
self.connect(self.treeview,SIGNAL("selectionChanged(TQListViewItem *)"),self.slotNodeSelected)
self.connect(self.treeview,SIGNAL("clicked(TQListViewItem *)"),self.slotClicked)
self.dirlister = KDirLister()
self.dirlister.setDirOnlyMode(True)
self.dirlister.setAutoUpdate(False)
@ -69,38 +69,38 @@ class SMBShareSelectDialog(KDialogBase):
self.enableButtonOK(False)
# The "Connect as" part
widget = QWidget(hbox2)
grid = QGridLayout(widget,6,4,KDialog.spacingHint())
widget = TQWidget(hbox2)
grid = TQGridLayout(widget,6,4,KDialog.spacingHint())
grid.setRowStretch(5,1)
tmplabel = QLabel(widget)
tmplabel = TQLabel(widget)
tmplabel.setPixmap(UserIcon("hi16-password"))
grid.addWidget(tmplabel,0,0)
self.connectaslabel = QLabel(widget)
self.connectaslabel = TQLabel(widget)
self.connectaslabel.setText("Connect to 'XXX' as:")
grid.addMultiCellWidget(self.connectaslabel,0,0,1,3)
self.guestradio = QRadioButton(widget)
self.guestradio = TQRadioButton(widget)
self.guestradio.setChecked(True)
grid.addWidget(self.guestradio,1,1)
tmplabel = QLabel(widget)
tmplabel = TQLabel(widget)
tmplabel.setText(i18n("Guest"))
grid.addWidget(tmplabel,1,2)
self.connect(self.guestradio,SIGNAL("stateChanged(int)"),self.slotGuestRadioClicked)
self.userradio = QRadioButton(widget)
self.userradio = TQRadioButton(widget)
grid.addWidget(self.userradio,2,1)
tmplabel = QLabel(widget)
tmplabel = TQLabel(widget)
tmplabel.setText(i18n("Username:"))
grid.addWidget(tmplabel,2,2)
self.connect(self.userradio,SIGNAL("stateChanged(int)"),self.slotUserRadioClicked)
self.usernameedit = KLineEdit(widget)
grid.addWidget(self.usernameedit,2,3)
self.connect(self.usernameedit,SIGNAL("textChanged(const QString &)"),self.slotUsernameChanged)
self.connect(self.usernameedit,SIGNAL("textChanged(const TQString &)"),self.slotUsernameChanged)
tmplabel = QLabel(widget)
tmplabel = TQLabel(widget)
tmplabel.setText(i18n("Password:"))
grid.addWidget(tmplabel,3,2)
@ -206,7 +206,7 @@ class SMBShareSelectDialog(KDialogBase):
for entry in items:
newitem = SMBShareListViewItem(self.lookupqueue[0], unicode(entry.name()), KURL(entry.url()), self)
self.url_to_list_item_map[unicode(entry.url().prettyURL())] = newitem
# Notice how I copied the KURL object and QString (to a python string)
# Notice how I copied the KURL object and TQString (to a python string)
########################################################################
def slotDirListCompleted(self):
@ -263,10 +263,10 @@ class SMBShareSelectDialog(KDialogBase):
# Set the username/password for the machine item.
if self.guestradio.isChecked():
machineitem.getURL().setUser(QString.null)
machineitem.getURL().setPass(QString.null)
selectedurl.setUser(QString.null)
selectedurl.setPass(QString.null)
machineitem.getURL().setUser(TQString.null)
machineitem.getURL().setPass(TQString.null)
selectedurl.setUser(TQString.null)
selectedurl.setPass(TQString.null)
else:
machineitem.getURL().setUser(self.usernameedit.text())
machineitem.getURL().setPass(self.passwordedit.text())

@ -21,10 +21,10 @@ debug = False
#debug = True
class SimpleCommandRunner(QObject):
class SimpleCommandRunner(TQObject):
########################################################################
def __init__(self):
QObject.__init__(self)
TQObject.__init__(self)
########################################################################
def run(self,cmdlist,STDOUT_only=False):

@ -30,7 +30,7 @@ from SimpleCommandRunner import *
standalone = __name__ == "__main__"
class FileProcess(QListViewItem):
class FileProcess(TQListViewItem):
""" A FileProcess is simply one line from lsof, one filedescriptor that's in use
by a process represented as a listviewitem in the lsof processtable. """
@ -47,7 +47,7 @@ class FileProcess(QListViewItem):
"pfile":3 }
def __init__(self,parent,pid,isparent=False):
QListViewItem.__init__(self,parent)
TQListViewItem.__init__(self,parent)
self.setPid(pid)
self.isparent = isparent
self.pfile = ""
@ -146,8 +146,8 @@ class FUser(FUserUI):
self.warningimage.setPixmap(MainBarIcon("messagebox_warning"))
# Delayed initialisation.
QTimer.singleShot(0,self.isMounted)
QTimer.singleShot(0,self.refreshProcesslist)
TQTimer.singleShot(0,self.isMounted)
TQTimer.singleShot(0,self.refreshProcesslist)
def setApp(self,app):
""" We need a reference to the (K|Q)Application for certain things, e.g. setting
@ -172,7 +172,7 @@ class FUser(FUserUI):
""" Read lsof output and add the processdescriptors to the listview. """
kapp = self.app
kapp.setOverrideCursor(QCursor(Qt.BusyCursor))
kapp.setOverrideCursorT(TQCursor(TQt.BusyCursor))
self.processlist.clear()
rc, output = SimpleCommandRunner().run([self.lsof_bin,'-FpcLn',self.device],True)

@ -3,7 +3,7 @@
<comment>Python:from tdeui import *
Python:from tdecore import *</comment>
<author>Sebastian Kuegler</author>
<widget class="QDialog">
<widget class="TQDialog">
<property name="name">
<cstring>Process</cstring>
</property>
@ -42,7 +42,7 @@ Python:from tdecore import *</comment>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout10</cstring>
</property>
@ -50,7 +50,7 @@ Python:from tdecore import *</comment>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>warningimage</cstring>
</property>
@ -69,7 +69,7 @@ Python:from tdecore import *</comment>
<bool>false</bool>
</property>
</widget>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>explanationlabel</cstring>
</property>
@ -99,7 +99,7 @@ Killing a process may cause data loss. Make sure all work is saved before killin
</widget>
</hbox>
</widget>
<widget class="QFrame">
<widget class="TQFrame">
<property name="name">
<cstring>processframe</cstring>
</property>
@ -127,7 +127,7 @@ Killing a process may cause data loss. Make sure all work is saved before killin
<property name="spacing">
<number>4</number>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<widget class="TQLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout7</cstring>
</property>
@ -135,7 +135,7 @@ Killing a process may cause data loss. Make sure all work is saved before killin
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QListView">
<widget class="TQListView">
<column>
<property name="text">
<string>Process</string>
@ -207,7 +207,7 @@ Killing a process may cause data loss. Make sure all work is saved before killin
<enum>LastColumn</enum>
</property>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout11</cstring>
</property>
@ -262,7 +262,7 @@ Killing a process may cause data loss. Make sure all work is saved before killin
</widget>
</grid>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout12</cstring>
</property>

@ -16,14 +16,26 @@
# #
###########################################################################
import sys
import os
import os.path
# Trinity-specific paths
tqt_modules = []
for m_path in sys.path:
if os.path.exists(os.path.join(m_path, 'sip4_tqt')):
m_sip_dir = os.path.join(m_path, 'sip4_tqt')
tqt_modules.insert(0, m_sip_dir)
if os.path.exists(os.path.join(m_path, 'python_tqt')):
m_pyqt_dir = os.path.join(m_path, 'python_tqt')
tqt_modules.insert(0, m_pyqt_dir)
for m_path in tqt_modules:
sys.path.insert(0, m_path)
from qt import *
from tdeui import *
from tdecore import *
from tdefile import *
from tdeio import *
import sys
import os
import os.path
from types import StringType,UnicodeType
import pwd
import grp
@ -456,7 +468,7 @@ class MountEntryExt(object):
def _setBusy(self,parentdialog,flag):
global kapp
if flag:
kapp.setOverrideCursor( QCursor(Qt.WaitCursor) )
kapp.setOverrideCursor( TQCursor(TQt.WaitCursor) )
parentdialog.setEnabled(False)
# It is necessary to process some of the events in the event queue.
@ -1352,14 +1364,14 @@ class MountTable(object):
raise NotImplementedError, "No __setitem__ on MountTable."
############################################################################
class MountEntryDialogOptions(QWidget):
class MountEntryDialogOptions(TQWidget):
deviceexample = i18n("(for example /dev/hdb3)")
########################################################################
def __init__(self,parent,showmountpoint=True,showdevice=True,
showfs_freq=True,showfs_passno=True,showuuid=True,showlabel=True):
QWidget.__init__(self,parent)
TQWidget.__init__(self,parent)
self.showmountpoint = showmountpoint
self.showdevice = showdevice
self.showfs_freq = showfs_freq
@ -1373,21 +1385,21 @@ class MountEntryDialogOptions(QWidget):
########################################################################
def _fillPage(self):
row = 0
grid = QGridLayout(self,1,2)
grid = TQGridLayout(self,1,2)
grid.setSpacing(KDialog.spacingHint())
grid.setColStretch(0,0)
grid.setColStretch(2,0)
if self.showmountpoint:
label = QLabel(i18n("Mount Point:"),self)
label = TQLabel(i18n("Mount Point:"),self)
grid.addWidget(label,row,0)
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
self.mountpointlineedit = KLineEdit(hbox)
hbox.setStretchFactor(self.mountpointlineedit,1)
#self.connect(self.homediredit, SIGNAL("textChanged(const QString &)"), self.slotHomeDirChanged)
#self.connect(self.homediredit, SIGNAL("textChanged(const TQString &)"), self.slotHomeDirChanged)
self.mountpointbutton = KPushButton(i18n("Browse..."),hbox)
hbox.setStretchFactor(self.mountpointbutton,0)
self.connect(self.mountpointbutton,SIGNAL("clicked()"),self.slotBrowseMountPointClicked)
@ -1395,26 +1407,26 @@ class MountEntryDialogOptions(QWidget):
row += 1
if self.showdevice:
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
label = QLabel(i18n("Device:"),self)
label = TQLabel(i18n("Device:"),self)
grid.addWidget(label,row,0)
self.devicecheckbox = QRadioButton(i18n("by name"),hbox)
self.devicecheckbox = TQRadioButton(i18n("by name"),hbox)
self.connect(self.devicecheckbox,SIGNAL("clicked()"), \
self.slotDeviceCheckboxClicked)
self.devicelineedit = KLineEdit(hbox)
grid.addMultiCellWidget(hbox,row,row,1,3)
row += 1
example = QLabel(self.deviceexample,self)
example = TQLabel(self.deviceexample,self)
grid.addMultiCellWidget(example,row,row,1,3)
row += 1
if self.showuuid:
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
self.uuidcheckbox = QRadioButton(i18n("by UUID"),hbox)
self.uuidcheckbox = TQRadioButton(i18n("by UUID"),hbox)
self.connect(self.uuidcheckbox,SIGNAL("clicked()"), \
self.slotUUIDCheckboxClicked)
self.uuidlineedit = KLineEdit(hbox)
@ -1422,9 +1434,9 @@ class MountEntryDialogOptions(QWidget):
row += 1
if self.showlabel:
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
self.labelcheckbox = QRadioButton(i18n("by label"),hbox)
self.labelcheckbox = TQRadioButton(i18n("by label"),hbox)
self.connect(self.labelcheckbox,SIGNAL("clicked()"), \
self.slotLabelCheckboxClicked)
self.labellineedit = KLineEdit(hbox)
@ -1432,48 +1444,48 @@ class MountEntryDialogOptions(QWidget):
row += 1
else:
if self.showdevice:
label = QLabel(i18n("Device:"),self)
label = TQLabel(i18n("Device:"),self)
grid.addWidget(label,row,0)
self.devicelineedit = KLineEdit(self)
grid.addMultiCellWidget(self.devicelineedit,row,row,1,3)
row += 1
example = QLabel(self.deviceexample,self)
example = TQLabel(self.deviceexample,self)
grid.addWidget(example,row,1)
if self.showuuid:
label = QLabel(i18n("Device UUID:"),self)
label = TQLabel(i18n("Device UUID:"),self)
grid.addWidget(label,row,0)
self.uuidlineedit = KLineEdit(self)
grid.addMultiCellWidget(self.uuidlineedit,row,row,1,3)
row += 1
if self.showlabel:
label = QLabel(i18n("Device Label:"),self)
label = TQLabel(i18n("Device Label:"),self)
grid.addWidget(label,row,0)
self.labellineedit = KLineEdit(self)
grid.addMultiCellWidget(self.labellineedit,row,row,1,3)
row += 1
label = QLabel(i18n("Options:"),self)
label = TQLabel(i18n("Options:"),self)
grid.addWidget(label,row,0)
self.optionslineedit = KLineEdit(self)
grid.addMultiCellWidget(self.optionslineedit,row,row,1,3)
row += 1
if self.showfs_freq:
label = QLabel(i18n("fs_freq:"),self)
label = TQLabel(i18n("fs_freq:"),self)
grid.addWidget(label,row,0)
self.fsfreqspinbox = KIntSpinBox (0,1000,1,0,10,self)
grid.addWidget(self.fsfreqspinbox,row,1)
if self.showfs_passno:
label = QLabel(i18n("fs_passno:"),self)
label = TQLabel(i18n("fs_passno:"),self)
grid.addWidget(label,row,2)
self.fspassnospinbox = KIntSpinBox (0,1000,1,0,10,self)
grid.addWidget(self.fspassnospinbox,row,3)
row += 1
grid.addWidget(QWidget(self),row,0)
grid.addWidget(TQWidget(self),row,0)
for x in range(grid.numRows()):
grid.setRowStretch(x,0)
@ -1583,7 +1595,7 @@ class MountEntryDialogOptions(QWidget):
fileurl = KURL()
fileurl.setPath(self.mountpointlineedit.text())
self.mountpointdialog.setCurrentURL(fileurl)
if self.mountpointdialog.exec_loop()==QDialog.Accepted:
if self.mountpointdialog.exec_loop()==TQDialog.Accepted:
self.mountpointlineedit.setText(self.mountpointdialog.url().path())
########################################################################
@ -1627,18 +1639,18 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
def _fillPage(self):
row = 0
grid = QGridLayout(self,1,2)
grid = TQGridLayout(self,1,2)
grid.setSpacing(KDialog.spacingHint())
grid.setColStretch(0,0)
grid.setRowStretch(6,1)
label = QLabel(i18n("Mount Point:"),self)
label = TQLabel(i18n("Mount Point:"),self)
grid.addWidget(label,row,0)
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
self.mountpointlineedit = KLineEdit(hbox)
hbox.setStretchFactor(self.mountpointlineedit,1)
#self.connect(self.homediredit, SIGNAL("textChanged(const QString &)"), self.slotHomeDirChanged)
#self.connect(self.homediredit, SIGNAL("textChanged(const TQString &)"), self.slotHomeDirChanged)
self.mountpointbutton = KPushButton(i18n("Browse..."),hbox)
hbox.setStretchFactor(self.mountpointbutton,0)
self.connect(self.mountpointbutton,SIGNAL("clicked()"), \
@ -1648,26 +1660,26 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
if self.showuuid or self.showlabel:
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
label = QLabel(i18n("Device:"),self)
label = TQLabel(i18n("Device:"),self)
grid.addWidget(label,row,0)
self.devicecheckbox = QRadioButton(i18n("by name"),hbox)
self.devicecheckbox = TQRadioButton(i18n("by name"),hbox)
self.connect(self.devicecheckbox,SIGNAL("clicked()"), \
self.slotDeviceCheckboxClicked)
self.devicelineedit = KLineEdit(hbox)
grid.addWidget(hbox,row,1)
row += 1
example = QLabel(self.deviceexample,self)
example = TQLabel(self.deviceexample,self)
grid.addWidget(example,row,1)
row += 1
if self.showuuid:
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
self.uuidcheckbox = QRadioButton(i18n("by UUID"),hbox)
self.uuidcheckbox = TQRadioButton(i18n("by UUID"),hbox)
self.connect(self.uuidcheckbox,SIGNAL("clicked()"), \
self.slotUUIDCheckboxClicked)
self.uuidlineedit = KLineEdit(hbox)
@ -1675,9 +1687,9 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
row += 1
if self.showlabel:
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
self.labelcheckbox = QRadioButton(i18n("by label"),hbox)
self.labelcheckbox = TQRadioButton(i18n("by label"),hbox)
self.connect(self.labelcheckbox,SIGNAL("clicked()"), \
self.slotLabelCheckboxClicked)
self.labellineedit = KLineEdit(hbox)
@ -1685,24 +1697,24 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
row += 1
else:
label = QLabel(i18n("Device:"),self)
label = TQLabel(i18n("Device:"),self)
grid.addWidget(label,row,0)
self.devicelineedit = KLineEdit(self)
grid.addWidget(self.devicelineedit,row,1)
row += 1
example = QLabel(self.deviceexample,self)
example = TQLabel(self.deviceexample,self)
grid.addWidget(example,row,1)
row += 1
self.autocheckbox = QCheckBox(i18n("Enable at start up"),self)
self.autocheckbox = TQCheckBox(i18n("Enable at start up"),self)
grid.addWidget(self.autocheckbox,row,1)
row += 1
self.writeablecheckbox = QCheckBox(i18n("Writeable"),self)
self.writeablecheckbox = TQCheckBox(i18n("Writeable"),self)
grid.addWidget(self.writeablecheckbox,row,1)
row += 1
label = QLabel(i18n("Mount Permission:"),self)
label = TQLabel(i18n("Mount Permission:"),self)
grid.addWidget(label,row,0)
self.usermountcombobox = KComboBox(self)
self.usermountcombobox.insertItem(i18n("Root user only may enable/disable"))
@ -1714,12 +1726,12 @@ class MountEntryDialogOptionsCommonUnix(MountEntryDialogOptions):
#grid.addWidget(,9,0)
button = KPushButton(i18n("Advanced..."),self)
button.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed)
button.setSizePolicy(TQSizePolicy.Fixed,TQSizePolicy.Fixed)
self.connect(button,SIGNAL("clicked()"),self.slotAdvancedClicked)
grid.addWidget(button,row,1,Qt.AlignRight)
grid.addWidget(button,row,1,TQt.AlignRight)
row += 1
grid.addWidget(QWidget(self),row,0)
grid.addWidget(TQWidget(self),row,0)
for x in range(grid.numRows()):
grid.setRowStretch(x,0)
@ -1880,19 +1892,19 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
global allowuuid, allowlabel
row = 0
grid = QGridLayout(self,11,2)
grid = TQGridLayout(self,11,2)
grid.setSpacing(KDialog.spacingHint())
grid.setColStretch(0,0)
grid.setColStretch(2,0)
grid.setRowStretch(10,1)
label = QLabel(i18n("Mount Point:"),self)
label = TQLabel(i18n("Mount Point:"),self)
grid.addWidget(label,row,0)
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
self.mountpointlineedit = KLineEdit(hbox)
hbox.setStretchFactor(self.mountpointlineedit,1)
#self.connect(self.homediredit, SIGNAL("textChanged(const QString &)"), self.slotHomeDirChanged)
#self.connect(self.homediredit, SIGNAL("textChanged(const TQString &)"), self.slotHomeDirChanged)
self.mountpointbutton = KPushButton(i18n("Browse..."),hbox)
hbox.setStretchFactor(self.mountpointbutton,0)
self.connect(self.mountpointbutton,SIGNAL("clicked()"),self.slotBrowseMountPointClicked)
@ -1900,26 +1912,26 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
row += 1
if allowuuid or allowlabel:
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
label = QLabel(i18n("Device:"),self)
label = TQLabel(i18n("Device:"),self)
grid.addWidget(label,row,0)
self.devicecheckbox = QRadioButton(i18n("by name"),hbox)
self.devicecheckbox = TQRadioButton(i18n("by name"),hbox)
self.connect(self.devicecheckbox,SIGNAL("clicked()"), \
self.slotDeviceCheckboxClicked)
self.devicelineedit = KLineEdit(hbox)
grid.addWidget(hbox,row,1)
row += 1
example = QLabel(self.deviceexample,self)
example = TQLabel(self.deviceexample,self)
grid.addWidget(example,row,1)
row += 1
if allowuuid and self.showuuid:
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
self.uuidcheckbox = QRadioButton(i18n("by UUID"),hbox)
self.uuidcheckbox = TQRadioButton(i18n("by UUID"),hbox)
self.connect(self.uuidcheckbox,SIGNAL("clicked()"), \
self.slotUUIDCheckboxClicked)
self.uuidlineedit = KLineEdit(hbox)
@ -1927,9 +1939,9 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
row += 1
if allowlabel and self.showlabel:
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
self.labelcheckbox = QRadioButton(i18n("by label"),hbox)
self.labelcheckbox = TQRadioButton(i18n("by label"),hbox)
self.connect(self.labelcheckbox,SIGNAL("clicked()"), \
self.slotLabelCheckboxClicked)
self.labellineedit = KLineEdit(hbox)
@ -1938,27 +1950,27 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
else:
label = QLabel(i18n("Device:"),self)
label = TQLabel(i18n("Device:"),self)
grid.addWidget(label,row,0)
self.devicelineedit = KLineEdit(self)
grid.addMultiCellWidget(self.devicelineedit,row,row,1,3)
row += 1
example = QLabel(self.deviceexample,self)
example = TQLabel(self.deviceexample,self)
grid.addWidget(example,row,1)
row += 1
self.autocheckbox = QCheckBox(i18n("Enable at start up"),self)
self.autocheckbox = TQCheckBox(i18n("Enable at start up"),self)
grid.addMultiCellWidget(self.autocheckbox,row,row,1,3)
row += 1
# Security & Safety line.
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
tmplabel = QLabel(hbox)
tmplabel = TQLabel(hbox)
tmplabel.setPixmap(UserIcon("hi16-lock"))
hbox.setStretchFactor(tmplabel,0)
tmplabel = QLabel(hbox)
tmplabel = TQLabel(hbox)
tmplabel.setText(i18n("Security & Safety"))
hbox.setStretchFactor(tmplabel,0)
sep = KSeparator(KSeparator.Horizontal,hbox)
@ -1966,23 +1978,23 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
grid.addMultiCellWidget(hbox,row,row,0,3)
row += 1
self.writeablecheckbox = QCheckBox(i18n("Writeable"),self)
self.writeablecheckbox = TQCheckBox(i18n("Writeable"),self)
grid.addMultiCellWidget(self.writeablecheckbox,row,row,1,3)
row += 1
label = QLabel(i18n("Files belong to user:"),self)
label = TQLabel(i18n("Files belong to user:"),self)
grid.addWidget(label,row,0)
self.uidcombobox = UserComboBox(self)
grid.addMultiCellWidget(self.uidcombobox,row,row,1,3)
row += 1
label = QLabel(i18n("Files belong to group:"),self)
label = TQLabel(i18n("Files belong to group:"),self)
grid.addWidget(label,row,0)
self.gidcombobox = GroupComboBox(self)
grid.addMultiCellWidget(self.gidcombobox,row,row,1,3)
row += 1
label = QLabel(i18n("Mount Permission:"),self)
label = TQLabel(i18n("Mount Permission:"),self)
grid.addWidget(label,row,0)
self.usermountcombobox = KComboBox(self)
self.usermountcombobox.insertItem(i18n("Root user only may enable/disable"))
@ -1992,15 +2004,15 @@ class MountEntryDialogOptionsVFAT(MountEntryDialogOptions):
grid.addMultiCellWidget(self.usermountcombobox,row,row,1,3)
row += 1
self.suppresspermissionerrorcheckbox = QCheckBox(i18n("Suppress permission errors"),self)
self.suppresspermissionerrorcheckbox = TQCheckBox(i18n("Suppress permission errors"),self)
grid.addMultiCellWidget(self.suppresspermissionerrorcheckbox,row,row,1,3)
row += 1
row += 1
button = KPushButton(i18n("Advanced..."),self)
button.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed)
button.setSizePolicy(TQSizePolicy.Fixed,TQSizePolicy.Fixed)
self.connect(button,SIGNAL("clicked()"),self.slotAdvancedClicked)
grid.addMultiCellWidget(button,row,row,1,3,Qt.AlignRight)
grid.addMultiCellWidget(button,row,row,1,3,TQt.AlignRight)
########################################################################
def displayMountEntry(self,entry):
@ -2135,27 +2147,27 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
########################################################################
def _fillPage(self):
grid = QGridLayout(self,14,4)
grid = TQGridLayout(self,14,4)
grid.setSpacing(KDialog.spacingHint())
grid.setColStretch(0,0)
grid.setColStretch(2,0)
grid.setRowStretch(12,1)
label = QLabel(i18n("Mount Point:"),self)
label = TQLabel(i18n("Mount Point:"),self)
grid.addWidget(label,0,0)
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
self.mountpointlineedit = KLineEdit(hbox)
hbox.setStretchFactor(self.mountpointlineedit,1)
#self.connect(self.homediredit, SIGNAL("textChanged(const QString &)"), self.slotHomeDirChanged)
#self.connect(self.homediredit, SIGNAL("textChanged(const TQString &)"), self.slotHomeDirChanged)
self.mountpointbutton = KPushButton(i18n("Browse..."),hbox)
hbox.setStretchFactor(self.mountpointbutton,0)
self.connect(self.mountpointbutton,SIGNAL("clicked()"),self.slotBrowseMountPointClicked)
grid.addMultiCellWidget(hbox,0,0,1,3)
label = QLabel(i18n("Network Share:"),self)
label = TQLabel(i18n("Network Share:"),self)
grid.addWidget(label,1,0)
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
self.devicelineedit = KLineEdit(hbox)
hbox.setStretchFactor(self.devicelineedit,1)
@ -2165,21 +2177,21 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
grid.addMultiCellWidget(hbox,1,1,1,3)
# Connect as:
connectaslabel = QLabel(self)
connectaslabel = TQLabel(self)
connectaslabel.setText(i18n("Connect as:"))
grid.addWidget(connectaslabel,2,0)
self.guestradio = QRadioButton(self)
self.guestradio = TQRadioButton(self)
self.guestradio.setChecked(True)
grid.addWidget(self.guestradio,2,1)
tmplabel = QLabel(self)
tmplabel = TQLabel(self)
tmplabel.setText(i18n("Guest"))
grid.addMultiCellWidget(tmplabel,2,2,2,3)
self.connect(self.guestradio,SIGNAL("stateChanged(int)"),self.slotGuestRadioClicked)
self.userradio = QRadioButton(self)
self.userradio = TQRadioButton(self)
grid.addWidget(self.userradio,3,1)
tmplabel = QLabel(self)
tmplabel = TQLabel(self)
tmplabel.setText(i18n("Username:"))
grid.addWidget(tmplabel,3,2)
self.connect(self.userradio,SIGNAL("stateChanged(int)"),self.slotUserRadioClicked)
@ -2187,43 +2199,43 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
self.usernameedit = KLineEdit(self)
grid.addWidget(self.usernameedit,3,3)
tmplabel = QLabel(self)
tmplabel = TQLabel(self)
tmplabel.setText(i18n("Password:"))
grid.addWidget(tmplabel,4,2)
self.passwordedit = KLineEdit(self)
grid.addWidget(self.passwordedit,4,3)
self.autocheckbox = QCheckBox(i18n("Enable at start up"),self)
self.autocheckbox = TQCheckBox(i18n("Enable at start up"),self)
grid.addMultiCellWidget(self.autocheckbox,5,5,1,3)
# Security & Safety line.
hbox = QHBox(self)
hbox = TQHBox(self)
hbox.setSpacing(KDialog.spacingHint())
tmplabel = QLabel(hbox)
tmplabel = TQLabel(hbox)
tmplabel.setPixmap(UserIcon("hi16-lock"))
hbox.setStretchFactor(tmplabel,0)
tmplabel = QLabel(hbox)
tmplabel = TQLabel(hbox)
tmplabel.setText(i18n("Security & Safety"))
hbox.setStretchFactor(tmplabel,0)
sep = KSeparator(KSeparator.Horizontal,hbox)
hbox.setStretchFactor(sep,1)
grid.addMultiCellWidget(hbox,6,6,0,3)
self.writeablecheckbox = QCheckBox(i18n("Writeable"),self)
self.writeablecheckbox = TQCheckBox(i18n("Writeable"),self)
grid.addMultiCellWidget(self.writeablecheckbox,7,7,1,3)
label = QLabel(i18n("Files belong to user:"),self)
label = TQLabel(i18n("Files belong to user:"),self)
grid.addWidget(label,8,0)
self.uidcombobox = UserComboBox(self)
grid.addMultiCellWidget(self.uidcombobox,8,8,1,3)
label = QLabel(i18n("Files belong to group:"),self)
label = TQLabel(i18n("Files belong to group:"),self)
grid.addWidget(label,9,0)
self.gidcombobox = GroupComboBox(self)
grid.addMultiCellWidget(self.gidcombobox,9,9,1,3)
label = QLabel(i18n("Mount Permission:"),self)
label = TQLabel(i18n("Mount Permission:"),self)
grid.addWidget(label,10,0)
self.usermountcombobox = KComboBox(self)
self.usermountcombobox.insertItem(i18n("Root user only may enable/disable"))
@ -2233,9 +2245,9 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
grid.addMultiCellWidget(self.usermountcombobox,10,10,1,3)
button = KPushButton(i18n("Advanced..."),self)
button.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed)
button.setSizePolicy(TQSizePolicy.Fixed,TQSizePolicy.Fixed)
self.connect(button,SIGNAL("clicked()"),self.slotAdvancedClicked)
grid.addMultiCellWidget(button,13,13,1,3,Qt.AlignRight)
grid.addMultiCellWidget(button,13,13,1,3,TQt.AlignRight)
self.selectsmbdialog = None
@ -2260,8 +2272,8 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
newurlobj = self.selectsmbdialog.choose(urlobj)
# This just converts smb:/zootv/data to \\zootv\data.
plainurl = KURL(newurlobj)
plainurl.setUser(QString.null)
plainurl.setPass(QString.null)
plainurl.setUser(TQString.null)
plainurl.setPass(TQString.null)
parts = [x.replace('\\',"/") for x in unicode(plainurl.url())[4:].split("/") if x !=""]
#convert the first part to an IP address
nmboutput = subprocess.Popen(["nmblookup",parts[0]], stdout=subprocess.PIPE).stdout
@ -2346,7 +2358,7 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
return
self.updatinggui = True
if state==QButton.Off:
if state==TQButton.Off:
self.guestradio.setChecked(True)
self.userradio.setChecked(False)
@ -2360,7 +2372,7 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
if self.updatinggui:
return
self.updatinggui = True
if state==QButton.Off:
if state==TQButton.Off:
self.userradio.setChecked(True)
self.guestradio.setChecked(False)
@ -2370,20 +2382,20 @@ class MountEntryDialogOptionsSMB(MountEntryDialogOptions):
self.updatinggui = False
############################################################################
class ROListBoxItem(QListBoxPixmap):
class ROListBoxItem(TQListBoxPixmap):
"""A read-only ListBox item that also uses the 'alternate' background colour
as background.
"""
def __init__(self,listbox,pix,text):
QListBoxPixmap.__init__(self,listbox,pix,text)
TQListBoxPixmap.__init__(self,listbox,pix,text)
self.setSelectable(False)
def paint(self,p):
boldfont = QFont(p.font())
boldfont.setWeight(QFont.Bold)
boldfont = TQFont(p.font())
boldfont.setWeight(TQFont.Bold)
p.setFont(boldfont)
p.setBackgroundColor(TDEGlobalSettings.alternateBackgroundColor())
p.eraseRect(0,0,self.listBox().width(),self.height(self.listBox()))
QListBoxPixmap.paint(self,p)
TQListBoxPixmap.paint(self,p)
############################################################################
class MountEntryDialog(KDialogBase):
@ -2440,15 +2452,15 @@ class MountEntryDialog(KDialogBase):
self.comboIndexToMountType = []
self.currentOptionWidget = None
self.topvbox = QVBox(self)
self.topvbox = TQVBox(self)
self.setMainWidget(self.topvbox)
self.topvbox.setSpacing(self.spacingHint())
hb = QHBox(self.topvbox)
hb = TQHBox(self.topvbox)
hb.setSpacing(self.spacingHint())
self.topvbox.setStretchFactor(hb,0)
label = QLabel(i18n("Type:"),hb)
label = TQLabel(i18n("Type:"),hb)
hb.setStretchFactor(label,0)
self.mounttypecombo = KComboBox(hb)
@ -2486,25 +2498,25 @@ class MountEntryDialog(KDialogBase):
#hb.setStretchFactor(self.runlevelcombo,0)
self.connect(self.mounttypecombo, SIGNAL("activated(int)"), self.slotMountTypeChanged)
widget = QWidget(hb)
widget = TQWidget(hb)
hb.setStretchFactor(widget,1)
# Create the stack of option edit widgets.
gb = QVGroupBox(self.topvbox)
gb = TQVGroupBox(self.topvbox)
self.topvbox.setStretchFactor(gb,1)
self.optionsstack = QWidgetStack(gb)
self.optionsstack = TQWidgetStack(gb)
for mounttype in self.MountTypeEditors:
editpage = self.MountTypeEditors[mounttype](self.optionsstack)
self.mountTypeToOptionWidget[mounttype] = editpage
self.optionsstack.addWidget(editpage)
self.fsunavailablelabel = QHBox(gb)
self.fsunavailablelabel = TQHBox(gb)
self.fsunavailablelabel.setSpacing(KDialog.spacingHint())
tmplabel = QLabel(self.fsunavailablelabel)
tmplabel = TQLabel(self.fsunavailablelabel)
self.fsunavailablelabel.setStretchFactor(tmplabel,0)
tmplabel.setPixmap(SmallIcon('info'))
label = QLabel(i18n("This filesystem type is currently unavailable on the running kernel."),
label = TQLabel(i18n("This filesystem type is currently unavailable on the running kernel."),
self.fsunavailablelabel)
self.fsunavailablelabel.setStretchFactor(label,1)
self.fsunavailablelabel.hide()
@ -2521,7 +2533,7 @@ class MountEntryDialog(KDialogBase):
self.updatingGUI = True
self.selectEntry(self.currentMountEntry.getMountType())
self.updatingGUI = False
if self.exec_loop()==QDialog.Accepted:
if self.exec_loop()==TQDialog.Accepted:
# All of the update stuff is in slotOk()
return True
return False
@ -2537,7 +2549,7 @@ class MountEntryDialog(KDialogBase):
self.currentOptionWidget = None
self.selectEntry(self.currentMountEntry.mounttype)
self.updatingGUI = False
if self.exec_loop()==QDialog.Accepted:
if self.exec_loop()==TQDialog.Accepted:
self.mounttable.allentries.append(self.currentMountEntry)
self.mounttable.updateFstabOnDisk()
return self.currentMountEntry
@ -2657,28 +2669,28 @@ class MountEntryAdvancedCommonUnixDialog(KDialogBase):
def __init__(self,parent,name=None):
KDialogBase.__init__(self,parent,name,1,"",KDialogBase.Ok|KDialogBase.Cancel)
grid = self.makeGridMainWidget(2,Qt.Horizontal)
grid = self.makeGridMainWidget(2,TQt.Horizontal)
grid.setSpacing(self.spacingHint())
QWidget(grid)
self.accesstimecheckbox = QCheckBox(i18n("Update file access timestamps"),grid)
TQWidget(grid)
self.accesstimecheckbox = TQCheckBox(i18n("Update file access timestamps"),grid)
QWidget(grid)
self.allowexecutablecheckbox = QCheckBox(i18n("Allow Executables"),grid)
TQWidget(grid)
self.allowexecutablecheckbox = TQCheckBox(i18n("Allow Executables"),grid)
QWidget(grid)
self.allowsuidcheckbox = QCheckBox(i18n("Allow the SUID and SGID attributes"),grid)
TQWidget(grid)
self.allowsuidcheckbox = TQCheckBox(i18n("Allow the SUID and SGID attributes"),grid)
QWidget(grid)
self.usedevpointscheckbox = QCheckBox(i18n("Allow device points"),grid)
TQWidget(grid)
self.usedevpointscheckbox = TQCheckBox(i18n("Allow device points"),grid)
label = QLabel(i18n("Options:"),grid)
label = TQLabel(i18n("Options:"),grid)
self.optionslineedit = KLineEdit(grid)
label = QLabel(i18n("fs_freq:"),grid)
label = TQLabel(i18n("fs_freq:"),grid)
self.fsfreqspinbox = KIntSpinBox (0,1000,1,0,10,grid)
label = QLabel(i18n("fs_passno:"),grid)
label = TQLabel(i18n("fs_passno:"),grid)
self.fspassnospinbox = KIntSpinBox (0,1000,1,0,10,grid)
########################################################################
@ -2706,16 +2718,16 @@ class MountEntryAdvancedPlainDialog(KDialogBase):
def __init__(self,parent,name=None):
KDialogBase.__init__(self,parent,name,1,"",KDialogBase.Ok|KDialogBase.Cancel)
grid = self.makeGridMainWidget(2,Qt.Horizontal)
grid = self.makeGridMainWidget(2,TQt.Horizontal)
grid.setSpacing(self.spacingHint())
label = QLabel(i18n("Options:"),grid)
label = TQLabel(i18n("Options:"),grid)
self.optionslineedit = KLineEdit(grid)
label = QLabel(i18n("fs_freq:"),grid)
label = TQLabel(i18n("fs_freq:"),grid)
self.fsfreqspinbox = KIntSpinBox (0,1000,1,0,10,grid)
label = QLabel(i18n("fs_passno:"),grid)
label = TQLabel(i18n("fs_passno:"),grid)
self.fspassnospinbox = KIntSpinBox (0,1000,1,0,10,grid)
########################################################################
@ -2802,7 +2814,7 @@ class MountListViewItem(TDEListViewItem):
self.setText(2,"")
self.setText(3,self.haldevice.getDev())
self.setText(4,"")
self.setPixmap(4,QPixmap())
self.setPixmap(4,TQPixmap())
self.__updateIcon()
########################################################################
@ -2882,21 +2894,21 @@ class MountConfigApp(programbase):
self.selectedentry = None
self.aboutus = TDEAboutApplication(self)
self.sizeviewdialogs = {}
toplayout = QVBoxLayout(topwidget, 0, KDialog.spacingHint())
toplayout = TQVBoxLayout(topwidget, 0, KDialog.spacingHint())
#topwidget.setEnabled(isroot)
hb = QHBox(topwidget)
hb = TQHBox(topwidget)
hb.setSpacing(KDialog.spacingHint())
#if standalone:
# hb.setMargin(KDialog.marginHint())
toplayout.addWidget(hb)
label = QLabel(hb)
label = TQLabel(hb)
label.setPixmap(UserIcon("kcmpartitions"))
hb.setStretchFactor(label,0)
label = QLabel(i18n("Available Disks and Filesystems:"),hb)
label = TQLabel(i18n("Available Disks and Filesystems:"),hb)
hb.setStretchFactor(label,1)
self.mountlist = TDEListView(topwidget,"Mount list")
@ -2907,17 +2919,17 @@ class MountConfigApp(programbase):
self.mountlist.addColumn(i18n("Device"))
self.mountlist.addColumn(i18n("Enabled"))
self.mountlist.setAllColumnsShowFocus(True)
self.mountlist.setSelectionMode(QListView.Single)
self.mountlist.setSelectionMode(TQListView.Single)
self.mountlist.setRootIsDecorated(True)
self.mountlist.setSorting(-1)
self.connect(self.mountlist, SIGNAL("selectionChanged(QListViewItem *)"), self.slotListClicked)
self.connect(self.mountlist, SIGNAL("selectionChanged(TQListViewItem *)"), self.slotListClicked)
# Doubleclick in item opens modify dialogue.
self.connect(self.mountlist, SIGNAL("doubleClicked(QListViewItem *)"), self.slotModifyClicked)
self.connect(self.mountlist, SIGNAL("doubleClicked(TQListViewItem *)"), self.slotModifyClicked)
# Rightclick: Open ContextMenu
self.connect(self.mountlist, SIGNAL("contextMenu(TDEListView*,QListViewItem*,const QPoint&)"),
self.connect(self.mountlist, SIGNAL("contextMenu(TDEListView*,TQListViewItem*,const TQPoint&)"),
self.slotContextMenu)
hbox = QHBox(topwidget)
hbox = TQHBox(topwidget)
toplayout.addWidget(hbox)
hbox.setSpacing(KDialog.spacingHint())

@ -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()

Loading…
Cancel
Save