Esempio n. 1
0
	def initGui(self):
		""" Initialize plugin's UI """

		self.initLogging()
		self.recording=False
		self.loadPlugins()
		self.loadConfiguration()
		self.rubberBand=None
		self.lastPosition=None
		self.timer=None
		self.previousPaths=[] #previews of previously recorded paths
		
		self.gpsDaemon=GpsDaemon(self, self)
		self.canvas=self.iface.mapCanvas()
		
		self.gatherer=None
		self.dockWidget=None
		self.dockWidget_simple=None
    
		self.dockWidget=DockWidget(self)
		self.dockWidget_simple=DockWidget_simple(self)
		
		self.actionDockWidget=QAction("Show Gatherer dock widget",self.iface.mainWindow())
		self.actionDockWidget.setCheckable(True)
		QObject.connect(self.actionDockWidget, SIGNAL("triggered()"), self.showHideDockWidget)
		self.iface.addPluginToMenu("Qgis-&mapper", self.actionDockWidget)
		QObject.connect(self.dockWidget, SIGNAL("visibilityChanged(bool)"), lambda : self.__dockwidgetVisibilityChanged(0))
		QObject.connect(self.dockWidget_simple, SIGNAL("visibilityChanged(bool)"), lambda : self.__dockwidgetVisibilityChanged(1))
		
		SourcePlugins.initializeUI(self.dockWidget.dataInputPlugins_tabWidget)
		
		self.curDockWidget=None
		self.showInterface(self.interface_simple)
		
		self.canvas=self.iface.mapCanvas()
		self.positionMarker=PositionMarker(self.canvas)
		self.connect(self.gpsDaemon, SIGNAL("newTrackPoint(PyQt_PyObject)"), self.gotNewTrackPoint)
Esempio n. 2
0
class GatherPlugin(QObject):
	"""
	Main Gahterer plugin class - handles interaction with QGis and 
	organizes all the recording stuff.
	"""

	def __init__(self, iface):
		QObject.__init__(self)
		self.iface = iface
		
	
	def initGui(self):
		""" Initialize plugin's UI """

		self.initLogging()
		self.recording=False
		self.loadPlugins()
		self.loadConfiguration()
		self.rubberBand=None
		self.lastPosition=None
		self.timer=None
		self.previousPaths=[] #previews of previously recorded paths
		
		self.gpsDaemon=GpsDaemon(self, self)
		self.canvas=self.iface.mapCanvas()
		
		self.gatherer=None
		self.dockWidget=None
		self.dockWidget_simple=None
    
		self.dockWidget=DockWidget(self)
		self.dockWidget_simple=DockWidget_simple(self)
		
		self.actionDockWidget=QAction("Show Gatherer dock widget",self.iface.mainWindow())
		self.actionDockWidget.setCheckable(True)
		QObject.connect(self.actionDockWidget, SIGNAL("triggered()"), self.showHideDockWidget)
		self.iface.addPluginToMenu("Qgis-&mapper", self.actionDockWidget)
		QObject.connect(self.dockWidget, SIGNAL("visibilityChanged(bool)"), lambda : self.__dockwidgetVisibilityChanged(0))
		QObject.connect(self.dockWidget_simple, SIGNAL("visibilityChanged(bool)"), lambda : self.__dockwidgetVisibilityChanged(1))
		
		SourcePlugins.initializeUI(self.dockWidget.dataInputPlugins_tabWidget)
		
		self.curDockWidget=None
		self.showInterface(self.interface_simple)
		
		self.canvas=self.iface.mapCanvas()
		self.positionMarker=PositionMarker(self.canvas)
		self.connect(self.gpsDaemon, SIGNAL("newTrackPoint(PyQt_PyObject)"), self.gotNewTrackPoint)

	def unload(self):
		""" Cleanup and unload the plugin """

		self.canvas.scene().removeItem(self.positionMarker)
		self.positionMarker=None
		
		if self.recording:
			self.recordingStop()
		
		self.saveConfiguration()
		SourcePlugins.unloadPlugins()

		self.gpsDaemon.terminate()
		
		self.dockWidget.unload()
		self.showInterface(None)
		
		del self.dockWidget
		del self.dockWidget_simple
		
		self.iface.removePluginMenu("Qgis-&mapper",self.actionDockWidget)
		del self.actionDockWidget
		
		logging.debug("Plugin terminated.")

	def initLogging(self):
		""" set up rotating log file handler with custom formatting """
		handler = logging.handlers.RotatingFileHandler(logFilePath, maxBytes=1024*1024*10, backupCount=5)
		formatter = logging.Formatter("%(asctime)s %(levelname)-8s %(message)s")
		handler.setFormatter(formatter)
		logger = logging.getLogger() # root logger
		logger.setLevel(logging.DEBUG)
		logger.addHandler(handler)
		logging.debug("Plugin started.")

	def loadPlugins(self):
		"""Load all existing plugins"""
		SourcePlugins.loadPlugins(self)
	
	def loadConfiguration(self):
		""" Load configuration from settings """

		self.last_preview_scale=25

		settings = QSettings()
		settings.beginGroup("/plugins/GatherPlugin")

		# GUI
		self.interface_simple = settings.value("interface/simple", QVariant(False)).toBool()
		# output directory must be a python string
		self.output_directory = str( settings.value("output/directory", QVariant(os.path.expanduser("~/qgismapper/data/"))).toString() )
		self.output_append = settings.value("output/append", QVariant(0)).toInt()[0]
		self.preview_followPosition = settings.value("preview/followPosition", QVariant(True)).toBool()
		self.preview_scale = settings.value("preview/scale", QVariant(25)).toInt()[0]
		self.preview_keepPaths = settings.value("preview/keepPaths", QVariant(True)).toBool()

		# gps
		self.gps_source = settings.value("gps/source", QVariant("serial")).toString()
		self.gps_reconnectInterval = settings.value("gps/reconnectInterval", QVariant(2)).toInt()[0]
		self.gps_attemptsDuringRecording = settings.value("gps/attemptsDuringRecording", QVariant(3)).toInt()[0]
		self.gps_initFile = settings.value("gps/initFile", QVariant()).toString()
		self.gps_serial = settings.value("gps/serial/device", QVariant("/dev/rfcomm0")).toString()
		self.gps_serialBauds = settings.value("gps/serial/bauds", QVariant(38400)).toInt()[0]
		self.gps_file = settings.value("gps/file/path", QVariant(os.path.expanduser("~/nmea_log"))).toString()
		self.gps_fileCharsPerSecond = settings.value("gps/file/charsPerSecond", QVariant(300)).toInt()[0]
		self.gps_gpsdHost = settings.value("gps/gpsd/host", QVariant("localhost")).toString()
		self.gps_gpsdPort = settings.value("gps/gpsd/port", QVariant(2947)).toInt()[0]

		# compass
		self.compass_use = settings.value("compass/use", QVariant(False)).toBool()
		self.compass_device = settings.value("compass/device", QVariant("/dev/ttyUSB0")).toString()
		self.compass_bauds = settings.value("compass/bauds", QVariant(19200)).toInt()[0]
			
	def saveConfiguration(self):
		""" Save configuration to settings """

		settings = QSettings()
		settings.beginGroup("/plugins/GatherPlugin")

		# GUI
		settings.setValue("interface/simple", QVariant(self.interface_simple))
		settings.setValue("output/directory", QVariant(self.output_directory))
		settings.setValue("output/append", QVariant(self.output_append))
		settings.setValue("preview/followPosition", QVariant(self.preview_followPosition))
		settings.setValue("preview/scale", QVariant(self.preview_scale))
		settings.setValue("preview/keepPaths", QVariant(self.preview_keepPaths))

		# gps
		settings.setValue("gps/source", QVariant(self.gps_source))
		settings.setValue("gps/reconnectInterval", QVariant(self.gps_reconnectInterval))
		settings.setValue("gps/attemptsDuringRecording", QVariant(self.gps_attemptsDuringRecording))
		settings.setValue("gps/initFile", QVariant(self.gps_initFile))
		settings.setValue("gps/serial/device", QVariant(self.gps_serial))
		settings.setValue("gps/serial/bauds", QVariant(self.gps_serialBauds))
		settings.setValue("gps/file/path", QVariant(self.gps_file))
		settings.setValue("gps/file/charsPerSecond", QVariant(self.gps_fileCharsPerSecond))
		settings.setValue("gps/gpsd/host", QVariant(self.gps_gpsdHost))
		settings.setValue("gps/gpsd/port", QVariant(self.gps_gpsdPort))

		# compass
		settings.setValue("compass/use", QVariant(self.compass_use))
		settings.setValue("compass/device", QVariant(self.compass_device))
		settings.setValue("compass/bauds", QVariant(self.compass_bauds))

		
	def recordingStart(self):
		""" Start new recording (only call if there isn't any). """

		# check that we have gps input
		if not self.isGpsConnected():
			QMessageBox.warning(self.dockWidget, self.tr("Warning"), self.tr("GPS device isn't connected!\n\nPlease configure GPS input."))
			self.dockWidget.recording = False
			return
		# check we have position
		if self.getNmeaParser().fix == "none":
			if QMessageBox.warning(self.dockWidget, self.tr("Warning"),
					    self.tr("GPS doesn't have a valid position.\n\nDo you really want to start recording?"),
					    QMessageBox.Yes|QMessageBox.No) != QMessageBox.Yes:
				self.dockWidget.recording = False
				return

		self.recordingStartPathPreview()
		if not self.recordingStartGatherer():
			self.recordingStop()
			QMessageBox.information(self.dockWidget, self.tr("Warning"), self.tr("Recording was cancelled during initialization..."), self.tr("Ok"))
			return
		
		self.dockWidget.recording=True
		self.dockWidget_simple.recording=True
		
		#start a timer to keep the thread running...
		self.timer = QTimer()
		QObject.connect(self.timer, SIGNAL("timeout()"), self.runStatusTicker)
		self.timer.start(10)
		
		self.recording=True
		
	def recordingStop(self):
		""" Stop ongoing recording (only call if there is some). """
		self.recordingStopGatherer()
		if self.timer!=None:
			self.timer.stop()
			self.timer=None
			
		#we need to correctly terminate recording by processing events,
		#this leads to processGathererEvent_recordingTerminated()
		QCoreApplication.processEvents()
		
		self.recordingStopPathPreview()
		self.dockWidget.recording=False
		self.dockWidget_simple.recording=False
		self.recording=False
	
	def recordingStartGatherer(self):
		"""Start data gatherer thread"""
		self.gatherer=Gatherer.Gatherer(self)
		
		if not self.gatherer.alive:
			self.gatherer=None #don't try to stop the thread, as it's not running/alive
			return False
		
		QObject.connect(self.gatherer, SIGNAL("gathererEvent(PyQt_PyObject)"), self.processGathererEvent)
		
		self.gatherer.start()
		return True
		
	def recordingStopGatherer(self):
		"""Terminate data gatherer thread"""
		if self.gatherer!=None:
			self.gatherer.stop()
		
		#QObject.disconnect(gathererEvent) is done automatically...
			
	def recordingStartPathPreview(self):
		"""Initialize previewing recorded path"""
		self.rubberBand=QgsRubberBand(self.canvas)
		self.rubberBand.setColor(Qt.red)
		self.rubberBand.setWidth(3)
		self.rubberBand.reset(False)
	
	def recordingStopPathPreview(self):
		"""Terminate previewing recorded path"""
		self.rubberBand.setColor(Qt.green)
		self.previousPaths.append(self.rubberBand)
		self.rubberBand=None
		
		if not self.preview_keepPaths:
			self.removePathPreviews()
		else:
			self.canvas.refresh()
		
	def removePathPreviews(self):
		"""Remove recorded path previews from the map canvas"""
		for rb in self.previousPaths:
			self.canvas.scene().removeItem(rb)
		SourcePlugins.callMethodOnEach("clearMapCanvasItems", ())
		self.previousPaths=[]
		self.canvas.refresh()
	
	def recordingSwitch(self):
		""" If recording is on, turn it of - and the opposite :-) """
		if self.recording==False:
			self.recordingStart()
		else:
			self.recordingStop()
	
	def runStatusTicker(self):
		"""
		Make it possible for python to switch threads and
		if the gathering thread is not alive anymore, let
		the user know.
		"""
		if self.gatherer!=None:
			self.gatherer.msleep(1)

	def getLastDataSubdirectory(root):
		"""
			Returns last used data directory (including the time postfix). If no
			directory can be found, it returns empty string. The root parameter
			is data directory (specified by user), where the recordings are stored.
		"""
		dirs=[f for f in sorted(os.listdir(root))
			if os.path.isdir(os.path.join(root, f))]
			
		r=re.compile("[0-9]*-[0-9]*-[0-9]*_[0-9]*-[0-9]*-[0-9]*")
		dirs=[f for f in dirs if r.match(f)!=None]
		if len(dirs)!=0:
			return root+dirs[-1]+"/"
		else:
			return ""
	getLastDataSubdirectory=staticmethod(getLastDataSubdirectory)

	def processGathererEvent(self, data):
		try:
			apply(getattr(self, "processGathererEvent_"+data[0]), data[1:])
		except:
			traceback.print_exc(file=sys.stdout)
	
	def processGathererEvent_newTrackPoint(self, lat, lon, angle):
		"""Process 'new track point' event from gatherer."""
		try:
			if self.rubberBand and (lat!=0 or lon!=0):
				self.rubberBand.addPoint(QgsPoint(lon, lat))
		except:
			traceback.print_exc(file=sys.stdout)
	
	def gotNewTrackPoint(self, pt):
		""" update position marker """
		(lat, lon, angle, fix)=pt
		if lat!=0 or lon!=0:
			self.lastPosition=QgsPoint(lon, lat)
			self.lastAngle=angle
			self.lastFix=fix
			self.updatePositionMarker()
			self.updateExtent()
		
	
	def processGathererEvent_recordingTerminated(self, onUserRequest):
		"""Process 'recording terminated' event from gatherer."""
		self.gatherer.terminateAndCleanup()
		self.gatherer=None
		if not onUserRequest:
			self.recordingStop()
			QMessageBox.information(self.dockWidget,
				self.tr("Warning"),
				self.tr("Recording was cancelled by the gatherer thread (probably because of some communication error)..."),
				self.tr("Ok")
			)
			
	def updateExtent(self):
		"""Set correct map canvas extent for the current position and redraw."""
		extent=self.canvas.extent()
		if not self.preview_followPosition or self.lastPosition==None:
			pos=extent.center()
		else:
			boundaryExtent=QgsRectangle(extent)
			boundaryExtent.scale(0.5)
			if not boundaryExtent.contains(QgsRectangle(self.lastPosition, self.lastPosition)):
				pos=self.lastPosition
			else:
				pos=extent.center()
		
		if self.preview_scale!=self.last_preview_scale or pos!=extent.center():
			scale=pow(float(self.preview_scale)/99, 2)*0.4+0.0001
			newExtent=QgsRectangle(pos.x()-scale/2, pos.y()-scale/2, pos.x()+scale/2, pos.y()+scale/2)
			
			self.last_preview_scale=self.preview_scale
			
			self.canvas.setExtent(newExtent)
			self.canvas.refresh()

	def updatePositionMarker(self):
		"""Update position marker for the current position/orientation"""
		if self.positionMarker is None:
			return
		self.positionMarker.setHasPosition(self.lastFix)
		self.positionMarker.newCoords(self.lastPosition)
		self.positionMarker.angle=self.lastAngle
	
	def getNmeaParser(self):
		"""Returns the NMEA gps data parser object (useful to gather current pos. info)"""
		return self.gpsDaemon.nmeaParser
	
	def isGpsConnected(self):
		"""Returns, whether the gatherer is connected to gps device"""
		return self.gpsDaemon.isGpsConnected()

	def showInterface(self, simple):
		"""Show the specified version (simple or full) of user interface"""
		self.interface_simple=simple
		if self.curDockWidget!=None:
			self.iface.removeDockWidget(self.curDockWidget)
		
		if simple:
			self.curDockWidget=self.dockWidget_simple
		else:
			self.curDockWidget=self.dockWidget
		
		if simple!=None:
			self.iface.addDockWidget(Qt.RightDockWidgetArea, self.curDockWidget)
	
	def getRecordingEnabledAuxCheckbox(self, source):
		"""
		Returns checkbox widget for the specified source (string, e.g. 'Audio'),
		that informs user about recording status in the simple version of interface.
		Returns None, if specified source's checkbox isn't available.
		"""
		return self.dockWidget_simple.getRecordingEnabledCheckbox(source)
	
	def showHideDockWidget(self):
		if self.curDockWidget.isVisible():
			self.curDockWidget.hide()
		else:
			self.curDockWidget.show()

	def __dockwidgetVisibilityChanged(self, which):
		if self.curDockWidget.isVisible():
			self.actionDockWidget.setChecked(True)
		else:
			self.actionDockWidget.setChecked(False)
Esempio n. 3
0
    def setupUi(self, home_window):
        home_window.setObjectName("home_window")
        home_window.resize(1024, 700)
        home_window.setMinimumSize(QtCore.QSize(1024, 700))
        home_window.setMaximumSize(QtCore.QSize(16777215, 16777215))
        home_window.setAutoFillBackground(True)
        home_window.setDocumentMode(False)
        home_window.setDockNestingEnabled(False)
        home_window.setDockOptions(QtWidgets.QMainWindow.AnimatedDocks)
        home_window.setUnifiedTitleAndToolBarOnMac(False)
        self.widget = QtWidgets.QWidget(home_window)
        self.widget.setObjectName("widget")
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.widget)
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.central_block = QtWidgets.QVBoxLayout()
        self.central_block.setObjectName("central_block")
        self.central_block_table = QtWidgets.QTableWidget(self.widget)
        self.central_block_table.setMinimumSize(QtCore.QSize(500, 0))
        self.central_block_table.setAutoFillBackground(False)
        self.central_block_table.setStyleSheet("")
        self.central_block_table.setEditTriggers(
            QtWidgets.QAbstractItemView.AnyKeyPressed
            | QtWidgets.QAbstractItemView.EditKeyPressed
            | QtWidgets.QAbstractItemView.SelectedClicked)
        self.central_block_table.setProperty("showDropIndicator", False)
        self.central_block_table.setDragDropOverwriteMode(False)
        self.central_block_table.setAlternatingRowColors(True)
        self.central_block_table.setSelectionBehavior(
            QtWidgets.QAbstractItemView.SelectRows)
        self.central_block_table.setTextElideMode(QtCore.Qt.ElideRight)
        self.central_block_table.setShowGrid(True)
        self.central_block_table.setCornerButtonEnabled(False)
        self.central_block_table.setObjectName("central_block_table")
        self.central_block_table.setColumnCount(5)
        self.central_block_table.setRowCount(2)
        item = QtWidgets.QTableWidgetItem()
        self.central_block_table.setVerticalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.central_block_table.setVerticalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.central_block_table.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.central_block_table.setHorizontalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.central_block_table.setHorizontalHeaderItem(2, item)
        item = QtWidgets.QTableWidgetItem()
        self.central_block_table.setHorizontalHeaderItem(3, item)
        item = QtWidgets.QTableWidgetItem()
        self.central_block_table.setHorizontalHeaderItem(4, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignVCenter)
        item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable
                      | QtCore.Qt.ItemIsEnabled)
        self.central_block_table.setItem(0, 0, item)
        item = QtWidgets.QTableWidgetItem()
        self.central_block_table.setItem(0, 1, item)
        item = QtWidgets.QTableWidgetItem()
        self.central_block_table.setItem(1, 0, item)
        item = QtWidgets.QTableWidgetItem()
        self.central_block_table.setItem(1, 1, item)
        self.central_block_table.horizontalHeader().setVisible(True)
        self.central_block_table.horizontalHeader().setCascadingSectionResizes(
            True)
        self.central_block_table.horizontalHeader().setHighlightSections(False)
        self.central_block_table.horizontalHeader().setMinimumSectionSize(100)
        self.central_block_table.horizontalHeader().setSortIndicatorShown(True)
        self.central_block_table.horizontalHeader().setStretchLastSection(
            False)
        self.central_block_table.verticalHeader().setVisible(False)
        self.central_block_table.verticalHeader().setCascadingSectionResizes(
            True)
        self.central_block_table.verticalHeader().setHighlightSections(False)
        self.central_block_table.verticalHeader().setMinimumSectionSize(0)
        self.central_block_table.verticalHeader().setSortIndicatorShown(False)
        self.central_block_table.verticalHeader().setStretchLastSection(False)
        self.central_block.addWidget(self.central_block_table)
        self.horizontalLayout_5.addLayout(self.central_block)
        home_window.setCentralWidget(self.widget)
        self.header_block = QtWidgets.QDockWidget(home_window)
        self.header_block.setMinimumSize(QtCore.QSize(322, 95))
        self.header_block.setMaximumSize(QtCore.QSize(524287, 95))
        self.header_block.setAutoFillBackground(False)
        self.header_block.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable)
        self.header_block.setAllowedAreas(QtCore.Qt.BottomDockWidgetArea
                                          | QtCore.Qt.TopDockWidgetArea)
        self.header_block.setObjectName("header_block")
        self.header_block_contents = QtWidgets.QWidget()
        self.header_block_contents.setMinimumSize(QtCore.QSize(0, 0))
        self.header_block_contents.setMaximumSize(
            QtCore.QSize(16777215, 16777215))
        self.header_block_contents.setObjectName("header_block_contents")
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout(
            self.header_block_contents)
        self.horizontalLayout_4.setContentsMargins(9, 4, 9, 0)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.header_block_contents2 = QtWidgets.QWidget(
            self.header_block_contents)
        self.header_block_contents2.setObjectName("header_block_contents2")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout(
            self.header_block_contents2)
        self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.header_block_btn_add_book = QtWidgets.QPushButton(
            self.header_block_contents2)
        self.header_block_btn_add_book.setMinimumSize(QtCore.QSize(70, 70))
        self.header_block_btn_add_book.setMaximumSize(QtCore.QSize(70, 70))
        self.header_block_btn_add_book.setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.header_block_btn_add_book.setAutoFillBackground(False)
        self.header_block_btn_add_book.setStyleSheet("")
        self.header_block_btn_add_book.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("ressources/icons/white/book_add.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.header_block_btn_add_book.setIcon(icon)
        self.header_block_btn_add_book.setIconSize(QtCore.QSize(60, 60))
        self.header_block_btn_add_book.setAutoDefault(False)
        self.header_block_btn_add_book.setDefault(False)
        self.header_block_btn_add_book.setFlat(False)
        self.header_block_btn_add_book.setObjectName(
            "header_block_btn_add_book")
        self.horizontalLayout_3.addWidget(self.header_block_btn_add_book)
        self.header_block_btn_create_book = QtWidgets.QPushButton(
            self.header_block_contents2)
        self.header_block_btn_create_book.setMinimumSize(QtCore.QSize(70, 70))
        self.header_block_btn_create_book.setMaximumSize(QtCore.QSize(70, 70))
        self.header_block_btn_create_book.setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.header_block_btn_create_book.setAutoFillBackground(False)
        self.header_block_btn_create_book.setStyleSheet("")
        self.header_block_btn_create_book.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap("ressources/icons/white/book_new.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.header_block_btn_create_book.setIcon(icon1)
        self.header_block_btn_create_book.setIconSize(QtCore.QSize(60, 60))
        self.header_block_btn_create_book.setAutoDefault(False)
        self.header_block_btn_create_book.setDefault(False)
        self.header_block_btn_create_book.setFlat(False)
        self.header_block_btn_create_book.setObjectName(
            "header_block_btn_create_book")
        self.horizontalLayout_3.addWidget(self.header_block_btn_create_book)
        self.header_block_btn_del_book = QtWidgets.QPushButton(
            self.header_block_contents2)
        self.header_block_btn_del_book.setMinimumSize(QtCore.QSize(70, 70))
        self.header_block_btn_del_book.setMaximumSize(QtCore.QSize(70, 70))
        self.header_block_btn_del_book.setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.header_block_btn_del_book.setAutoFillBackground(False)
        self.header_block_btn_del_book.setStyleSheet("")
        self.header_block_btn_del_book.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap("ressources/icons/white/book_del.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.header_block_btn_del_book.setIcon(icon2)
        self.header_block_btn_del_book.setIconSize(QtCore.QSize(60, 60))
        self.header_block_btn_del_book.setAutoDefault(False)
        self.header_block_btn_del_book.setDefault(False)
        self.header_block_btn_del_book.setFlat(False)
        self.header_block_btn_del_book.setObjectName(
            "header_block_btn_del_book")
        self.horizontalLayout_3.addWidget(self.header_block_btn_del_book)
        spacerItem = QtWidgets.QSpacerItem(427, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem)
        self.header_block_btn_settings = QtWidgets.QPushButton(
            self.header_block_contents2)
        self.header_block_btn_settings.setMinimumSize(QtCore.QSize(70, 70))
        self.header_block_btn_settings.setMaximumSize(QtCore.QSize(70, 70))
        self.header_block_btn_settings.setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.header_block_btn_settings.setAutoFillBackground(False)
        self.header_block_btn_settings.setText("")
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap("ressources/icons/white/settings.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.header_block_btn_settings.setIcon(icon3)
        self.header_block_btn_settings.setIconSize(QtCore.QSize(60, 60))
        self.header_block_btn_settings.setCheckable(False)
        self.header_block_btn_settings.setFlat(False)
        self.header_block_btn_settings.setObjectName(
            "header_block_btn_settings")
        self.horizontalLayout_3.addWidget(self.header_block_btn_settings)
        self.horizontalLayout_4.addWidget(self.header_block_contents2)
        self.header_block.setWidget(self.header_block_contents)
        home_window.addDockWidget(QtCore.Qt.DockWidgetArea(4),
                                  self.header_block)
        self.sorting_block = DockWidget(home_window)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Preferred,
            QtWidgets.QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.sorting_block.sizePolicy().hasHeightForWidth())
        self.sorting_block.setSizePolicy(sizePolicy)
        self.sorting_block.setMinimumSize(QtCore.QSize(230, 227))
        self.sorting_block.setMaximumSize(QtCore.QSize(600, 524287))
        self.sorting_block.setFloating(False)
        self.sorting_block.setFeatures(
            QtWidgets.QDockWidget.DockWidgetClosable
            | QtWidgets.QDockWidget.DockWidgetMovable)
        self.sorting_block.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea
                                           | QtCore.Qt.RightDockWidgetArea)
        self.sorting_block.setObjectName("sorting_block")
        self.sorting_block_contents = QtWidgets.QWidget()
        self.sorting_block_contents.setMaximumSize(QtCore.QSize(600, 16777215))
        self.sorting_block_contents.setObjectName("sorting_block_contents")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(
            self.sorting_block_contents)
        self.verticalLayout_2.setContentsMargins(9, 0, 0, 0)
        self.verticalLayout_2.setSpacing(2)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setContentsMargins(-1, -1, 0, -1)
        self.horizontalLayout_2.setSpacing(2)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.sorting_block_search_label = QtWidgets.QLabel(
            self.sorting_block_contents)
        self.sorting_block_search_label.setMinimumSize(QtCore.QSize(60, 20))
        self.sorting_block_search_label.setMaximumSize(
            QtCore.QSize(60, 16777215))
        self.sorting_block_search_label.setObjectName(
            "sorting_block_search_label")
        self.horizontalLayout_2.addWidget(self.sorting_block_search_label)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem1)
        self.sorting_block_search_edit = QtWidgets.QLineEdit(
            self.sorting_block_contents)
        self.sorting_block_search_edit.setMaximumSize(
            QtCore.QSize(10, 16777215))
        self.sorting_block_search_edit.setObjectName(
            "sorting_block_search_edit")
        self.horizontalLayout_2.addWidget(self.sorting_block_search_edit)
        self.sorting_block_search_button = QtWidgets.QPushButton(
            self.sorting_block_contents)
        self.sorting_block_search_button.setMinimumSize(QtCore.QSize(20, 20))
        self.sorting_block_search_button.setMaximumSize(QtCore.QSize(20, 20))
        self.sorting_block_search_button.setText("")
        self.sorting_block_search_button.setObjectName(
            "sorting_block_search_button")
        self.horizontalLayout_2.addWidget(self.sorting_block_search_button)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.sorting_block_search_area = QtWidgets.QGroupBox(
            self.sorting_block_contents)
        self.sorting_block_search_area.setStyleSheet("")
        self.sorting_block_search_area.setFlat(True)
        self.sorting_block_search_area.setObjectName(
            "sorting_block_search_area")
        self.sorting_block_search_area_contents = QtWidgets.QVBoxLayout(
            self.sorting_block_search_area)
        self.sorting_block_search_area_contents.setObjectName(
            "sorting_block_search_area_contents")
        self.verticalLayout.addWidget(self.sorting_block_search_area)
        self.sorting_block_tree = QtWidgets.QTreeWidget(
            self.sorting_block_contents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.sorting_block_tree.sizePolicy().hasHeightForWidth())
        self.sorting_block_tree.setSizePolicy(sizePolicy)
        self.sorting_block_tree.setMinimumSize(QtCore.QSize(218, 100))
        self.sorting_block_tree.setMaximumSize(QtCore.QSize(600, 16777215))
        self.sorting_block_tree.setRootIsDecorated(True)
        self.sorting_block_tree.setUniformRowHeights(True)
        self.sorting_block_tree.setItemsExpandable(True)
        self.sorting_block_tree.setAllColumnsShowFocus(False)
        self.sorting_block_tree.setWordWrap(True)
        self.sorting_block_tree.setHeaderHidden(True)
        self.sorting_block_tree.setObjectName("sorting_block_tree")
        item_0 = QtWidgets.QTreeWidgetItem(self.sorting_block_tree)
        item_0 = QtWidgets.QTreeWidgetItem(self.sorting_block_tree)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        item_0 = QtWidgets.QTreeWidgetItem(self.sorting_block_tree)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        item_0 = QtWidgets.QTreeWidgetItem(self.sorting_block_tree)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        self.verticalLayout.addWidget(self.sorting_block_tree)
        self.verticalLayout_2.addLayout(self.verticalLayout)
        self.sorting_block.setWidget(self.sorting_block_contents)
        home_window.addDockWidget(QtCore.Qt.DockWidgetArea(1),
                                  self.sorting_block)
        self.info_block = DockWidget(home_window)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Preferred,
            QtWidgets.QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.info_block.sizePolicy().hasHeightForWidth())
        self.info_block.setSizePolicy(sizePolicy)
        self.info_block.setMinimumSize(QtCore.QSize(230, 305))
        self.info_block.setMaximumSize(QtCore.QSize(600, 524287))
        self.info_block.setFeatures(QtWidgets.QDockWidget.DockWidgetClosable
                                    | QtWidgets.QDockWidget.DockWidgetMovable)
        self.info_block.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea
                                        | QtCore.Qt.RightDockWidgetArea)
        self.info_block.setObjectName("info_block")
        self.info_block_contents = QtWidgets.QWidget()
        self.info_block_contents.setObjectName("info_block_contents")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.info_block_contents)
        self.verticalLayout_4.setContentsMargins(9, 0, 0, 0)
        self.verticalLayout_4.setSpacing(2)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem2 = QtWidgets.QSpacerItem(0, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem2)
        self.info_block_cover = QtWidgets.QPushButton(self.info_block_contents)
        self.info_block_cover.setMinimumSize(QtCore.QSize(190, 160))
        self.info_block_cover.setMaximumSize(QtCore.QSize(190, 160))
        self.info_block_cover.setFocusPolicy(QtCore.Qt.NoFocus)
        self.info_block_cover.setStyleSheet(
            "background: transparent !important;")
        self.info_block_cover.setText("")
        self.info_block_cover.setIconSize(QtCore.QSize(160, 160))
        self.info_block_cover.setObjectName("info_block_cover")
        self.horizontalLayout.addWidget(self.info_block_cover)
        spacerItem3 = QtWidgets.QSpacerItem(0, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem3)
        self.verticalLayout_4.addLayout(self.horizontalLayout)
        self.info_block_title = QtWidgets.QHBoxLayout()
        self.info_block_title.setSizeConstraint(
            QtWidgets.QLayout.SetMinimumSize)
        self.info_block_title.setSpacing(0)
        self.info_block_title.setObjectName("info_block_title")
        self.info_block_title_label = QtWidgets.QLabel(
            self.info_block_contents)
        self.info_block_title_label.setMinimumSize(QtCore.QSize(70, 20))
        self.info_block_title_label.setMaximumSize(QtCore.QSize(70, 20))
        self.info_block_title_label.setObjectName("info_block_title_label")
        self.info_block_title.addWidget(self.info_block_title_label)
        self.info_block_title_value = QtWidgets.QLabel(
            self.info_block_contents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Ignored)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.info_block_title_value.sizePolicy().hasHeightForWidth())
        self.info_block_title_value.setSizePolicy(sizePolicy)
        self.info_block_title_value.setMinimumSize(QtCore.QSize(120, 20))
        self.info_block_title_value.setMaximumSize(QtCore.QSize(16777215, 45))
        self.info_block_title_value.setWordWrap(True)
        self.info_block_title_value.setObjectName("info_block_title_value")
        self.info_block_title.addWidget(self.info_block_title_value)
        self.verticalLayout_4.addLayout(self.info_block_title)
        self.info_block_serie = QtWidgets.QHBoxLayout()
        self.info_block_serie.setSizeConstraint(
            QtWidgets.QLayout.SetMinimumSize)
        self.info_block_serie.setSpacing(0)
        self.info_block_serie.setObjectName("info_block_serie")
        self.info_block_serie_label = QtWidgets.QLabel(
            self.info_block_contents)
        self.info_block_serie_label.setMinimumSize(QtCore.QSize(70, 20))
        self.info_block_serie_label.setMaximumSize(QtCore.QSize(70, 20))
        self.info_block_serie_label.setObjectName("info_block_serie_label")
        self.info_block_serie.addWidget(self.info_block_serie_label)
        self.info_block_serie_value = QtWidgets.QLabel(
            self.info_block_contents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Ignored)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.info_block_serie_value.sizePolicy().hasHeightForWidth())
        self.info_block_serie_value.setSizePolicy(sizePolicy)
        self.info_block_serie_value.setMinimumSize(QtCore.QSize(120, 20))
        self.info_block_serie_value.setMaximumSize(QtCore.QSize(16777215, 45))
        self.info_block_serie_value.setWordWrap(True)
        self.info_block_serie_value.setObjectName("info_block_serie_value")
        self.info_block_serie.addWidget(self.info_block_serie_value)
        self.verticalLayout_4.addLayout(self.info_block_serie)
        self.info_block_authors = QtWidgets.QHBoxLayout()
        self.info_block_authors.setSizeConstraint(
            QtWidgets.QLayout.SetMinimumSize)
        self.info_block_authors.setSpacing(0)
        self.info_block_authors.setObjectName("info_block_authors")
        self.info_block_authors_label = QtWidgets.QLabel(
            self.info_block_contents)
        self.info_block_authors_label.setMinimumSize(QtCore.QSize(70, 20))
        self.info_block_authors_label.setMaximumSize(QtCore.QSize(70, 20))
        self.info_block_authors_label.setObjectName("info_block_authors_label")
        self.info_block_authors.addWidget(self.info_block_authors_label)
        self.info_block_authors_value = QtWidgets.QLabel(
            self.info_block_contents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Ignored)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.info_block_authors_value.sizePolicy().hasHeightForWidth())
        self.info_block_authors_value.setSizePolicy(sizePolicy)
        self.info_block_authors_value.setMinimumSize(QtCore.QSize(120, 20))
        self.info_block_authors_value.setMaximumSize(QtCore.QSize(
            16777215, 45))
        self.info_block_authors_value.setWordWrap(True)
        self.info_block_authors_value.setObjectName("info_block_authors_value")
        self.info_block_authors.addWidget(self.info_block_authors_value)
        self.verticalLayout_4.addLayout(self.info_block_authors)
        self.info_block_file_formats = QtWidgets.QHBoxLayout()
        self.info_block_file_formats.setSizeConstraint(
            QtWidgets.QLayout.SetMinimumSize)
        self.info_block_file_formats.setSpacing(0)
        self.info_block_file_formats.setObjectName("info_block_file_formats")
        self.info_block_file_formats_label = QtWidgets.QLabel(
            self.info_block_contents)
        self.info_block_file_formats_label.setMinimumSize(QtCore.QSize(70, 20))
        self.info_block_file_formats_label.setMaximumSize(QtCore.QSize(70, 20))
        self.info_block_file_formats_label.setObjectName(
            "info_block_file_formats_label")
        self.info_block_file_formats.addWidget(
            self.info_block_file_formats_label)
        self.info_block_file_formats_value = QtWidgets.QLabel(
            self.info_block_contents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Ignored)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.info_block_file_formats_value.
                                     sizePolicy().hasHeightForWidth())
        self.info_block_file_formats_value.setSizePolicy(sizePolicy)
        self.info_block_file_formats_value.setMinimumSize(QtCore.QSize(
            120, 20))
        self.info_block_file_formats_value.setMaximumSize(
            QtCore.QSize(16777215, 45))
        self.info_block_file_formats_value.setStyleSheet("")
        self.info_block_file_formats_value.setWordWrap(True)
        self.info_block_file_formats_value.setObjectName(
            "info_block_file_formats_value")
        self.info_block_file_formats.addWidget(
            self.info_block_file_formats_value)
        self.verticalLayout_4.addLayout(self.info_block_file_formats)
        self.info_block_size = QtWidgets.QHBoxLayout()
        self.info_block_size.setSizeConstraint(
            QtWidgets.QLayout.SetMinimumSize)
        self.info_block_size.setSpacing(0)
        self.info_block_size.setObjectName("info_block_size")
        self.info_block_size_label = QtWidgets.QLabel(self.info_block_contents)
        self.info_block_size_label.setMinimumSize(QtCore.QSize(70, 20))
        self.info_block_size_label.setMaximumSize(QtCore.QSize(70, 20))
        self.info_block_size_label.setObjectName("info_block_size_label")
        self.info_block_size.addWidget(self.info_block_size_label)
        self.info_block_size_value = QtWidgets.QLabel(self.info_block_contents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Ignored)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.info_block_size_value.sizePolicy().hasHeightForWidth())
        self.info_block_size_value.setSizePolicy(sizePolicy)
        self.info_block_size_value.setMinimumSize(QtCore.QSize(120, 20))
        self.info_block_size_value.setMaximumSize(QtCore.QSize(16777215, 45))
        self.info_block_size_value.setStyleSheet("")
        self.info_block_size_value.setWordWrap(True)
        self.info_block_size_value.setObjectName("info_block_size_value")
        self.info_block_size.addWidget(self.info_block_size_value)
        self.verticalLayout_4.addLayout(self.info_block_size)
        self.info_block_synopsis = QtWidgets.QVBoxLayout()
        self.info_block_synopsis.setSizeConstraint(
            QtWidgets.QLayout.SetMinimumSize)
        self.info_block_synopsis.setSpacing(0)
        self.info_block_synopsis.setObjectName("info_block_synopsis")
        self.verticalLayout_4.addLayout(self.info_block_synopsis)
        self.info_block.setWidget(self.info_block_contents)
        home_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.info_block)

        self.retranslateUi(home_window)
        QtCore.QMetaObject.connectSlotsByName(home_window)