Skip to content

Commit

Permalink
overlay left pane widgets on resizable branding barre
Browse files Browse the repository at this point in the history
  • Loading branch information
Allie Crevier committed Mar 23, 2021
1 parent f5f6b94 commit 8ac0edf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
28 changes: 7 additions & 21 deletions securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,37 +170,25 @@ def clear_error_status(self):
self.error_status_bar.clear_message()


class LeftPane(QWidget):
class LeftPane(QLabel):
"""
Represents the left side pane that contains user authentication actions and information.
"""

def __init__(self):
super().__init__()

self.setObjectName("LeftPane")

# Set layout
layout = QVBoxLayout(self)
self.setLayout(layout)

# Remove margins and spacing
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.setAlignment(Qt.AlignBottom)
self.setFixedWidth(198)

# Set background image
self.logo = QWidget()
self.online_palette = QPalette()
# the sd logo on the background image becomes more faded in offline mode
self.online_palette.setBrush(QPalette.Background, QBrush(load_image("left_pane.svg")))
self.offline_palette = QPalette()
self.offline_palette.setBrush(
QPalette.Background, QBrush(load_image("left_pane_offline.svg"))
)
self.logo.setPalette(self.offline_palette)
self.logo.setAutoFillBackground(True)
self.logo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.logo.setEnabled(False)
self.setPixmap(load_image("left_pane.svg"))

# User profile
self.user_profile = UserProfile()
Expand All @@ -210,7 +198,6 @@ def __init__(self):

# Add widgets to layout
layout.addWidget(self.user_profile)
layout.addWidget(self.logo)

def setup(self, window, controller):
self.user_profile.setup(window, controller)
Expand All @@ -221,14 +208,14 @@ def set_logged_in_as(self, db_user: User):
"""
self.user_profile.set_user(db_user)
self.user_profile.show()
self.logo.setPalette(self.online_palette)
self.setPixmap(load_image("left_pane.svg"))

def set_logged_out(self):
"""
Update the UI to a logged out state.
"""
self.user_profile.hide()
self.logo.setPalette(self.offline_palette)
self.setPixmap(load_image("left_pane_offline.svg"))


class SyncIcon(QLabel):
Expand Down Expand Up @@ -401,9 +388,8 @@ def __init__(self):

# Set background
palette = QPalette()
palette.setBrush(QPalette.Background, QBrush(QColor("#0096DC")))
palette.setBrush(QPalette.Background, QBrush(Qt.NoBrush)) # This makes the widget transparent
self.setPalette(palette)
self.setAutoFillBackground(True)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)

# Set layout
Expand Down
8 changes: 7 additions & 1 deletion securedrop_client/resources/css/sdclient.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,15 @@
color: #0c3e75;
}

#LeftPane {
min-width: 198;
max-width: 198;
background-color: #0096dc;
}

#UserProfile {
padding: 15px;
min-height: 200px
min-height: 60px
}

#UserProfile_icon {
Expand Down

0 comments on commit 8ac0edf

Please sign in to comment.