[PyQt] QtNetwork.QNetworkAddressEntry

2012-05-22 Thread Ganesh Kumar
Hi Guys,

I am new to pyqt, my idea is create very easy interface, configure
Network ip configuration using pyqt, I have seen QNetworkAddressEntry
is using to do achieve this, please give any example
QNetworkAddressEntry with python, please guide me guys.

-Dhanasekaran

Did I learn something today? If not, I wasted it.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Python generated file changes not detected by QFileSystemModel

2012-05-22 Thread Mads Ipsen

Hi,

Here's the problem:

1. Set up a QFileSystemModel, call setRootPath() and hook up to the
   dataChanged signal.
2. Open a new file from Python and write some text into it. Then close it.
3. Reopen the file in append mode and write some more text into it.
   Then close it.
4. Open a file in an external editor. Write some stuff. Save. Write
   more stuff. Save.

If you do (3), the dataChanged signal is NOT emitted. However, if you do 
(4), the dataChanged signal IS emitted.


Any clues? An attached file that reproduces the issue is attached.

Best regards,

Mads


--
+-+
| Mads Ipsen  |
+--+--+
| Gåsebæksvej 7, 4. tv |  |
| DK-2500 Valby| phone:  +45-29716388 |
| Denmark  | email:  mads.ip...@gmail.com |
+--+--+


import sys
import os

from PyQt4 import QtGui, QtCore

class Widget(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)

layout = QtGui.QVBoxLayout()
self.setLayout(layout)
self._view = QtGui.QListView()
layout.addWidget(self._view)

# Add the model
self._model = QtGui.QFileSystemModel()
self._model.setRootPath(QtCore.QDir().rootPath())
self._model.setReadOnly(False)
self._model.setFilter(QtCore.QDir.AllDirs | QtCore.QDir.AllEntries)
self._view.setModel(self._model)

# Root path
path = os.path.dirname(os.path.abspath(__file__))
self._model.setRootPath(path)

# Set a root index
index = self._model.index(path)
self._view.setRootIndex(index)

# Generate a file with some text
print 'Making file'
f = open('foo.dat', 'w')
f.write('Some stuff\n')
f.close()

self.connect(self._model, QtCore.SIGNAL('dataChanged(const QModelIndex &, const QModelIndex &)'), self.dataChanged)

# Append more text - this should trigger a signal call
print 'Modifying file'
f = open('foo.dat', 'w+')
f.write('Some more stuff\n')
f.close()

def dataChanged(self, index_0, index_1):
print 'dataChanged', self._model.filePath(index_0), self._model.filePath(index_1)

if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)

widget = Widget()
widget.show()

sys.exit(app.exec_())
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt