def init(self):
        self.pic = Picture(self)
        self.setCentralWidget(self.pic)

        self.panel = Panel(self.pic)
        self.dock = QDockWidget('info panel')
        self.dock.setWidget(self.panel)
        self.dock.setAllowedAreas(Qt.RightDockWidgetArea)
        self.addDockWidget(Qt.RightDockWidgetArea, self.dock)
        self.dock.setFeatures(QDockWidget.NoDockWidgetFeatures)
        self.dock.setFixedWidth(300)

        self.setWindowTitle('Untitled')

        dock = QDockWidget('command line', self)
        dock.setWidget(TwoLines())
        dock.setAllowedAreas(Qt.BottomDockWidgetArea)
        self.addDockWidget(Qt.BottomDockWidgetArea, dock)
        dock.setFeatures(QDockWidget.NoDockWidgetFeatures)
        dock.setFixedHeight(60)
        dock.setFixedWidth(800)

        desktop = QApplication.desktop()
        self.setGeometry(300, 100, desktop.width(), desktop.height())
        self.setFixedSize(1100, 705)
Пример #2
0
    def history_subwindow(self):
        """
        Summary of the function:
        ------------------------
        (a) Defining the sub-window for showing executed docker containers history

        Parameters:
        -----------
        :arg: None
        :return: A dock-widget object (sub-window)
        """
        dock_widget = QDockWidget(self)
        # dock_widget.setTitleBarWidget(self.subdoc_custom_title_bar("history"))
        dock_widget.setTitleBarWidget(QWidget(None))
        dock_widget.setFloating(False)
        dock_widget.setFont(self.subdoc_font_customization())
        dock_widget.setFeatures(dock_widget.NoDockWidgetFeatures)
        dock_widget.setFixedHeight((int(self.screen_height * 3.9) // 10))
        dock_widget.setFixedWidth(self.screen_width // 2)
        dock_widget.setStyleSheet(css_layout.dockwidget_layout)
        dock_widget.setAllowedAreas(Qt.RightDockWidgetArea)
        return dock_widget
Пример #3
0
    def userstats_subwindow(self):
        """
        Summary of the function:
        ------------------------
        (a) Defining the sub-window for the User Statistics

        Parameters:
        -----------
        :arg: None
        :return: A dock-widget object (sub-window)
        """
        dock_widget = QDockWidget(self)
        # dock_widget.setTitleBarWidget(self.subdoc_custom_title_bar("userstats"))
        dock_widget.setTitleBarWidget(QWidget(None))
        dock_widget.setFloating(False)
        dock_widget.setFont(self.subdoc_font_customization())
        dock_widget.setFeatures(dock_widget.NoDockWidgetFeatures)
        dock_widget.setFixedHeight((int(self.screen_height * 3.4) // 10))
        dock_widget.setFixedWidth(self.screen_width // 2)
        dock_widget.setStyleSheet(css_layout.dockwidget_layout)
        dock_widget.setAllowedAreas(Qt.TopDockWidgetArea)
        return dock_widget
Пример #4
0
    def enqueued_containers_subwindow(self):
        """
        Summary of the function:
        ------------------------
        (a) Defining the sub-window for showing the enqueued containers information

        Parameters:
        -----------
        :arg: None
        :return: A dock-widget object (sub-window)
        """
        dock_widget = QDockWidget(self)
        # dock_widget.setTitleBarWidget(self.subdoc_custom_title_bar("enqueued"))
        dock_widget.setTitleBarWidget(QWidget(None))
        dock_widget.setFloating(False)
        dock_widget.setFont(self.subdoc_font_customization())
        dock_widget.setFeatures(dock_widget.NoDockWidgetFeatures)
        dock_widget.setFixedHeight(
            (int(self.screen_height * 4.6) // 10))  # 48%
        dock_widget.setFixedWidth(int(self.screen_width * 4.97) // 10)
        dock_widget.setStyleSheet(css_layout.dockwidget_layout)
        dock_widget.setAllowedAreas(Qt.RightDockWidgetArea)
        return dock_widget
Пример #5
0
 def status_subwindow(self):
     """
     Summary of the function:
     ------------------------
     (a) Defining the sub-window for the priority queue status
     (b) Info would be blank for initial loading
     
     Parameters:
     -----------
     :arg: None
     :return: A dock-widget object
     """
     dock_widget = QDockWidget(self)
     # dock_widget.setTitleBarWidget(self.subdoc_custom_title_bar("status"))
     dock_widget.setTitleBarWidget(QWidget(None))
     dock_widget.setFont(self.subdoc_font_customization())
     dock_widget.setFloating(False)
     dock_widget.setFeatures(dock_widget.NoDockWidgetFeatures)
     dock_widget.setFixedWidth(self.screen_width // 2)
     dock_widget.setFixedHeight(int(self.screen_height * 2.1) //
                                10)  # 25% of total height
     dock_widget.setStyleSheet(css_layout.dockwidget_layout)
     dock_widget.setAllowedAreas(Qt.LeftDockWidgetArea)
     return dock_widget
Пример #6
0
class Scrabble(QMainWindow):
    def __init__(self, parent=None):
        super(Scrabble, self).__init__(parent)
        self.score = Score()
        self.player_name = 'Gracz'
        self.is_game_started = False

        self.turn_buttons = []
        self.other_widgets = []
        self.button_size = 40
        self.font_size = 12
        self.timer_font_size = 15

        self.right_table = ScoreView(self.score, 'AI', 0, 3)
        self.left_table = ScoreView(self.score, 'Gracz', 0, 3)

        self.left_widget = QWidget()
        self.left_layout = QVBoxLayout()

        self.right_widget = QWidget()
        self.right_layout = QVBoxLayout()

        self.player_label = QLabel('Gracz')

        self.player_clock = Clock()
        self.player_clock.set_time(15)

        self.player_widget = QWidget()
        self.player_layout = QHBoxLayout()
        self.player_layout.addWidget(self.player_label, alignment=Qt.AlignLeft)
        self.player_layout.addWidget(self.player_clock,
                                     alignment=Qt.AlignRight)
        self.player_widget.setLayout(self.player_layout)

        self.ai_label = QLabel('AI')

        self.ai_clock = Clock()
        self.ai_clock.set_time(15)
        self.ai_clock.setAlignment(Qt.AlignRight)

        self.ai_widget = QWidget()
        self.ai_layout = QHBoxLayout()
        self.ai_layout.addWidget(self.ai_label, alignment=Qt.AlignLeft)
        self.ai_layout.addWidget(self.ai_clock, alignment=Qt.AlignRight)
        self.ai_widget.setLayout(self.ai_layout)

        self.sack_label = QLabel('Litery w worku:')

        self.sack_counter = QLabel('100')

        self.sack_widget = QWidget()
        self.sack_layout = QHBoxLayout()
        self.sack_layout.addWidget(self.sack_label, alignment=Qt.AlignLeft)
        self.sack_layout.addWidget(self.sack_counter, alignment=Qt.AlignRight)
        self.sack_widget.setLayout(self.sack_layout)

        self.information_area = QScrollArea()
        self.information_area.setWidgetResizable(True)
        self.information_area.verticalScrollBar().rangeChanged.connect(
            self.set_to_max_value)

        self.information_label = QLabel('Witaj, jak masz na imię?')
        self.information_label.setAlignment(Qt.AlignTop)
        self.information_label.setWordWrap(True)
        self.information_label.setMargin(5)

        self.information_area.setWidget(self.information_label)

        self.prompt_label = QLabel('Przedstaw się')
        self.other_widgets.append(self.prompt_label)

        self.text_field = QLineEdit()
        self.other_widgets.append(self.text_field)

        self.confirm_button = QPushButton('Potwierdź')
        self.other_widgets.append(self.confirm_button)
        self.confirm_button.clicked.connect(self.text_field.returnPressed)
        self.text_field.returnPressed.connect(self.confirmed)

        self.end_turn_button = QPushButton('Zakończ ruch')
        self.turn_buttons.append(self.end_turn_button)

        self.skip_button = QPushButton('Pomiń ruch')
        self.turn_buttons.append(self.skip_button)

        self.exchange_button = QPushButton('Wymień litery')
        self.turn_buttons.append(self.exchange_button)

        self.collect_button = QPushButton('Zbierz litery')
        self.turn_buttons.append(self.collect_button)

        self.start_resign_button = QPushButton('Rozpocznij grę', self)
        self.other_widgets.append(self.start_resign_button)
        self.start_resign_button.setDisabled(True)

        for button in self.turn_buttons:
            button.setDisabled(True)

        self.end_turn_button.clicked.connect(self.end_turn_button_clicked)

        self.skip_button.clicked.connect(self.skip_button_clicked)

        self.exchange_button.clicked.connect(self.exchange_button_clicked)

        self.collect_button.clicked.connect(self.collect_button_clicked)

        self.start_resign_button.clicked.connect(
            self.start_resign_button_clicked)

        self.board = Board(self.score, self.player_clock, self.ai_clock,
                           self.add_info, self.text_field,
                           self.prompt_label.setText, self.confirm_button,
                           self.disable_buttons, self.sack_counter.setText)

        self.left_layout.addWidget(self.sack_widget)
        self.left_layout.addWidget(self.information_area)
        self.left_layout.addWidget(self.prompt_label)
        self.left_layout.addWidget(self.text_field)
        self.left_layout.addWidget(self.confirm_button)
        self.left_layout.addWidget(self.start_resign_button)
        self.left_layout.addWidget(self.collect_button)
        self.left_layout.addWidget(self.end_turn_button)
        self.left_layout.addWidget(self.exchange_button)
        self.left_layout.addWidget(self.skip_button)

        self.right_layout.addWidget(self.player_widget)
        self.right_layout.addWidget(self.left_table)
        self.right_layout.addWidget(self.ai_widget)
        self.right_layout.addWidget(self.right_table)

        self.left_widget.setLayout(self.left_layout)
        self.left_dock_widget = QDockWidget()
        self.left_dock_widget.setFeatures(QDockWidget.NoDockWidgetFeatures)
        self.left_dock_widget.setTitleBarWidget(QWidget())
        self.left_dock_widget.setFixedWidth(300)
        self.left_dock_widget.setWidget(self.left_widget)

        self.right_widget.setLayout(self.right_layout)
        self.right_dock_widget = QDockWidget()
        self.right_dock_widget.setFeatures(QDockWidget.NoDockWidgetFeatures)
        self.right_dock_widget.setTitleBarWidget(QWidget())
        self.right_dock_widget.setFixedWidth(300)
        self.right_dock_widget.setWidget(self.right_widget)

        self.setCentralWidget(self.board)
        self.addDockWidget(Qt.RightDockWidgetArea, self.right_dock_widget)
        self.addDockWidget(Qt.LeftDockWidgetArea, self.left_dock_widget)

    def confirmed(self):
        new_name = self.text_field.text()
        if not new_name:
            self.add_info('Musisz coś wpisać!')
            return
        self.player_name = new_name
        self.player_label.setText(self.player_name)
        self.start_resign_button.setDisabled(False)
        self.confirm_button.setDisabled(True)
        self.text_field.setDisabled(True)
        self.text_field.clear()
        self.prompt_label.clear()
        self.add_info(f'Cześć {self.player_name}!')
        self.text_field.returnPressed.disconnect(self.confirmed)
        self.text_field.returnPressed.connect(self.board.blank_entered)

    def add_info(self, info):
        current = self.information_label.text()
        new = current + '\n\n' + info
        self.information_label.setText(new)

    def set_to_max_value(self):
        self.information_area.verticalScrollBar().setValue(
            self.information_area.verticalScrollBar().maximum())

    def exchange_button_clicked(self):
        self.board.exchange_letters()

    def end_turn_button_clicked(self):
        self.board.end_turn()

    def skip_button_clicked(self):
        self.board.skip_turn()

    def collect_button_clicked(self):
        self.board.collect_tiles()

    def disable_buttons(self, value):
        for button in self.turn_buttons:
            button.setDisabled(value)

    def start_resign_button_clicked(self):
        if self.is_game_started:
            self.setCentralWidget(self.board)
            self.ai_clock.set_time(15)
            self.player_clock.set_time(15)
            self.disable_buttons(True)
            self.right_table.clear_rows()
            self.left_table.clear_rows()
            self.is_game_started = False
            self.start_resign_button.setText('Rozpocznij grę')
            self.board.score.clear()
            self.board.reset_game()
        else:
            self.disable_buttons(False)
            self.is_game_started = True
            self.start_resign_button.setText('Poddaj się')
            self.board.start_game()

    def resizeEvent(self, event):
        if self.board:
            self.board.auto_resize()
        font_size = round(sqrt(self.height() // 10))
        if self.font_size != font_size:
            self.font_size = font_size
            timer_font_size = round(self.font_size * 1.5)

            self.setFont(QFont('Verdana', self.font_size))
            self.player_clock.setFont(QFont('Verdana', timer_font_size))
            self.ai_clock.setFont(QFont('Verdana', timer_font_size))
            self.sack_counter.setFont(QFont('Verdana', timer_font_size))

            self.right_table.resizeRowsToContents()
            self.left_table.resizeRowsToContents()

        button_size = round(sqrt(self.height()))
        if self.button_size != button_size:
            self.button_size = button_size
            for button in self.turn_buttons + self.other_widgets:
                button.setFixedHeight(self.button_size)

        QMainWindow.resizeEvent(self, event)
Пример #7
0
class mainWindow(QWidget):
    def __init__(self, parent=None):
        super(mainWindow, self).__init__(parent)
        self.setWindowTitle("PyAdminDash")
        self.setWindowIcon(QIcon('/home/abdelmoumen/test.png'))
        self.UI()

        titleBarHeight = self.style().pixelMetric(QStyle.PM_TitleBarHeight,
                                                  QStyleOptionTitleBar(), self)
        geometry = app.desktop().availableGeometry()
        geometry.setHeight(geometry.height() - (titleBarHeight * 2))

        self.setGeometry(geometry)

    def UI(self):
        QMessageBox.information(
            self, 'Information',
            'Make Sure You execute this tool with the required permission, and you installed the requirements\ncheck README.md, Pipfile'
        )
        self.layouts()
        self.widgets()

    def layouts(self):
        menuLayout = QVBoxLayout()
        menuLayout.setContentsMargins(0, 0, 0, 0)
        about = QPushButton("|  About")
        about.clicked.connect(lambda: aboutClicked(self))
        about.setFixedHeight(30)
        about.setFixedWidth(80)
        about.setStyleSheet("color: #303a46 ; border: 0px solid #303a46")
        menuLayout.addWidget(about)

        self.mainLayout = QVBoxLayout()
        self.topLayout = QHBoxLayout()
        self.bottomLayout = QHBoxLayout()

        self.bottomLeftLayout = QHBoxLayout()
        self.bottomRightLayout = QVBoxLayout()

        logo = QLabel(self)
        pixmap = QPixmap('icons/logo.png')
        pixmap = pixmap.scaled(80, 80)
        logo.setPixmap(pixmap)

        refresh = QPushButton("🔁")
        refresh.clicked.connect(self.getContentTrigger)
        refresh.setStyleSheet(
            "color: #95a5a6; background-color: #303a46 ; border: 0px solid #303a46"
        )
        refresh.setFixedHeight(30)
        refresh.setFixedWidth(30)
        b = QHBoxLayout()
        b.addWidget(refresh)

        logotext = QLabel("PyAdminDash")
        logotext.setStyleSheet("color: #303a46;font: bold 25px;")
        logotext.setContentsMargins(15, 0, 0, 0)
        self.topLayout.addWidget(logo)
        self.topLayout.addWidget(logotext)
        self.topLayout.addLayout(menuLayout)
        self.topLayout.addStretch()
        self.topLayout.addLayout(b)

        self.bottomLayout.addLayout(self.bottomLeftLayout)
        self.bottomLayout.addLayout(self.bottomRightLayout, 1)

        self.mainLayout.addLayout(self.topLayout)
        self.mainLayout.addLayout(self.bottomLayout)

        self.setLayout(self.mainLayout)

    def widgets(self):
        self.dockWidget = QDockWidget(self)
        self.listWidget = QListWidget(self)
        self.listWidget.setSelectionMode(QAbstractItemView.SingleSelection)
        self.listWidget.setStyleSheet(
            "color: #303a46; selection-background-color: #303a46 ; selection-color: #95a5a6 ;border: 0px solid #95a5a6"
        )

        self.dockWidget.setFixedWidth(180)

        self.item0 = QtWidgets.QListWidgetItem("   ️💻  Dashboard")
        self.item0.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item0)

        self.item1 = QtWidgets.QListWidgetItem("   ️🌐  System Informations")
        self.item1.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item1)

        self.item2 = QtWidgets.QListWidgetItem("  🚹 ‍ Users ")
        self.item2.setSizeHint(QtCore.QSize(50, 50))

        self.listWidget.addItem(self.item2)
        self.item3 = QtWidgets.QListWidgetItem("  📚  Backup")
        self.item3.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item3)

        self.item4 = QtWidgets.QListWidgetItem("  📶  Networking")
        self.item4.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item4)

        self.item5 = QtWidgets.QListWidgetItem("  🏢  Firewall")
        self.item5.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item5)

        self.item6 = QtWidgets.QListWidgetItem("  ⚙  Services")
        self.item6.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item6)

        self.item7 = QtWidgets.QListWidgetItem("  📚  Logs")
        self.item7.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item7)

        self.item8 = QtWidgets.QListWidgetItem("  ⌨  Terminal")
        self.item8.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item8)

        self.listWidget.itemSelectionChanged.connect(self.getContentTrigger)

        self.dockWidget.setWidget(self.listWidget)
        self.dockWidget.setFloating(False)

        self.bottomLeftLayout.addWidget(self.dockWidget)
        self.listWidget.setCurrentItem(self.item0)

    def getContentTrigger(self):
        si = self.listWidget.selectedItems()[0]
        if si == self.item0:
            self.setCursor(Qt.WaitCursor)
            self.clearLayout(self.bottomRightLayout)
            mainDashboard.getContentDashboard(self)
            self.setCursor(Qt.ArrowCursor)
        elif si == self.item1:
            self.setCursor(Qt.WaitCursor)
            self.clearLayout(self.bottomRightLayout)
            mainsystem.getContentSystem(self)
            self.setCursor(Qt.ArrowCursor)
        elif si == self.item2:
            self.setCursor(Qt.WaitCursor)
            self.clearLayout(self.bottomRightLayout)
            mainusers.getContentUsers(self)
            self.setCursor(Qt.ArrowCursor)
        elif si == self.item3:
            self.setCursor(Qt.WaitCursor)
            self.clearLayout(self.bottomRightLayout)
            mainbackup.getContentBackup(self)
            self.setCursor(Qt.ArrowCursor)
        elif si == self.item4:
            self.setCursor(Qt.WaitCursor)
            self.clearLayout(self.bottomRightLayout)
            mainnetworking.getContentNetwork(self)
            self.setCursor(Qt.ArrowCursor)
        elif si == self.item5:
            self.setCursor(Qt.WaitCursor)
            self.clearLayout(self.bottomRightLayout)
            mainFirewall.getContentFirewall(self)
            self.setCursor(Qt.ArrowCursor)
        elif si == self.item6:
            self.setCursor(Qt.WaitCursor)
            self.clearLayout(self.bottomRightLayout)
            mainServices.getContentServices(self)
            self.setCursor(Qt.ArrowCursor)
        elif si == self.item7:
            self.setCursor(Qt.WaitCursor)
            self.clearLayout(self.bottomRightLayout)
            mainLogs.getContentLogs(self)
            self.setCursor(Qt.ArrowCursor)
        elif si == self.item8:
            self.setCursor(Qt.WaitCursor)
            self.clearLayout(self.bottomRightLayout)
            mainterminal.main(self)
            self.setCursor(Qt.ArrowCursor)

        else:
            QMessageBox.warning(
                self, "warning",
                "no section selected, please selecet a section")

    def clearLayout(self, layout):
        try:
            del self.memoryC
        except Exception:
            pass
        try:
            del self.cpuC
        except Exception:
            pass
        try:
            del self.cpusC
        except Exception:
            pass
        try:
            del self.usg
        except Exception:
            pass
        try:
            del self.read
        except Exception:
            pass
        try:
            del self.write
        except Exception:
            pass
        try:
            del self.all
        except Exception:
            pass
        try:
            del self.all2
        except Exception:
            pass
        try:
            del self.lastbadlogins
        except Exception:
            pass
        try:
            del self.lastlogins
        except Exception:
            pass
        try:
            del self.netSent
        except Exception:
            pass
        try:
            del self.netRec
        except Exception:
            pass
        try:
            del self.sw
        except Exception:
            pass

        try:
            del self.tableIncBackup
        except Exception:
            pass
        try:
            del self.tableFullBackup
        except Exception:
            pass
        try:
            del self.tableFw
        except Exception:
            pass
        try:
            del self.dic
        except Exception:
            pass
        try:
            del self.tableNet
        except Exception:
            pass
        try:
            del self.tableLogs
        except Exception:
            pass
        try:
            del self.dic
        except Exception:
            pass
        try:
            del self.dic2
        except Exception:
            pass
        try:
            del self.dic3
        except Exception:
            pass
        try:
            del self.dic4
        except Exception:
            pass
        try:
            del self.dic5
        except Exception:
            pass
        try:
            del self.dic6
        except Exception:
            pass
        try:
            del self.tableServices
        except Exception:
            pass
        try:
            del self.form
        except Exception:
            pass
        try:
            del self.tableUsers
        except Exception:
            pass
        try:
            del self.listLoggedOn
        except Exception:
            pass

        while layout.count():
            child = layout.takeAt(0)
            if child.widget() is not None:
                child.widget().deleteLater()
            elif child.layout() is not None:
                self.clearLayout(child.layout())
Пример #8
0
class mainWindow(QWidget):
    def __init__(self):
        super().__init__()
        #self.setGeometry(0, 0, 1500, 500)
        self.setWindowTitle("GUI admin tool")
        self.setWindowIcon(QIcon('icons/admin.png'))
        self.UI()
        self.showFullScreen()

    def UI(self):
        self.layouts()
        self.widgets()

    def layouts(self):
        self.mainLayout = QVBoxLayout()
        self.topLayout = QHBoxLayout()
        self.bottomLayout = QHBoxLayout()

        self.bottomLeftLayout = QHBoxLayout()
        self.bottomRightLayout = QVBoxLayout()
        logo = QLabel(self)
        pixmap = QPixmap('icons/admin.png')
        pixmap = pixmap.scaled(50, 50)
        logo.setPixmap(pixmap)

        self.topLayout.addWidget(logo)

        self.bottomLayout.addLayout(self.bottomLeftLayout)
        self.bottomLayout.addLayout(self.bottomRightLayout)
        self.bottomLayout.addStretch()

        self.mainLayout.addLayout(self.topLayout)
        self.mainLayout.addLayout(self.bottomLayout)

        self.setLayout(self.mainLayout)

    def widgets(self):
        self.dockWidget = QDockWidget(self)
        self.listWidget = QListWidget(self)
        self.listWidget.setSelectionMode(QAbstractItemView.SingleSelection)
        self.listWidget.setStyleSheet(
            "color: #2c3e50; selection-background-color: #2c3e50 ; selection-color: #95a5a6 ;border: 0px solid #95a5a6"
        )

        self.dockWidget.setFixedWidth(180)

        self.item1 = QtWidgets.QListWidgetItem("System Information")
        self.item1.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item1)
        self.item2 = QtWidgets.QListWidgetItem("Users Statistics")
        self.item2.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item2)
        self.item3 = QtWidgets.QListWidgetItem("Backup")
        self.item3.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item3)
        self.item4 = QtWidgets.QListWidgetItem("Terminal")
        self.item4.setSizeHint(QtCore.QSize(50, 50))
        self.listWidget.addItem(self.item4)
        self.listWidget.itemSelectionChanged.connect(self.getContentTrigger)

        self.dockWidget.setWidget(self.listWidget)
        self.dockWidget.setFloating(False)

        self.bottomLeftLayout.addWidget(self.dockWidget)
        self.listWidget.setCurrentItem(self.item3)

    def getContentTrigger(self):
        si = self.listWidget.selectedItems()[0]
        if si == self.item1:
            self.clearLayout(self.bottomRightLayout)
            mainsystem.getContentSystem(self)
        elif si == self.item2:
            self.clearLayout(self.bottomRightLayout)
            mainusers.getContentUsers(self)
        elif si == self.item3:
            self.clearLayout(self.bottomRightLayout)
            mainbackup.getContentBackup(self)
        elif si == self.item4:
            self.clearLayout(self.bottomRightLayout)
            mainterminal.main(self)

        else:
            QMessageBox.warning(
                self, "warning",
                "no section selected, please selecet a section")

    def clearLayout(self, layout):
        try:
            del self.memoryC
        except Exception:
            pass
        try:
            del self.cpuC
        except Exception:
            pass
        try:
            del self.cpusC
        except Exception:
            pass
        try:
            del self.usg
        except Exception:
            pass
        try:
            del self.ioC
        except Exception:
            pass
        try:
            del self.iooC
        except Exception:
            pass
        try:
            del self.lastbadlogins
        except Exception:
            pass
        try:
            del self.lastlogins
        except Exception:
            pass

        while layout.count():
            child = layout.takeAt(0)
            if child.widget() is not None:
                child.widget().deleteLater()
            elif child.layout() is not None:
                self.clearLayout(child.layout())