module.py 1.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 18 18:34:40 2018

@author: Antoine Lima, Leo Reynaert, Domitille Jehenne
"""

import logging

from PyQt5 import QtWidgets
from PyQt5.QtGui import QRegion
from PyQt5.QtCore import QTime, QTimer
from PyQt5.QtWidgets import QTableWidgetItem, QComboBox

from modules import *

class Module(QtWidgets.QWidget):
	def __init__(self, parent=None, widget=None):
		# UI Setup
		QtWidgets.QWidget.__init__(self, parent)
		self.parent_win = parent
		self.ui = widget
		self.ui.setupUi(self)

	def switchModule(self, new_type):
		panel_idx = self.parent_win.modules.index(new_type)
		
		if panel_idx<0:
			logging.error('Error: unknown panel {}'.format(new_type))
		else:
			self.parent_win.ui.panels.currentWidget().unload()
			self.parent_win.ui.panels.setCurrentIndex(panel_idx)
			self.parent_win.ui.panels.currentWidget().load()

	def load(self):
		logging.warning('Unimplemented method "load" for {}'.format(self.__class__))

	def unload(self):
		logging.warning('Unimplemented method "unload" for {}'.format(self.__class__))

	def other(self, **kwargs):
		logging.warning('Unimplemented method "other" for {}'.format(self.__class__))