Skip to content

Commit

Permalink
Migrated the conan remote tab to a separated widget
Browse files Browse the repository at this point in the history
  • Loading branch information
afri-bit committed Nov 28, 2021
1 parent 9a1a5a8 commit 5f56307
Show file tree
Hide file tree
Showing 9 changed files with 338 additions and 152 deletions.
8 changes: 4 additions & 4 deletions conanguide/ui/main/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from conanguide.api.conan_api import ConanApi
from conanguide.client.runner.command_runner import CommandRunner
from conanguide.ui.config.ui_config import UIConfiguration
from conanguide.ui.controller.tab.remote.conan_remote import ConanRemoteListController
from conanguide.ui.main.main_window_ui import Ui_MainWindow
from conanguide.utils.cmd.command_builder import ConanCommandBuilder
from conanguide.ui.widget.tab.profile.tab_profile import TabProfile
from conanguide.ui.widget.tab.cache.tab_cache import TabCache
from conanguide.ui.widget.tab.remote.tab_remote import TabRemote


class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
Expand All @@ -33,9 +33,9 @@ def __init(self):
self.tab_profile = TabProfile(self.conan_api)
self.layoutTabProfile.addWidget(self.tab_profile)

# Tableview initialization for the remote list
self.ctrl_tableview_conan_remote = ConanRemoteListController(self.tableViewRemoteList, self.conan_api)
self.ctrl_tableview_conan_remote.update()
# Initialize the remote tab
self.tab_remote = TabRemote(self.conan_api)
self.layoutTabRemote.addWidget(self.tab_remote)

# Fill combobox with profile name
self.comboBoxProfile.addItems(self.conan_api.profile_list())
Expand Down
62 changes: 9 additions & 53 deletions conanguide/ui/main/main_window_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,60 +452,18 @@ def setupUi(self, MainWindow):
self.tabWidgetMain.addTab(self.tabProfile, icon19, "")
self.tabRemote = QWidget()
self.tabRemote.setObjectName(u"tabRemote")
self.verticalLayout_4 = QVBoxLayout(self.tabRemote)
self.verticalLayout_4.setSpacing(2)
self.verticalLayout_4.setObjectName(u"verticalLayout_4")
self.verticalLayout_4.setContentsMargins(2, 2, 2, 2)
self.frame_7 = QFrame(self.tabRemote)
self.frame_7.setObjectName(u"frame_7")
self.frame_7.setFrameShape(QFrame.StyledPanel)
self.frame_7.setFrameShadow(QFrame.Raised)
self.horizontalLayout_16 = QHBoxLayout(self.frame_7)
self.horizontalLayout_16.setSpacing(0)
self.horizontalLayout_16.setObjectName(u"horizontalLayout_16")
self.horizontalLayout_16.setContentsMargins(0, 0, 0, 0)
self.toolButton = QToolButton(self.frame_7)
self.toolButton.setObjectName(u"toolButton")
self.toolButton.setMinimumSize(QSize(25, 25))
self.toolButton.setMaximumSize(QSize(20, 16777215))
self.layoutTabRemote = QVBoxLayout(self.tabRemote)
self.layoutTabRemote.setSpacing(2)
self.layoutTabRemote.setObjectName(u"layoutTabRemote")
self.layoutTabRemote.setContentsMargins(2, 2, 2, 2)
icon20 = QIcon()
icon20.addFile(u":/icon/light/add.png", QSize(), QIcon.Normal, QIcon.Off)
self.toolButton.setIcon(icon20)

self.horizontalLayout_16.addWidget(self.toolButton)

self.toolButton_2 = QToolButton(self.frame_7)
self.toolButton_2.setObjectName(u"toolButton_2")
sizePolicy.setHeightForWidth(self.toolButton_2.sizePolicy().hasHeightForWidth())
self.toolButton_2.setSizePolicy(sizePolicy)
self.toolButton_2.setMinimumSize(QSize(25, 25))
icon21 = QIcon()
icon21.addFile(u":/icon/light/remove.png", QSize(), QIcon.Normal, QIcon.Off)
self.toolButton_2.setIcon(icon21)

self.horizontalLayout_16.addWidget(self.toolButton_2)

self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)

self.horizontalLayout_16.addItem(self.horizontalSpacer_2)


self.verticalLayout_4.addWidget(self.frame_7)

self.tableViewRemoteList = QTableView(self.tabRemote)
self.tableViewRemoteList.setObjectName(u"tableViewRemoteList")
self.tableViewRemoteList.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)

self.verticalLayout_4.addWidget(self.tableViewRemoteList)

icon22 = QIcon()
icon22.addFile(u":/icon/light/tab_conan_remote.png", QSize(), QIcon.Normal, QIcon.Off)
self.tabWidgetMain.addTab(self.tabRemote, icon22, "")
icon20.addFile(u":/icon/light/tab_conan_remote.png", QSize(), QIcon.Normal, QIcon.Off)
self.tabWidgetMain.addTab(self.tabRemote, icon20, "")
self.tabSettings = QWidget()
self.tabSettings.setObjectName(u"tabSettings")
icon23 = QIcon()
icon23.addFile(u":/icon/light/tab_settings.png", QSize(), QIcon.Normal, QIcon.Off)
self.tabWidgetMain.addTab(self.tabSettings, icon23, "")
icon21 = QIcon()
icon21.addFile(u":/icon/light/tab_settings.png", QSize(), QIcon.Normal, QIcon.Off)
self.tabWidgetMain.addTab(self.tabSettings, icon21, "")

self.verticalLayout_12.addWidget(self.tabWidgetMain)

Expand Down Expand Up @@ -673,8 +631,6 @@ def retranslateUi(self, MainWindow):
self.console.setPlainText("")
self.tabWidgetMain.setTabText(self.tabWidgetMain.indexOf(self.tabWorkspace), QCoreApplication.translate("MainWindow", u"Workspace", None))
self.tabWidgetMain.setTabText(self.tabWidgetMain.indexOf(self.tabProfile), QCoreApplication.translate("MainWindow", u"Profile", None))
self.toolButton.setText("")
self.toolButton_2.setText("")
self.tabWidgetMain.setTabText(self.tabWidgetMain.indexOf(self.tabRemote), QCoreApplication.translate("MainWindow", u"Remote", None))
self.tabWidgetMain.setTabText(self.tabWidgetMain.indexOf(self.tabSettings), QCoreApplication.translate("MainWindow", u"Settings", None))
self.menuView.setTitle(QCoreApplication.translate("MainWindow", u"View", None))
Expand Down
2 changes: 1 addition & 1 deletion conanguide/ui/res/resources_rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20777,7 +20777,7 @@
\x00\x00\x02B\x00\x00\x00\x00\x00\x01\x00\x01\xe6\x87\
\x00\x00\x01}M\xa1\x19\x0e\
\x00\x00\x00\xbc\x00\x00\x00\x00\x00\x01\x00\x00\x95\xa4\
\x00\x00\x01}f\x8e\xe3\x00\
\x00\x00\x01}gol\xf8\
\x00\x00\x02\xd0\x00\x00\x00\x00\x00\x01\x00\x02\x8a\xbc\
\x00\x00\x01}M\xa1\x19\x04\
"
Expand Down
Empty file.
27 changes: 27 additions & 0 deletions conanguide/ui/widget/tab/remote/tab_remote.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
import pyperclip

from PySide2 import QtWidgets
from PySide2.QtCore import Slot

from conanguide.api.conan_api import ConanApi
from conanguide.ui.widget.tab.remote.tab_remote_ui import Ui_TabRemote

from conanguide.ui.controller.tab.remote.conan_remote import ConanRemoteListController


class TabRemote(QtWidgets.QWidget, Ui_TabRemote):
def __init__(self, conan_api: ConanApi, *args, obj=None, **kwargs):
super(TabRemote, self).__init__(*args, **kwargs)

self.setupUi(self)

self.conan_api = conan_api

# Tableview initialization for the remote list
self.ctrl_tableview_conan_remote = ConanRemoteListController(self.tableViewRemoteList, self.conan_api)
self.ctrl_tableview_conan_remote.update()

def refresh(self):
# TODO: Implement refresh function.
pass
162 changes: 162 additions & 0 deletions conanguide/ui/widget/tab/remote/tab_remote_ui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# -*- coding: utf-8 -*-

################################################################################
## Form generated from reading UI file 'tab_remote.ui'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################

from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *

from conanguide.ui.res import resources_rc

class Ui_TabRemote(object):
def setupUi(self, TabRemote):
if not TabRemote.objectName():
TabRemote.setObjectName(u"TabRemote")
TabRemote.resize(772, 652)
self.verticalLayout = QVBoxLayout(TabRemote)
self.verticalLayout.setSpacing(5)
self.verticalLayout.setObjectName(u"verticalLayout")
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.frame_7 = QFrame(TabRemote)
self.frame_7.setObjectName(u"frame_7")
self.frame_7.setFrameShape(QFrame.StyledPanel)
self.frame_7.setFrameShadow(QFrame.Raised)
self.horizontalLayout_16 = QHBoxLayout(self.frame_7)
self.horizontalLayout_16.setSpacing(0)
self.horizontalLayout_16.setObjectName(u"horizontalLayout_16")
self.horizontalLayout_16.setContentsMargins(0, 0, 0, 0)
self.toolButton = QToolButton(self.frame_7)
self.toolButton.setObjectName(u"toolButton")
self.toolButton.setMinimumSize(QSize(25, 25))
self.toolButton.setMaximumSize(QSize(20, 16777215))
icon = QIcon()
icon.addFile(u":/icon/light/add.png", QSize(), QIcon.Normal, QIcon.Off)
self.toolButton.setIcon(icon)

self.horizontalLayout_16.addWidget(self.toolButton)

self.toolButton_2 = QToolButton(self.frame_7)
self.toolButton_2.setObjectName(u"toolButton_2")
sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.toolButton_2.sizePolicy().hasHeightForWidth())
self.toolButton_2.setSizePolicy(sizePolicy)
self.toolButton_2.setMinimumSize(QSize(25, 25))
icon1 = QIcon()
icon1.addFile(u":/icon/light/remove.png", QSize(), QIcon.Normal, QIcon.Off)
self.toolButton_2.setIcon(icon1)

self.horizontalLayout_16.addWidget(self.toolButton_2)

self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)

self.horizontalLayout_16.addItem(self.horizontalSpacer_2)


self.verticalLayout.addWidget(self.frame_7)

self.tableViewRemoteList = QTableView(TabRemote)
self.tableViewRemoteList.setObjectName(u"tableViewRemoteList")
self.tableViewRemoteList.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)

self.verticalLayout.addWidget(self.tableViewRemoteList)


self.retranslateUi(TabRemote)

QMetaObject.connectSlotsByName(TabRemote)
# setupUi

def retranslateUi(self, TabRemote):
TabRemote.setWindowTitle(QCoreApplication.translate("TabRemote", u"Form", None))
self.toolButton.setText("")
self.toolButton_2.setText("")
# re# -*- coding: utf-8 -*-

################################################################################
## Form generated from reading UI file 'tab_remote.ui'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################

from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *

from conanguide.ui.res import resources_rc

class Ui_TabRemote(object):
def setupUi(self, TabRemote):
if not TabRemote.objectName():
TabRemote.setObjectName(u"TabRemote")
TabRemote.resize(772, 652)
self.verticalLayout = QVBoxLayout(TabRemote)
self.verticalLayout.setSpacing(5)
self.verticalLayout.setObjectName(u"verticalLayout")
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.frame_7 = QFrame(TabRemote)
self.frame_7.setObjectName(u"frame_7")
self.frame_7.setFrameShape(QFrame.StyledPanel)
self.frame_7.setFrameShadow(QFrame.Raised)
self.horizontalLayout_16 = QHBoxLayout(self.frame_7)
self.horizontalLayout_16.setSpacing(0)
self.horizontalLayout_16.setObjectName(u"horizontalLayout_16")
self.horizontalLayout_16.setContentsMargins(0, 0, 0, 0)
self.toolButton = QToolButton(self.frame_7)
self.toolButton.setObjectName(u"toolButton")
self.toolButton.setMinimumSize(QSize(25, 25))
self.toolButton.setMaximumSize(QSize(20, 16777215))
icon = QIcon()
icon.addFile(u":/icon/light/add.png", QSize(), QIcon.Normal, QIcon.Off)
self.toolButton.setIcon(icon)

self.horizontalLayout_16.addWidget(self.toolButton)

self.toolButton_2 = QToolButton(self.frame_7)
self.toolButton_2.setObjectName(u"toolButton_2")
sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.toolButton_2.sizePolicy().hasHeightForWidth())
self.toolButton_2.setSizePolicy(sizePolicy)
self.toolButton_2.setMinimumSize(QSize(25, 25))
icon1 = QIcon()
icon1.addFile(u":/icon/light/remove.png", QSize(), QIcon.Normal, QIcon.Off)
self.toolButton_2.setIcon(icon1)

self.horizontalLayout_16.addWidget(self.toolButton_2)

self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)

self.horizontalLayout_16.addItem(self.horizontalSpacer_2)


self.verticalLayout.addWidget(self.frame_7)

self.tableViewRemoteList = QTableView(TabRemote)
self.tableViewRemoteList.setObjectName(u"tableViewRemoteList")
self.tableViewRemoteList.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)

self.verticalLayout.addWidget(self.tableViewRemoteList)


self.retranslateUi(TabRemote)

QMetaObject.connectSlotsByName(TabRemote)
# setupUi

def retranslateUi(self, TabRemote):
TabRemote.setWindowTitle(QCoreApplication.translate("TabRemote", u"Form", None))
self.toolButton.setText("")
self.toolButton_2.setText("")
# retranslateUi

Loading

0 comments on commit 5f56307

Please sign in to comment.