-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
129 lines (112 loc) · 4.54 KB
/
main.py
File metadata and controls
129 lines (112 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
from widgets import *
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle('Data Explorer')
screen = QApplication.primaryScreen().availableGeometry()
self.setGeometry(50, 50, screen.width() - 100, screen.height() - 100)
self.central_widget = QWidget(self)
self.layout = QHBoxLayout(self.central_widget)
self.layout.setContentsMargins(6, 6, 6, 6)
self.layout.setSpacing(6)
self.file_tree = FileTree()
DATA_TABLE['file_tree'] = self.file_tree
self.file_explorer = FileExplorer(file_tree=self.file_tree)
self.data_viewer = DataViewer()
DATA_TABLE['data_viewer'] = self.data_viewer
files_tab = QWidget()
files_layout = QVBoxLayout(files_tab)
files_layout.setContentsMargins(0, 0, 0, 0)
files_layout.setSpacing(0)
files_layout.addWidget(self.file_explorer)
self.side_tabs = QTabWidget()
self.side_tabs.tabBar().setExpanding(False)
self.side_tabs.setStyleSheet(f"""
QTabWidget::pane {{
border: none;
background: #f5f5f5;
border-radius: 8px;
}}
QTabBar {{
background: transparent;
border: none;
padding: 4px 4px 0px 4px;
}}
QTabBar::tab {{
background: transparent;
padding: 8px 18px;
margin: 0px 2px;
font: 13px -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
color: #86868b;
border: none;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
min-width: 50px;
}}
QTabBar::tab:selected {{
background: #f5f5f5;
color: #1d1d1f;
font: bold 13px -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
}}
QTabBar::tab:hover:!selected {{
background: rgba(0, 0, 0, 0.04);
color: #1d1d1f;
}}
QScrollArea {{
border: none;
background: #f9f9f9;
}}
QScrollBar:vertical {{
border: none;
background: transparent;
width: 8px;
margin: 2px 1px;
}}
QScrollBar::handle:vertical {{
background: #dadce0;
min-height: 40px;
border-radius: 4px;
}}
QScrollBar::handle:vertical:hover {{
background: #bdc1c6;
}}
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {{
background: none;
height: 0px;
}}
""")
side_shadow = QGraphicsDropShadowEffect(self)
side_shadow.setBlurRadius(20)
side_shadow.setOffset(0, 4)
side_shadow.setColor(QColor(0, 0, 0, 40))
self.side_tabs.setGraphicsEffect(side_shadow)
self.preferences = PreferencesPanel()
DATA_TABLE['preferences'] = self.preferences._prefs
self.side_tabs.setIconSize(QSize(45, 45))
fe_icons = f'{CURRENT_PATH}/icons/{ICON_SET}'
self.side_tabs.addTab(self.preferences, QIcon(f'{fe_icons}/prefrences.png'), "Preferences")
self.side_tabs.addTab(files_tab, QIcon(f'{fe_icons}/files.png'), "Files")
self.bq_browser = BigQueryBrowser(file_tree=self.file_tree, preferences=self.preferences)
self.side_tabs.addTab(self.bq_browser, QIcon(f'{fe_icons}/bigquery.png'), "BigQuery")
self.side_tabs.setCurrentIndex(1)
self.left_panel = QSplitter(Qt.Vertical)
self.left_panel.addWidget(self.side_tabs)
self.left_panel.addWidget(self.file_tree)
self.left_panel.setChildrenCollapsible(False)
self.left_panel.setSizes([400, 200])
self.left_panel.setMinimumWidth(200)
self.data_viewer.setMinimumWidth(300)
self.splitter = QSplitter(Qt.Horizontal)
self.splitter.setChildrenCollapsible(False)
self.splitter.addWidget(self.left_panel)
self.splitter.addWidget(self.data_viewer)
self.splitter.setStretchFactor(0, 1)
self.splitter.setStretchFactor(1, 3)
self.splitter.setSizes([350, 1000])
self.layout.addWidget(self.splitter)
self.setCentralWidget(self.central_widget)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())