From 6e3a0f4461a15c84c5c341f45dde89752a690fdc Mon Sep 17 00:00:00 2001
From: inso <insomniak.fr@gmaiL.com>
Date: Wed, 3 Aug 2016 08:22:07 +0200
Subject: [PATCH] Remove old widgets from homescreen
---
src/sakia/gui/homescreen/homescreen.py | 56 --------
src/sakia/gui/homescreen/homescreen.ui | 173 +------------------------
src/sakia/gui/homescreen/model.py | 4 +
3 files changed, 6 insertions(+), 227 deletions(-)
delete mode 100644 src/sakia/gui/homescreen/homescreen.py
diff --git a/src/sakia/gui/homescreen/homescreen.py b/src/sakia/gui/homescreen/homescreen.py
deleted file mode 100644
index 081f3133..00000000
--- a/src/sakia/gui/homescreen/homescreen.py
+++ /dev/null
@@ -1,56 +0,0 @@
-"""
-Created on 31 janv. 2015
-
-@author: vit
-"""
-
-
-class HomeScreenWidget(QWidget, Ui_HomescreenWidget):
- """
- classdocs
- """
-
- def __init__(self, parent, app, status_label):
- """
- Constructor
- """
- super().__init__()
- self.setupUi(self)
- self.app = app
- self.frame_communities = FrameCommunities(self)
- self.layout().addWidget(self.frame_communities)
- self.status_label = status_label
-
- def refresh(self):
- self.frame_communities.refresh(self.app)
- if self.app.current_account:
- self.frame_connected.show()
- self.label_connected.setText(self.tr("Connected as {0}".format(self.app.current_account.name)))
- self.frame_disconnected.hide()
- else:
- self.frame_disconnected.show()
- self.frame_connected.hide()
-
- def referential_changed(self):
- self.frame_communities.refresh_content()
-
- def showEvent(self, QShowEvent):
- """
-
- :param QShowEvent:
- :return:
- """
- self.frame_communities.refresh_content()
- self.status_label.setText("")
-
- def changeEvent(self, event):
- """
- Intercepte LanguageChange event to translate UI
- :param QEvent QEvent: Event
- :return:
- """
- if event.type() == QEvent.LanguageChange:
- self.retranslateUi(self)
- return super(HomeScreenWidget, self).changeEvent(event)
-
-
diff --git a/src/sakia/gui/homescreen/homescreen.ui b/src/sakia/gui/homescreen/homescreen.ui
index f326a247..97f5d8bf 100644
--- a/src/sakia/gui/homescreen/homescreen.ui
+++ b/src/sakia/gui/homescreen/homescreen.ui
@@ -19,179 +19,10 @@
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QFrame" name="frame_connected">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="sizeConstraint">
- <enum>QLayout::SetMaximumSize</enum>
- </property>
- <item>
- <widget class="QLabel" name="label_connected">
- <property name="styleSheet">
- <string notr="true"> font-size:12pt; font-weight:600;</string>
- </property>
- <property name="text">
- <string>Connected as</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="button_add_community">
- <property name="text">
- <string>Add a community</string>
- </property>
- <property name="icon">
- <iconset resource="../icons/icons.qrc">
- <normaloff>:/icons/add_community</normaloff>:/icons/add_community</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>32</width>
- <height>32</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="button_disconnect">
- <property name="text">
- <string>Disconnect</string>
- </property>
- <property name="icon">
- <iconset resource="../icons/icons.qrc">
- <normaloff>:/icons/logout</normaloff>:/icons/logout</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>32</width>
- <height>32</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QFrame" name="frame_disconnected">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="label_disconnected">
- <property name="text">
- <string><html><head/><body><p><span style=" font-size:12pt; font-weight:600;">Not Connected</span></p></body></html></string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="toolbutton_connect">
- <property name="text">
- <string>Connect</string>
- </property>
- <property name="icon">
- <iconset resource="../icons/icons.qrc">
- <normaloff>:/icons/connect_icon</normaloff>:/icons/connect_icon</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>32</width>
- <height>32</height>
- </size>
- </property>
- <property name="popupMode">
- <enum>QToolButton::MenuButtonPopup</enum>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="toolbutton_new_account">
- <property name="text">
- <string>New account</string>
- </property>
- <property name="icon">
- <iconset resource="../icons/icons.qrc">
- <normaloff>:/icons/add_account_icon</normaloff>:/icons/add_account_icon</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>32</width>
- <height>32</height>
- </size>
- </property>
- <property name="popupMode">
- <enum>QToolButton::MenuButtonPopup</enum>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>false</bool>
- </property>
- <property name="arrowType">
- <enum>Qt::NoArrow</enum>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
+ <layout class="QVBoxLayout" name="verticalLayout"/>
</widget>
<resources>
- <include location="../icons/icons.qrc"/>
+ <include location="../../../../res/icons/icons.qrc"/>
</resources>
<connections/>
</ui>
diff --git a/src/sakia/gui/homescreen/model.py b/src/sakia/gui/homescreen/model.py
index af5b2f6c..c306fb2b 100644
--- a/src/sakia/gui/homescreen/model.py
+++ b/src/sakia/gui/homescreen/model.py
@@ -9,3 +9,7 @@ class HomeScreenModel(ComponentModel):
def __init__(self, parent, app):
super().__init__(parent)
self.app = app
+
+ @property
+ def account(self):
+ return self.app.current_account
\ No newline at end of file
--
GitLab