Skip to content

Commit

Permalink
Refactoring and renaming of the keywords between recipe and package
Browse files Browse the repository at this point in the history
To avoid the confusion between package and recipe, all the class,
methods and files that are related to this issue are refactored.
In addition the controller python package has subgroups now.
The name of the tab in the main window ui is changed to cache instead of
package.
  • Loading branch information
afri-bit committed Nov 24, 2021
1 parent 626326b commit b2ddabd
Showing 22 changed files with 4,825 additions and 4,825 deletions.
2 changes: 1 addition & 1 deletion conanguide/api/conan_api.py
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ class ConanApi(Conan):
def __init__(self):
super().__init__()

def get_all_recipes(self) -> list:
def get_recipe_list(self) -> list:
"""
Get the all the recipes from the conan local cache
:return list<RecipeInfo>: List of recipe info object, contains name, version, user and channel information
File renamed without changes.
Empty file.
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
from conanguide.api.conan_api import ConanApi


class ConanPackageBinaryController:
class ConanPackageController:
def __init__(self, view: QtWidgets.QListView, conan_api: ConanApi):
self.view = view
self.conan_api = conan_api
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
from conanguide.api.conan_api import ConanApi


class ConanPackageController:
class ConanRecipeController:
"""
Controller class to control view and model of the conan package
"""
@@ -44,17 +44,17 @@ def update(self):
self.model.setHeaderData(0, QtCore.Qt.Horizontal, "Count")
self.model.setHeaderData(1, QtCore.Qt.Horizontal, "Name")

package_list = self.conan_api.get_all_recipes()
recipe_list = self.conan_api.get_recipe_list()

for pkg in package_list:
item_package = QStandardItem(pkg.get_info())
item_package.setEditable(False)
for recipe in recipe_list:
item_recipe = QStandardItem(recipe.get_info())
item_recipe.setEditable(False)

package_list = self.conan_api.get_package_list(pkg.get_info())
package_list = self.conan_api.get_package_list(recipe.get_info())
package_count = QStandardItem(str(len(package_list)))
package_count.setEditable(False)

self.model.appendRow([package_count, item_package])
self.model.appendRow([package_count, item_recipe])

self.view.header().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
self.view.header().setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

from conanguide.api.conan_api import ConanApi

class ConanPackageInspectController:
class ConanRecipeInspectController:
"""
Controller class to control view and model of the conan recipe inspection
"""
Empty file.
File renamed without changes.
Empty file.
File renamed without changes.
12 changes: 6 additions & 6 deletions conanguide/ui/main/main_window.py
Original file line number Diff line number Diff line change
@@ -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.conan_remote import ConanRemoteListController
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.package.tab_package import TabPackage
from conanguide.ui.widget.tab.cache.tab_cache import TabCache


class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
@@ -26,8 +26,8 @@ def __init__(self, *args, obj=None, **kwargs):

def __init(self):
# Initialize the package tab
self.tab_package = TabPackage(self.conan_api)
self.layoutTabPackage.addWidget(self.tab_package)
self.tab_cache = TabCache(self.conan_api)
self.layoutTabCache.addWidget(self.tab_cache)

# Initialize the profile tab
self.tab_profile = TabProfile(self.conan_api)
@@ -90,8 +90,8 @@ def on_command_progress(self, data: str):
self.log_to_console(data)

@Slot()
def on_actionViewPackage_triggered(self):
self.tabWidgetMain.setCurrentWidget(self.tabPackage)
def on_actionViewCache_triggered(self):
self.tabWidgetMain.setCurrentWidget(self.tabCache)

@Slot()
def on_actionViewWorkspace_triggered(self):
34 changes: 17 additions & 17 deletions conanguide/ui/main/main_window_ui.py
Original file line number Diff line number Diff line change
@@ -73,12 +73,12 @@ def setupUi(self, MainWindow):
icon9 = QIcon()
icon9.addFile(u":/icon/light/conan_package_export.png", QSize(), QIcon.Normal, QIcon.Off)
self.actionConanExportPackage.setIcon(icon9)
self.actionViewPackage = QAction(MainWindow)
self.actionViewPackage.setObjectName(u"actionViewPackage")
self.actionViewPackage.setChecked(False)
self.actionViewCache = QAction(MainWindow)
self.actionViewCache.setObjectName(u"actionViewCache")
self.actionViewCache.setChecked(False)
icon10 = QIcon()
icon10.addFile(u":/icon/light/package.png", QSize(), QIcon.Normal, QIcon.Off)
self.actionViewPackage.setIcon(icon10)
self.actionViewCache.setIcon(icon10)
self.actionHelpConanio = QAction(MainWindow)
self.actionHelpConanio.setObjectName(u"actionHelpConanio")
icon11 = QIcon()
@@ -111,15 +111,15 @@ def setupUi(self, MainWindow):
self.tabWidgetMain.setObjectName(u"tabWidgetMain")
self.tabWidgetMain.setTabPosition(QTabWidget.West)
self.tabWidgetMain.setTabShape(QTabWidget.Rounded)
self.tabPackage = QWidget()
self.tabPackage.setObjectName(u"tabPackage")
self.layoutTabPackage = QHBoxLayout(self.tabPackage)
self.layoutTabPackage.setSpacing(0)
self.layoutTabPackage.setObjectName(u"layoutTabPackage")
self.layoutTabPackage.setContentsMargins(0, 0, 0, 0)
self.tabCache = QWidget()
self.tabCache.setObjectName(u"tabCache")
self.layoutTabCache = QHBoxLayout(self.tabCache)
self.layoutTabCache.setSpacing(0)
self.layoutTabCache.setObjectName(u"layoutTabCache")
self.layoutTabCache.setContentsMargins(0, 0, 0, 0)
icon15 = QIcon()
icon15.addFile(u":/icon/light/tab_package.png", QSize(), QIcon.Normal, QIcon.Off)
self.tabWidgetMain.addTab(self.tabPackage, icon15, "")
icon15.addFile(u":/icon/light/tab_cache.png", QSize(), QIcon.Normal, QIcon.Off)
self.tabWidgetMain.addTab(self.tabCache, icon15, "")
self.tabWorkspace = QWidget()
self.tabWorkspace.setObjectName(u"tabWorkspace")
self.verticalLayout_6 = QVBoxLayout(self.tabWorkspace)
@@ -542,7 +542,7 @@ def setupUi(self, MainWindow):
self.menubar.addAction(self.menuView.menuAction())
self.menubar.addAction(self.menuConan.menuAction())
self.menubar.addAction(self.menuHelp.menuAction())
self.menuView.addAction(self.actionViewPackage)
self.menuView.addAction(self.actionViewCache)
self.menuView.addAction(self.actionViewWorkspace)
self.menuView.addAction(self.actionViewProfile)
self.menuView.addAction(self.actionViewRemote)
@@ -624,12 +624,12 @@ def retranslateUi(self, MainWindow):
#if QT_CONFIG(shortcut)
self.actionConanExportPackage.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+Shift+E", None))
#endif // QT_CONFIG(shortcut)
self.actionViewPackage.setText(QCoreApplication.translate("MainWindow", u"Package", None))
self.actionViewCache.setText(QCoreApplication.translate("MainWindow", u"Cache", None))
#if QT_CONFIG(tooltip)
self.actionViewPackage.setToolTip(QCoreApplication.translate("MainWindow", u"Package", None))
self.actionViewCache.setToolTip(QCoreApplication.translate("MainWindow", u"Cache", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(shortcut)
self.actionViewPackage.setShortcut(QCoreApplication.translate("MainWindow", u"Alt+1", None))
self.actionViewCache.setShortcut(QCoreApplication.translate("MainWindow", u"Alt+1", None))
#endif // QT_CONFIG(shortcut)
self.actionHelpConanio.setText(QCoreApplication.translate("MainWindow", u"conan.io", None))
#if QT_CONFIG(shortcut)
@@ -651,7 +651,7 @@ def retranslateUi(self, MainWindow):
#if QT_CONFIG(shortcut)
self.actionViewSettings.setShortcut(QCoreApplication.translate("MainWindow", u"Alt+S", None))
#endif // QT_CONFIG(shortcut)
self.tabWidgetMain.setTabText(self.tabWidgetMain.indexOf(self.tabPackage), QCoreApplication.translate("MainWindow", u"Package", None))
self.tabWidgetMain.setTabText(self.tabWidgetMain.indexOf(self.tabCache), QCoreApplication.translate("MainWindow", u"Cache", None))
self.label_4.setText(QCoreApplication.translate("MainWindow", u"User", None))
self.label_14.setText(QCoreApplication.translate("MainWindow", u"/", None))
self.label_13.setText(QCoreApplication.translate("MainWindow", u"Channel", None))
Loading

0 comments on commit b2ddabd

Please sign in to comment.