Skip to content

Commit

Permalink
Fix browser - preview, metadata and browsing
Browse files Browse the repository at this point in the history
  • Loading branch information
chStaiger committed Apr 18, 2024
1 parent 1396eea commit 1c72249
Show file tree
Hide file tree
Showing 9 changed files with 225 additions and 267 deletions.
316 changes: 124 additions & 192 deletions gui/IrodsBrowser.py

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions gui/LoginWindow.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Pop up Widget for Login.
"""
import sys
from pathlib import Path

Expand All @@ -6,7 +8,7 @@

from gui.ui_files.irodsLogin import Ui_irodsLogin
from ibridges import Session
from ibridges.session import LoginError
from ibridges.session import LoginError, PasswordError

class IrodsLoginWindow(QDialog, Ui_irodsLogin):
"""Definition and initialization of the iRODS login window.
Expand Down Expand Up @@ -67,8 +69,9 @@ def login_function(self):
self.session_dict['session'] = self.session
self.close()
except LoginError as e:
self.passError.setText(repr(e))
except:
raise()
self.passError.setText("Unknown Error")
self.passError.setText("irods_environment.json not setup correctly.")
except PasswordError as e:
self.passError.setText("Wrong password!")
except ConnectionError as e:
self.passError.setText("Cannot connect to server. Check Internet, host name and port.")

12 changes: 12 additions & 0 deletions gui/gui_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Handy and reusable functions for the GUI"""
import PyQt6


def populate_table(tableWidget, rows, data_by_row):

tableWidget.setRowCount(rows)
for row, data in enumerate(data_by_row):
for col, item in enumerate(data):
tableWidget.setItem(row, col, PyQt6.QtWidgets.QTableWidgetItem(item))
tableWidget.resizeColumnsToContents()

10 changes: 3 additions & 7 deletions gui/irodsInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import PyQt6.QtWidgets
import PyQt6.uic

import gui
import utils
from ibridges.resources import Resources
import gui
from gui.gui_utils import populate_table

class irodsInfo(PyQt6.QtWidgets.QWidget,
gui.ui_files.tabInfo.Ui_tabInfo):
Expand Down Expand Up @@ -50,10 +50,6 @@ def refresh_info(self):
'.'.join((str(num) for num in self.session.server_version)))
# irods resources
resc_info = Resources(self.session).root_resources
self.rescTable.setRowCount(len(resc_info[0]))
for row, (name, status, space, _) in enumerate(resc_info):
self.rescTable.setItem(row, 0, PyQt6.QtWidgets.QTableWidgetItem(name))
self.rescTable.setItem(row, 1, PyQt6.QtWidgets.QTableWidgetItem(str(space)))
self.rescTable.setItem(row, 2, PyQt6.QtWidgets.QTableWidgetItem(str(status or '')))
populate_table(self.rescTable, len(resc_info[0]), resc_info)
self.rescTable.resizeColumnsToContents()
self.setCursor(PyQt6.QtGui.QCursor(PyQt6.QtCore.Qt.CursorShape.ArrowCursor))
40 changes: 22 additions & 18 deletions gui/ui_files/MainMenu.ui
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
color: rgb(86, 184, 139);
background-color: rgb(54, 54, 54);
selection-background-color: rgb(58, 152, 112);
font: 18pt;
}

QLabel#globalErrorLabel
Expand All @@ -51,6 +52,13 @@ QTabBar::tab:top:selected {
<height>300</height>
</size>
</property>
<property name="font">
<font>
<pointsize>18</pointsize>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
Expand All @@ -74,49 +82,45 @@ QTabBar::tab:top:selected {
<x>0</x>
<y>0</y>
<width>1300</width>
<height>37</height>
<height>27</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>18</pointsize>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<widget class="QMenu" name="menuMenu">
<property name="font">
<font>
<pointsize>13</pointsize>
<pointsize>18</pointsize>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="title">
<string>Menu</string>
<string>iRODS Connection</string>
</property>
<addaction name="actionConnect"/>
<addaction name="actionCloseSession"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuOptions">
<property name="font">
<font>
<pointsize>13</pointsize>
</font>
</property>
<property name="title">
<string>Options</string>
</property>
<addaction name="actionSearch"/>
</widget>
<addaction name="menuMenu"/>
<addaction name="menuOptions"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionCloseSession">
<property name="text">
<string>Close Session</string>
<string>Close Connection</string>
</property>
<property name="font">
<font/>
</property>
</action>
<action name="actionExit">
<property name="text">
<string>Exit</string>
<string>Exit iBridges</string>
</property>
<property name="font">
<font/>
Expand All @@ -140,7 +144,7 @@ QTabBar::tab:top:selected {
</action>
<action name="actionConnect">
<property name="text">
<string>Connect</string>
<string>Connect to iRODS</string>
</property>
</action>
</widget>
Expand Down
44 changes: 25 additions & 19 deletions gui/ui_files/irodsLogin.ui
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,26 @@
background-color: rgb(54, 54, 54);
color: rgb(86, 184, 139);
border-color: rgb(217, 174, 23);
font: 16pt;
}

QLineEdit
{
background-color: rgb(85, 87, 83);
border-color: rgb(217, 174, 23);
font: 18pt;
}

QRadioButton
QLabel#passError, QLabel#envError, QLabel#icommandsError
{
border-bottom-color: rgb(206, 92, 0);
selection-color: rgb(217, 174, 23);
color: rgb(217, 174, 23);
font: 18pt;
}

QLabel#passError, QLabel#envError, QLabel#icommandsError
QLabel#labelTitle
{
color: rgb(217, 174, 23);
font: 22pt;

}

QRadioButton
Expand Down Expand Up @@ -83,8 +86,10 @@ QRadioButton
<widget class="QLabel" name="labelTitle">
<property name="font">
<font>
<pointsize>20</pointsize>
<bold>true</bold>
<pointsize>22</pointsize>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
</font>
</property>
<property name="text">
Expand Down Expand Up @@ -144,6 +149,16 @@ QRadioButton
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="passError">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
Expand All @@ -157,16 +172,6 @@ QRadioButton
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="passError">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
Expand All @@ -178,8 +183,9 @@ QRadioButton
<widget class="QPushButton" name="connectButton">
<property name="font">
<font>
<pointsize>13</pointsize>
<bold>true</bold>
<pointsize>16</pointsize>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
Expand Down
17 changes: 6 additions & 11 deletions gui/ui_files/tabBrowser.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1278</width>
<height>813</height>
<height>818</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -25,6 +25,7 @@
QTabWidget
{
background-color: rgb(85, 87, 83);
font: 14pt
}

QTableWidget
Expand Down Expand Up @@ -75,7 +76,6 @@ QPushButton#dataDeleteButton
<property name="font">
<font>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand Down Expand Up @@ -188,7 +188,7 @@ QPushButton#dataDeleteButton
</layout>
</item>
<item>
<widget class="QTableWidget" name="collTable">
<widget class="QTableWidget" name="browserTable">
<property name="minimumSize">
<size>
<width>0</width>
Expand All @@ -213,6 +213,9 @@ QPushButton#dataDeleteButton
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string notr="true">Status</string>
Expand Down Expand Up @@ -278,7 +281,6 @@ QPushButton#dataDeleteButton
<widget class="QWidget" name="preview">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
Expand Down Expand Up @@ -353,7 +355,6 @@ QPushButton#dataDeleteButton
<property name="font">
<font>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand Down Expand Up @@ -396,7 +397,6 @@ QPushButton#dataDeleteButton
<widget class="QPushButton" name="metaAddButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand All @@ -409,7 +409,6 @@ QPushButton#dataDeleteButton
<widget class="QPushButton" name="metaUpdateButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand All @@ -422,7 +421,6 @@ QPushButton#dataDeleteButton
<widget class="QPushButton" name="metaDeleteButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand Down Expand Up @@ -505,7 +503,6 @@ QPushButton#dataDeleteButton
<property name="font">
<font>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand Down Expand Up @@ -621,7 +618,6 @@ QPushButton#dataDeleteButton
<widget class="QPushButton" name="aclAddButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand Down Expand Up @@ -748,7 +744,6 @@ QPushButton#dataDeleteButton
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand Down
Loading

0 comments on commit 1c72249

Please sign in to comment.