@@ -118,6 +118,40 @@ def indented_df_to_treenode(df, indent=4, indented_col=0, colnames=None, header=
118
118
return root
119
119
120
120
121
+ class FrequencyFilterDialog (QDialog ):
122
+ def __init__ (self , available_labels , parent = None ):
123
+ super ().__init__ (parent )
124
+
125
+ self .setWindowTitle ("Select frequency" )
126
+ layout = QVBoxLayout (self )
127
+ hbox = QHBoxLayout ()
128
+
129
+ self .checkboxes = {}
130
+ label_map = {'M' : 'Month' , 'Q' : 'Quarter' , 'A' : 'Year' , 'W' : 'Week' , 'D' : 'Day' }
131
+
132
+ # generate only relevant checkboxes, i.e. based on available_labels argument
133
+ for label in available_labels :
134
+ checkbox = QCheckBox (label_map [label ], self )
135
+ checkbox .setChecked (True )
136
+ self .checkboxes [label ] = checkbox
137
+ hbox .addWidget (checkbox )
138
+
139
+ layout .addLayout (hbox )
140
+
141
+ ok_button = QPushButton ("Ok" , self )
142
+ ok_button .clicked .connect (self .accept )
143
+
144
+ layout .addWidget (ok_button )
145
+
146
+ # Function to pass back selected frequencies to parent dialog
147
+ def get_selected_frequencies (self ):
148
+ freqs = []
149
+ for label , checkbox in self .checkboxes .items ():
150
+ if checkbox .isChecked ():
151
+ freqs .append (label )
152
+ return freqs
153
+
154
+
121
155
class EurostatBrowserDialog (QDialog ):
122
156
def __init__ (self , index , parent = None ):
123
157
super (EurostatBrowserDialog , self ).__init__ (parent )
0 commit comments