def selectWithinSystemTarballDialog(self, filename): win = KFileDialog('.', '', self, 'SystemTarball', True) win.setURL(KURL('tar://%s' % filename)) win.connect(win, SIGNAL('okClicked()'), self.newTemplateSelected) win.tarball_filename = filename win.show() self._dialog = win
class KPartTextEditor(QWidget): def __init__(self, mime, parent=None): QWidget.__init__(self, parent) Layout = QVBoxLayout(self) self.part = partchooser.get_part(self, mime) if self.part is None: return self.part.widget().setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) Layout.addWidget(self.part.widget()) self.fpath = None def openURL(self, url): from kdecore import KURL self.url = KURL(url) if self.part: self.part.openURL(self.url) def filename(self): return str(self.url.fileName()) def save(self, fpath=None): if fpath is None and self.fpath is None: pass def clear(self): self.openUrl('/dev/null')
def fileSelected(self): filesel = self._dialog filename = str(filesel.selectedFile()) print filename filesel.close() filesel = KFileDialog('.', '', self, 'SystemTarball', True) url = 'tar://%s' % filename filesel.setURL(KURL(url)) filesel.connect(filesel, SIGNAL('okClicked()'), self.newTemplateSelected) filesel.show() self._dialog = filesel
def openComposer(to='', cc='', bcc='', subject='', message=''): interfaces = [('kmail', 'default'), ('kontact', 'KMailIface')] client = DCOPClient() client.attach() done = False for app, part in interfaces: obj = DCOPObj(app, client, part) try: obj.openComposer(to, cc, bcc, qstr(subject), qstr(message), False, KURL()) done = True break except TypeError: pass return done
def openURL(self, url): from kdecore import KURL self.url = KURL(url) if self.part: self.part.openURL(self.url)
def openFile(self, file): from os.path import abspath self.part.openURL(KURL("file://%s" % abspath(file))) self.editedFile = abspath(file)