def _fill_environment_box(self): # Main Layout main_lo = QVBoxLayout() self.environment_gb.setLayout(main_lo) # Combobox lo, self.env_select_cb, lab = GBuilder().label_combobox(self, "Current Environment:", [], self._env_select_changed) hl = QHBoxLayout() hl.addLayout(lo) but = GBuilder().pushbutton(self, "New", self._new_env_hit) but.setFixedWidth(40) hl.addWidget(but) lab.setFixedWidth(140) self.env_select_cb.setFixedHeight(22) self.env_select_cb.setFixedWidth(350) main_lo.addLayout(hl) # Groupbox (to make it look nicer) self.content_gb = EnvironmentView(self.environment_gb) main_lo.addWidget(self.content_gb) self.content_gb.setFixedHeight(550) self.content_gb.setFixedWidth(1000) self.content_gb.setLayout(lo) # QStackedWidget with environments self.stacked_env = QStackedWidget() lo.addWidget(self.stacked_env)
def _connect(self): ''' connect two items''' # open Connect window, self._cur_selected_connection = None self.dia = QDialog(self.gui); main_lo = QVBoxLayout() GBuilder().set_props(self.dia, None, 250, 130, max_sz_x=400, max_sz_y=250) try: self.selected_env_elems = EnvironmentElement.icons_to_env_els(DragSelection().selected, self.env_map[self.selected_env]) self.clicked_elem = EnvironmentElement.icons_to_env_els([DragSelection().clicked], self.env_map[self.selected_env])[0] self.selected_env_elems.remove(self.clicked_elem) except: return # show possible connections if not self.selected_env_elems: return acts = self.clicked_elem.processor.get_actions() main_lo.addWidget(GBuilder().label(self.dia, "Select a connection to be executed between type %s and type %s" % (self.clicked_elem.comp_type, self.selected_env_elems[0].comp_type))) hl, self._con_cb, te = GBuilder().label_combobox(self.dia, "Select Connection ", list(acts.values()), self.dia.show) main_lo.addLayout(hl) # ok cancel main_lo.addWidget(GBuilder().hor_line(self.dia)) ok = GBuilder().pushbutton(self.dia, "Apply", self._ok_dia_hit); ok.setFixedWidth(100) canc = GBuilder().pushbutton(self.dia, "Cancel", self._cancel_dia_hit); canc.setFixedWidth(100) hl = QHBoxLayout() hl.addWidget(GBuilder().label(self.dia, "")) hl.addWidget(ok) hl.addWidget(canc) main_lo.addLayout(hl) self.dia.setLayout(main_lo)