Пример #1
0
    def main(self):
        super().__init__(self)
        self.state_path = os.path.realpath('../../history/states/')
        self.loc_path = os.path.realpath('../../localisation/')
        self.map_path = os.path.realpath('../../map/')

        self.state_watcher = QtCore.QFileSystemWatcher()
        self.state_watcher.addPath(self.state_path)
        # State watcher
        self.state_watcher.directoryChanged.connect(self.state_dir_changed)

        self.loc_watcher = QtCore.QFileSystemWatcher()
        self.loc_watcher.addPath(self.loc_path)
        # loc watcher
        self.loc_watcher.directoryChanged.connect(self.loc_dir_changed)

        self.map_watcher = QtCore.QFileSystemWatcher()
        self.map_watcher.addPath(self.map_path)
        # map watcher
        self.map_watcher.directoryChanged.connect(self.map_dir_changed)

        self.timer = QtCore.QTimer()
        self.timer.setInterval(500)
        self.timer.timeout.connect(self.handle_timer)

        self.copy_states_flag = False
        self.copy_loc_flag = False
        self.copy_map_flag = False
Пример #2
0
    def __init__(self, pathToWatch=None, parent=None):
        super(MyMainWindow, self).__init__(parent)
        self.setupUi()
        self.pathToWatch = pathToWatch
        self.fileList = [os.path.join(dp, f) for dp, dn, fn in os.walk( 
self.pathToWatch) for f in fn]
        self.dirList = [dp for dp, dn, fn in os.walk(self.pathToWatch)]
        self.fileSysWatcher = QtCore.QFileSystemWatcher()
        self.fileSysWatcher.addPaths(self.dirList)
        self.fileSysWatcher.directoryChanged.connect(self.slotDirChanged)
        self.fileList = [os.path.join(dp, f) for dp, dn, fn in os.walk( self.pathToWatch) for f in fn]
        self.dirList = [dp for dp, dn, fn in os.walk(self.pathToWatch)]

	def xor(lst1, lst2):
		"""
		returns a tuple of items of item not in either of lists
		"""
		items = []
		for itm in lst1:
			 if itm not in lst2:
				 items.append(itm)
		for itm in lst2:
			 if itm not in lst1:
				 items.append(itm)
		return items
Пример #3
0
    def regenerate(self):
        def recursiveAddPath(filePath):
            """ recursively add files and directories to watcher """
            watcher.addPath(filePath)
            fileList = QtCore.QDir(
                filePath).entryInfoList(QtCore.QDir.Dirs | QtCore.QDir.Files
                                        | QtCore.QDir.NoDotAndDotDot)
            for f in fileList:
                recursiveAddPath(f.absoluteFilePath())

        def directoryChanged(filePath):
            watchedFiles = watcher.directories() + watcher.files()
            fileList = QtCore.QDir(
                filePath).entryInfoList(QtCore.QDir.Dirs | QtCore.QDir.Files
                                        | QtCore.QDir.NoDotAndDotDot)
            for f in fileList:
                if f.absoluteFilePath() not in watchedFiles:
                    watcher.addPath(f.absoluteFilePath())

            self.generate()

        # QFileSystemWatcher won't work without a QApplication!
        app = QtWidgets.QApplication(sys.argv)
        watcher = QtCore.QFileSystemWatcher()
        recursiveAddPath(self.notepath)

        # add/remove file triggers this
        watcher.directoryChanged.connect(directoryChanged)
        # edit file triggers this
        watcher.fileChanged.connect(self.generate)
        sys.exit(app.exec_())
Пример #4
0
    def __init__(self, plugin):
        super().__init__(plugin)
        self._load_thread = None
        self._progress = None
        self._file_name = None
        self._file_watcher = QtCore.QFileSystemWatcher()
        self._selected_block = None

        self.setupWidgets()
        self.setupMenuBar()
        self.updateWindowTitle()
        self.updateMenuBar()
        self.loadColorProfiles()

        self.setAcceptDrops(True)

        self.connectSignals()
        self.setupVtk()
        self.setColorProfile()

        self._vtk_interactor.Initialize()
        self._vtk_interactor.Start()

        self._setupOrientationMarker()
        self._setupCubeAxesActor()

        self.clear()
        self.show()

        self._update_timer = QtCore.QTimer()
        self._update_timer.timeout.connect(self.onUpdateWindow)
        self._update_timer.start(250)

        QtCore.QTimer.singleShot(1, self._updateViewModeLocation)
Пример #5
0
    def __init__(self,
                 attachedView,
                 watching=True,
                 watchSource=False,
                 verbose=False):
        """
        Build a QmlInstantCoding instance.

        attachedView -- the QQuickView on which this QmlInstantCoding is applied
        watching -- if True, file watching is enable (default: True)
        watchSource -- watch the attached QQuickView source file if it already has one (default: False)
        verbose -- if True, output log infos (default: False)
        """
        super(QmlInstantCoding, self).__init__()

        self._fileWatcher = QtCore.QFileSystemWatcher(
        )  # Internal Qt File Watcher
        self._attachedView = attachedView  # Quick view attached to our watcher
        self._watchedFiles = []  # Internal watched files list
        self._verbose = verbose  # Verbose bool
        self._watching = False  # Defines whether the watcher is active
        self._extensions = [
            "qml", "js"
        ]  # File extensions that defines files to watch when adding a folder

        # Update the watching status
        self.setWatching(watching)
Пример #6
0
    def __init__(self, engine, reloadFunc, watching=True, verbose=False):
        """
        Build a QmlInstantCoding instance.

        engine -- QML engine
        reloadFunc -- The functor that will be called to reload.
                      Will be something like "instantcoding.ReloadComponent(qmlFile, component, topLevelItem)"
        watching -- Defines whether the watcher is active (default: True)
        verbose -- if True, output log infos (default: False)
        """
        super(QmlInstantCoding, self).__init__()

        self._fileWatcher = QtCore.QFileSystemWatcher(
        )  # Internal Qt File Watcher
        self._engine = engine
        self._reload = reloadFunc
        self._watchedFiles = []  # Internal watched files list
        self._verbose = verbose  # Verbose bool
        self._watching = False  #
        self._extensions = [
            "qml", "js"
        ]  # File extensions that defines files to watch when adding a folder

        # Update the watching status
        self.setWatching(watching)
Пример #7
0
    def _init_file_system_watcher(self):

        self._file_system_watcher = QtCore.QFileSystemWatcher()
        self._setup_file_system_watcher()
        self._file_system_watcher.directoryChanged.connect(self.file_system_changed)
        self._file_system_watcher.fileChanged.connect(self.file_system_changed)
        self.file_system_changed.connect(self._setup_file_system_watcher)
Пример #8
0
 def __init__(self, data_fn=None, resp_fn=None):
     super(PlotResponses, self).__init__()
     
     self.file_watcher_dfn = QtCore.QFileSystemWatcher()
     self.file_watcher_dfn.fileChanged.connect(self.file_changed_dfn)
 
     
     self.modem_data = None
     self.modem_resp = None
     
     self.station = None
     
     self._modem_data_copy = None
     
     self._plot_z = False
     self.plot_settings = PlotSettings()
     
     self._ax = None
     self._ax2 = None
     self._key = 'z'
     self._ax_index = 0
     self.ax_list = None
     
     self.setup_ui()
     
     self._data_fn = data_fn
     self._resp_fn = resp_fn
Пример #9
0
    def __init__(self):       
        QtWidgets.QMainWindow.__init__(self)
        self.ui = uic.loadUi('../share/kwipe/Ui/kwipe.ui', self)
        
        # Start functions 
        self.check_permission()
        self.create_action_menu()
        self.create_device_tree()
        self.check_update()

        # Setup Window Title
        text = 'KWipe %s' % VERSION
        self.setWindowTitle(text)

        # Setup QComboBox, Spacer and Label
        self.comboMethod = QtWidgets.QComboBox()
        self.comboMethod.addItems(['One', 'Zero', 'NSA 130-2', 'Gost', 'HMG IS 5', 'DOD_E', 'DOD_ECE','OPS II', 'VSITR', 'Schneier', 'Gutman'])
        spacer = QtWidgets.QWidget(self.toolBar)
        spacer.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
        self.toolBar.addWidget(spacer)
        labelMethod = QtWidgets.QLabel(self.tr('Method: '), self.toolBar)
        self.toolBar.addWidget(labelMethod)
        self.toolBar.addWidget(self.comboMethod)

        # Setup Signal and Slot
        self.action_erase.triggered.connect(self.on_erase)
        self.action_cancel.triggered.connect(self.on_cancel)
        self.action_refresh.triggered.connect(self.create_device_tree)
        self.action_clear.triggered.connect(self.on_clear)
        self.action_about.triggered.connect(self.about)

        # Setup filesystem watcher for block devices
        fs_watcher = QtCore.QFileSystemWatcher(['/dev/block'], self)
        fs_watcher.directoryChanged.connect(self.create_device_tree)
Пример #10
0
    def watchChanged(self):
        if self.src_widget.filepath == '':
            print('select source path to enable watch')
            self.watch.setChecked(False)
            return

        if self.dst_widget.filepath  == '':
            print('select destination path to enable watch')
            self.watch.setChecked(False)
            return
        
        if self.watch.isChecked():
            self.fs_watcher = QtCore.QFileSystemWatcher()
            self.fs_watcher.directoryChanged.connect(self.directory_changed)
            self.fs_watcher.fileChanged.connect(self.file_changed)
            folders = self.get_src_folder_list()
            self.watcher_add_folders(folders)
            files = self.get_src_file_list()
            self.watcher_add_files(files)
            print("Watch enabled")
        else:
            self.watch.setChecked(False)
            print("Watch disabled")
            self.fs_watcher.directoryChanged.disconnect(self.directory_changed)
            self.fs_watcher.fileChanged.disconnect(self.file_changed)
Пример #11
0
    def _init_file_system_watcher(self):

        # Fixme: catch all events

        self._file_system_watcher = QtCore.QFileSystemWatcher()
        self._file_system_watcher.directoryChanged.connect(
            self.directory_changed)
        self._file_system_watcher.fileChanged.connect(self.file_changed)
Пример #12
0
def main(execpath="."):
    sys.excepthook = excepthook
    floop = open(os.path.join(execpath, "exit.txt"), "w")
    floop.write("0")
    floop.close()

    execpath = os.path.abspath(execpath)

    if not os.path.isdir(os.path.join(execpath, "Logs")):
        os.mkdir(os.path.join(execpath, "Logs"))

    Log.apppath = os.path.join(execpath, "Logs", Log.apppath)
    Log.runosupath = os.path.join(execpath, "Logs", Log.runosupath)

    print(Log.apppath, Log.runosupath)

    qtpath = os.path.dirname(PyQt5.__file__)
    pluginpath = os.path.join(qtpath, "Qt/plugins")
    os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = pluginpath

    App = QApplication(sys.argv)
    window = Window(App, execpath)
    b = open(os.path.join(abspath, "progress.txt"), "w")
    b.close()
    watcher = QtCore.QFileSystemWatcher(
        [os.path.join(abspath, 'progress.txt')])
    watcher.directoryChanged.connect(window.progressbar.directory_changed)
    watcher.fileChanged.connect(window.progressbar.file_changed)

    b = open("error.txt", "w")  # remove abspath for temporary fix
    b.close()
    errorwatcher = QtCore.QFileSystemWatcher(['error.txt'])
    errorwatcher.directoryChanged.connect(
        window.customwindow.directory_changed)
    errorwatcher.fileChanged.connect(window.customwindow.file_changed)

    ret = App.exec_()
    if window.startbutton.proc is not None and window.startbutton.proc.poll(
    ) is None:
        kill(window.startbutton.proc.pid)
        with open("progress.txt", "w") as file:
            file.write("done")
        file.close()

    sys.exit(ret)
Пример #13
0
    def __init__(self, *args, **kwargs):
        """  """
        super().__init__()
        self.path_to_watch = args[0]

        print("CameraProcessor main thread id: ", threading.get_native_id())

        self.frame_timestamps = np.zeros(1000)
        self.cpu_timestamps = np.zeros(1000)
        self.ind_stamp = 0
        with open("frame_timestamps.bin", "wb") as f:
            pass
        with open("cpu_timestamps.bin", "wb") as f:
            pass
        print('Cleared timestamps file')

        self.imgProc = image_processor.ImageProcessor()
        self.imgProcPlugin = image_processor_plugin.ImageProcessor()
        self.camera = sui_camera.SUICamera()

        self.ebusReader = ebus_reader.EbusReader(use_mock=False,
                                                 camera=self.camera)

        self.fileWatcher = QtCore.QFileSystemWatcher(
            ["image_processor_plugin.py"])
        self.fileWatcher.fileChanged.connect(self.fileWatcher_fileChanged)

        self.setupUI()

        self.widgets_exposure = {
            'requestedCounts': self.editExposureCount,
            'requestedMS': self.lblExposureMSRequested,
            'actualMS': self.lblExposureMSActual,
            'actualCounts': self.lblExposureCounts,
        }
        self.widgets_frameperiod = {
            'requestedCounts': self.editFrameCount,
            'requestedMS': self.lblFrameMSRequested,
            'actualMS': self.lblFrameMSActual,
            'actualCounts': self.lblFrameCounts,
        }

        for w in [
                self.editPixelPitch, self.editTargetDistance,
                self.editResolution, self.editFocalLength
        ]:
            w.editingFinished.connect(self.updateFOV)

        # start polling timer for the serial reads:
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.pollSerial)
        self.timer_period_ms = 100
        self.timer.start(self.timer_period_ms)

        # start the image reader thread:
        # it will actually sit idle until we actually connect and open a stream:
        self.startImageReadoutThread()
Пример #14
0
    def __init__(self):
        """Creates a new instance, loading the current configuration."""
        self._data = {}
        self._last_reload = None
        self.reload()

        self.watcher = QtCore.QFileSystemWatcher(
            [os.path.join(util.userprofile_path(), "config.json")])
        self.watcher.fileChanged.connect(self.reload)
Пример #15
0
    def start_click(self):

        reply = QtWidgets.QMessageBox.question(self, "serial", "터치 센서를 확인하겠습니까?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)

        if reply == QtWidgets.QMessageBox.Yes:
            subprocess_list.append(subprocess.Popen('serial_data.exe', shell=True))
            self.watcher = QtCore.QFileSystemWatcher(self)
            self.watcher.addPath("./serial_data.txt")
            self.watcher.fileChanged.connect(self.label_change)
Пример #16
0
 def __init__(self, window):
     QtCore.QObject.__init__(self)
     self.fileSystemWatcher = QtCore.QFileSystemWatcher(self)
     self.fileSystemWatcher.directoryChanged['QString'].connect(
         self.invalidateDirectory)
     self.autoRefreshPath = None
     self.autoRefreshTimer = QtCore.QTimer(self)
     self.autoRefreshTimer.setSingleShot(True)
     self.autoRefreshTimer.timeout.connect(self.autoRefresh)
     self.window = window
     self.cache = CacheEntry()
Пример #17
0
 def __init__(self, path, maxAge=DEFAULT_MAX_AGE):
     QtCore.QThread.__init__(self)
     self.path = path
     self.maxAge = maxAge
     self.files = {}
     self.updateWatchedFiles()
     self.qtfw = QtCore.QFileSystemWatcher()
     self.qtfw.directoryChanged.connect(self.directoryChanged)
     self.qtfw.addPath(path)
     self.paused = True
     self.active = True
Пример #18
0
def load_file_watch(parent, filename, callback):
    def cb(p=""):
        try:
            with open(filename, "r") as f:
                data = f.read()
        except:
            return
        callback(data)

    fsw = QtCore.QFileSystemWatcher([filename], parent)
    fsw.fileChanged.connect(cb)
    cb()
Пример #19
0
    def __init__(self, argv=[], parent=None):
        super(MsgDebugWidget, self).__init__()

        # find classes for print messages
        global printf
        global printfID
        try:
            printf = Messaging.Messages.DebugPrintf
        except AttributeError:
            printf = None
        try:
            printfID = Messaging.Messages.DebugPrintfID
        except AttributeError:
            printfID = None

        # tab widget to show multiple stream of print statements, one per tab
        self.tabWidget = QtWidgets.QTabWidget()
        self.tabWidget.currentChanged.connect(self.tabChanged)
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(self.tabWidget)
        self.setLayout(vbox)

        # tab for text commands
        self.textEntryWidget = msgtools.lib.gui.MsgCommandWidget(self)
        self.tabWidget.addTab(self.textEntryWidget, "Cmd/Reply")
        self.textEntryWidget.commandEntered.connect(self.newCommandEntered)
        self.textEntryWidget.messageEntered.connect(self.newMessageEntered)
        self.textEntryWidget.autocompleted.connect(self.autocompleted)

        # tracking what reply to expect
        self.expectedReply = None

        # list of hash table to lookup the widget for a stream, by stream ID
        self.msgWidgets = []

        self.fileWatcher = QtCore.QFileSystemWatcher()
        # array of format string info
        self.dictionaries = []
        self.formatStringFilenames = []
        for dictName in argv[1:]:
            # ignore arguments that start with - or --, they are command-line options, not dictionary names!
            if not dictName.startswith('-'):
                self.formatStringFilenames.append(dictName)
        for deviceID in range(0, len(self.formatStringFilenames)):
            print("reading dictionary[" + str(deviceID) + "] " +
                  self.formatStringFilenames[deviceID])
            self.ReadDictionary(deviceID, self.formatStringFilenames[deviceID])
            self.fileWatcher.addPath(self.formatStringFilenames[deviceID])

        # whether we should autoscroll as data is added
        self.autoscroll = 1

        self.fileWatcher.fileChanged.connect(self.fileChanged)
Пример #20
0
 def setupDbView(self):
     if os.path.exists(dbPath):
         self.db = QtSql.QSqlDatabase.addDatabase('QSQLITE')
         self.db.setDatabaseName(dbPath)
         self.initializeModel()
         table = self.ui.tbl_Users
         table.setModel(self.model)
         table.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
         self.resizeUserTable()
         self.dbWatcher = QtCore.QFileSystemWatcher() # watch for file changes
         self.dbWatcher.addPath(os.path.dirname(dbPath))
         self.dbWatcher.directoryChanged.connect(lambda: self.sourceModel.select())
         table.selectionModel().selectionChanged.connect(self.getRow) # get the row index
Пример #21
0
    def _init_file_system_watcher(self):

        self._logger.info("Monitor {}".format(self._repository.workdir))

        self._file_system_watcher = QtCore.QFileSystemWatcher()
        self._setup_file_system_watcher()

        # Update registrations
        #!# self._file_system_watcher.directoryChanged.connect(self._setup_file_system_watcher)

        # Attention: a git command generate many successive events
        self._file_system_watcher.directoryChanged.connect(self.directory_changed)
        self._file_system_watcher.fileChanged.connect(self.file_changed)
Пример #22
0
 def start(self):
     self.watcher = QtCore.QFileSystemWatcher([self.tmpdir])
     self.ripProcess = QtCore.QProcess()
     self.ripProcess.setWorkingDirectory(self.tmpdir)
     self.ripProcess.setProcessChannelMode(QtCore.QProcess.MergedChannels)
     self.ripProcess.readyRead.connect(self.parseParanoiaOutput)
     self.ripProcess.finished.connect(self.handleRipFinish)
     trackArg = str(
         self.fromTrack) + '-' + (str(self.toTrack) if self.toTrack else '')
     self.ripProcess.start('cdparanoia',
                           ['-B', '-e', '-d', self.device, trackArg])
     self.statusWidget = RipperStatusWidget()
     mainwindow.mainWindow.statusBar().addWidget(self.statusWidget)
     self.currentByteChanged.connect(self.statusWidget.setByte)
     self.statusWidget.cancelled.connect(self.cancel)
Пример #23
0
 def __init__(self):
     super(main, self).__init__()
     self.ui = None
     self.monitorDir = ""
     self.setupUI()
     #顯示無邊框
     self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
     #顯示全螢幕
     self.showFullScreen()
     self.showMaximized()
     self.fileSystemWatcher = QtCore.QFileSystemWatcher()
     self.fileSystemWatcher.addPath(self.monitorDir)
     self.fileSystemWatcher.directoryChanged.connect(self.__autorun)
     self.xyzList = []
     self.datas = dataCollection()
Пример #24
0
    def __init__(self):
        super().__init__()

        self.filename = ''
        self.saved_text = ''
        self.initialized = False
        self.file_watcher = QtCore.QFileSystemWatcher()
        self.file_watcher.directoryChanged.connect(
            lambda: self.lazyInstrumentUpdate())
        self.controls = Controls(self)

        self.main_splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical)
        self.setCentralWidget(self.main_splitter)

        self.splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
        self.splitter.setChildrenCollapsible(False)
        self.main_splitter.addWidget(self.splitter)
        self.main_splitter.setStretchFactor(0, 2)

        self.message = QtWidgets.QTextEdit('')
        self.message.setReadOnly(True)
        self.message.setFontFamily('courier')
        self.message.setStyleSheet(
            'QTextEdit {background-color: white; color: red; font-size: 12px; '
            'padding-left: 10px; background-position: top left}')
        self.message.setMinimumHeight(100)
        self.main_splitter.addWidget(self.message)

        self.gl_widget = OpenGLRenderer(self)
        self.gl_widget.custom_error_handler = self.sceneSizeErrorHandler
        self.scene = SceneManager(self, self.gl_widget, False)
        self.scene.changeVisibility(Attributes.Beam, True)
        self.animate_instrument.connect(self.scene.animateInstrument)

        self.editor = Editor(self)
        self.editor.textChanged.connect(self.lazyInstrumentUpdate)
        self.splitter.addWidget(self.gl_widget)
        self.splitter.addWidget(self.editor)

        self.setMinimumSize(1024, 800)
        self.setTitle()
        self.setWindowIcon(QtGui.QIcon(path_for('editor-logo.png')))

        self.initActions()
        self.initMenus()
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.useWorker)
        self.worker = InstrumentWorker(self)
Пример #25
0
    def __init__(self, pdfsPath, email=""):
        super(DatabaseInit, self).__init__()
        self.email = email
        self.signals = WorkerSignals()
        self.pdfsPath = pdfsPath
        os.makedirs(DATABASE_PATH, exist_ok=True)
        self.crMetadata = metadata.GetPdfInfo(email=self.email)
        self.database_path = os.path.join(DATABASE_PATH, 'piepdf.db')
        self.column_list = "Path, Title, Author, Year, Abstract, Doi, Url, Journal, Tags, Notes"

        self.dirList = [dp for dp, dn, fn in os.walk(self.pdfsPath)]
        print(self.dirList)
        self.fileSysWatcher = QtCore.QFileSystemWatcher()
        self.fileSysWatcher.addPaths(self.dirList)
        self.fileSysWatcher.directoryChanged.connect(self.slotDirChanged)
        self.fileSysWatcher.fileChanged.connect(self.slotDirChanged)
Пример #26
0
 def setupDbView(self):
     if os.path.exists(dbPath):
         self.db = QtSql.QSqlDatabase.addDatabase('QSQLITE')
         self.db.setDatabaseName(dbPath)
         self.initializeModel()
         table = self.ui.tbl_View
         table.setModel(self.model)
         table.setSortingEnabled(True)
         self.resizeTable()
         title = (appName + '[ ' + currUser + ' ]')
         self.ui.setWindowTitle(title)
         self.dbWatcher = QtCore.QFileSystemWatcher() # watch for file changes
         self.dbWatcher.addPath(os.path.dirname(dbPath))
         self.dbWatcher.directoryChanged.connect(self.updateChanges)
         # This needs to be here. Each time setupDbView is called selectionChanged needs to be re-connected
         self.ui.tbl_View.selectionModel().selectionChanged.connect(self.getRow)
Пример #27
0
 def __init__(self):
     super().__init__()
     self.setupUi(self)
     self.file_watcher = QtCore.QFileSystemWatcher()
     # create and asign filter model to the tree view made before:
     self.filterModel = CascadingFilterModel()
     self.overlap_file_model = OverlapFileModel()
     self.overlap_file_view.setModel(self.overlap_file_model)
     self.sourceTV.setModel(self.filterModel)
     # connect text line edit interface with filtering model:
     self.minDateEdit.dateChanged.connect(
         self.filterModel.setFilterMinimumDate)
     self.el_line_protect = False
     # create overlap model and set it to be source model of filter model:
     self.create_available_overlaps_model(qtiSet_path)
     # setup interface for element selection:
     self.element_selection = []
     self.elem_table = et.ElementTableGUI()
     self.elem_table.setWindowOpacity(0.95)
     self.elem_table.enableElement.connect(self.append_element)
     self.elem_table.disableElement.connect(self.remove_element)
     self.elem_table.allElementsOff.connect(self.reset_element)
     self.pet_button.clicked.connect(self.toggle_pet)
     # activating actions:
     self.actionAbout_Qt.triggered.connect(self.show_about_qt)
     self.actionAbout.triggered.connect(self.show_about)
     self.actionOpen_new_setup.triggered.connect(self.open_or_new_file)
     self.actionRemove.triggered.connect(self.delete_selected_entries)
     self.delete_button.pressed.connect(self.actionRemove.trigger)
     self.actionAppend_to_down.triggered.connect(
         self.append_selection_to_overlaps)
     self.append_to_ofv_button.pressed.connect(
         self.actionAppend_to_down.trigger)
     self.actionSave_setup.triggered.connect(self.save_to_file)
     self.actionExit.triggered.connect(self.close)
     self._setup_logging()
     widths = [100, 35, 60, 65, 35, 45, 40, 55, 75, 75, 40, 45, 60]
     for i in range(len(widths)):
         self.sourceTV.setColumnWidth(i, widths[i])
         self.overlap_file_view.setColumnWidth(i, widths[i] + 5)
     ofv_header = self.overlap_file_view.horizontalHeader()
     ofv_header.setSectionsMovable(True)
     self.overlap_file_view.hideColumn(0)
     self.overlap_file_view.hideColumn(1)
     self.file_watcher.addPath(qtiSet_path)
     self.file_watcher.directoryChanged.connect(self.refresh_data)
     self.file_watcher.fileChanged.connect(self.refresh_data)
 def __init__(self):
     super().__init__()
     self.setupUi(self)
     self.file_watcher = QtCore.QFileSystemWatcher()
     #create and add treeview for all overlaps:
     self.sourceTV = AvailableOverlapTreeView(self.availableOverlapsLayout)
     self.availableOverlapsLayout.addWidget(self.sourceTV, 1, 0, 1, 4)
     self.overlap_file_view = NewOverlapFileView(self.frame2)
     self.gridLayout_2.addWidget(self.overlap_file_view, 1, 1, 4, 1)
     #create and asign filter model to the tree view made before:
     self.filterModel = CascadingFilterModel()
     self.overlap_file_model = OverlapFileModel()
     self.overlap_file_view.setModel(self.overlap_file_model)
     self.sourceTV.setModel(self.filterModel)
     #connect text line edit interface with filtering model:
     self.lineEdit.textChanged.connect(self.changeNameFilter)
     self.el_line_protect = False
     #create overlap model and set it to be source model of filter model:
     self.create_available_overlaps_model(qtiSet_path)
     #adjust column width to content:
     self.sourceTV.expandAll()
     for i in range(12):
         self.sourceTV.resizeColumnToContents(i)
     #setup interface for element selection:
     self.element_selection = []
     self.elem_table = et.ElementTableGUI()
     self.elem_table.enableElement.connect(self.append_element)
     self.elem_table.disableElement.connect(self.remove_element)
     self.elem_table.allElementsOff.connect(self.reset_element)
     self.pet_button.clicked.connect(self.toggle_pet)
     #activating actions:
     self.actionAbout_Qt.triggered.connect(self.show_about_qt)
     self.actionAbout.triggered.connect(self.show_about)
     self.actionOpen_new_setup.triggered.connect(self.open_or_new_file)
     self.actionRemove.triggered.connect(self.delete_selected_entries)
     self.delete_button.pressed.connect(self.actionRemove.trigger)
     self.actionAppend_to_down.triggered.connect(
         self.append_selection_to_overlaps)
     self.append_to_ofv_button.pressed.connect(
         self.actionAppend_to_down.trigger)
     self.actionSave_setup.triggered.connect(self.save_to_file)
     self.actionExit.triggered.connect(self.close)
     self._setup_logging()
     self.sourceTV.setColumnWidths()
     self.file_watcher.addPath(qtiSet_path)
     self.file_watcher.directoryChanged.connect(self.refresh_data)
     self.file_watcher.fileChanged.connect(self.refresh_data)
Пример #29
0
    def __init__(self, path):
        QtSvg.QSvgWidget.__init__(self)
        self.path = path
        self.watch = QtCore.QFileSystemWatcher(self)
        self.watch.addPath(self.path)
        self.watch.fileChanged.connect(self.reload)

        self.setMouseTracking(True)
        self.ds = None
        self.scale = 0
        self.center_x = 0
        self.center_y = 0
        self.setPalette(QtGui.QPalette(QtCore.Qt.white))
        self.setAutoFillBackground(True)
        QtSvg.QSvgWidget.load(self, path)
        self.defViewBox = self.renderer().viewBoxF()
        self.center()
Пример #30
0
 def initUI(self):
     
     self.setGeometry(300, 300, 250, 150)
     self.setWindowTitle('Icon')
     self.setWindowIcon(QtGui.QIcon('web.png'))        
             
     p = QtCore.QDir("c:/users/szatz/mylistman_p3")
     paths = ["."]
     self.fs_watcher = QtCore.QFileSystemWatcher()
     self.fs_watcher.addPath(p.path())
     self.fs_watcher.addPath("hello.txt")
     self.fs_watcher.addPath(os.path.abspath(temp.name))
     self.fs_watcher.directoryChanged.connect(self.directory_changed)
     self.fs_watcher.fileChanged.connect(self.file_changed)
     print(self.fs_watcher.directories())
     print(self.fs_watcher.files())
     self.setWindowTitle('hello')