def __init__(self): QWidget.__init__(self) self.setMinimumSize(800, 600) self.donuts = [] self.chart_view = QtCharts.QChartView() self.chart_view.setRenderHint(QPainter.Antialiasing) self.chart = self.chart_view.chart() self.chart.legend().setVisible(False) self.chart.setTitle("Nested donuts demo") self.chart.setAnimationOptions(QtCharts.QChart.AllAnimations) self.min_size = 0.1 self.max_size = 0.9 self.donut_count = 5 self.setup_donuts() # create main layout self.main_layout = QGridLayout(self) self.main_layout.addWidget(self.chart_view, 1, 1) self.setLayout(self.main_layout) self.update_timer = QTimer(self) self.update_timer.timeout.connect(self.update_rotation) self.update_timer.start(1250)
def __init__(self, argv, parentQWidget = None): QWidget.__init__(self) const.mode_interactive = 1 const.mode_file = 2 const.mode_batch = 3 const.mode_default = const.mode_batch arg_file = '' if '-i' in argv: mode = const.mode_interactive elif '-b' in argv: mode = const.mode_batch elif '-f' in argv: mode = const.mode_file idx = argv.index('-f') arg_file = argv[idx+1] src_path = None if '-s' in argv: idx = argv.index('-s') src_path = argv[idx+1] if '-c' in argv: idx = argv.index('-c') cfg_file = argv[idx+1] hbox = QHBoxLayout() vbox = QVBoxLayout() scrollView = ScrollArea() headerView = Header.Header(self) scrollView.connectHeaderView(headerView) headerView.connectMainView(scrollView.mainView.drawer) vbox.addWidget(headerView) vbox.addWidget(scrollView) toolBox = ToolBox.ToolBox(mode) hbox.addLayout(vbox) hbox.addLayout(toolBox) self.controller = Kitchen.Kitchen(mode,arg_file,cfg_file) self.controller.connectView(scrollView.mainView.drawer) self.controller.connectToolBox(toolBox) self.controller.start() srcViewer = SourceViewer.SourceViewer() srcViewer.createIndex(src_path) toolBox.connectMsgRcv(headerView) toolBox.connectMsgRcv(scrollView.mainView.drawer) toolBox.connectMsgRcv(self.controller) toolBox.connectDiagramView(scrollView.mainView.drawer) scrollView.mainView.drawer.setToolBox(toolBox) scrollView.mainView.drawer.connectSourceViewer(srcViewer) self.setLayout(hbox)
def __init__(self): QWidget.__init__(self) self.model = CustomTableModel() self.table_view = QTableView() self.table_view.setModel(self.model) self.table_view.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) self.table_view.verticalHeader().setSectionResizeMode(QHeaderView.Stretch) self.chart = QtCharts.QChart() self.chart.setAnimationOptions(QtCharts.QChart.AllAnimations) self.series = QtCharts.QLineSeries() self.series.setName("Line 1") self.mapper = QtCharts.QVXYModelMapper(self) self.mapper.setXColumn(0) self.mapper.setYColumn(1) self.mapper.setSeries(self.series) self.mapper.setModel(self.model) self.chart.addSeries(self.series) # for storing color hex from the series seriesColorHex = "#000000" # get the color of the series and use it for showing the mapped area seriesColorHex = "{}".format(self.series.pen().color().name()) self.model.add_mapping(seriesColorHex, QRect(0, 0, 2, self.model.rowCount())) # series 2 self.series = QtCharts.QLineSeries() self.series.setName("Line 2") self.mapper = QtCharts.QVXYModelMapper(self) self.mapper.setXColumn(2) self.mapper.setYColumn(3) self.mapper.setSeries(self.series) self.mapper.setModel(self.model) self.chart.addSeries(self.series) # get the color of the series and use it for showing the mapped area seriesColorHex = "{}".format(self.series.pen().color().name()) self.model.add_mapping(seriesColorHex, QRect(2, 0, 2, self.model.rowCount())); self.chart.createDefaultAxes() self.chart_view = QtCharts.QChartView(self.chart) self.chart_view.setRenderHint(QPainter.Antialiasing) self.chart_view.setMinimumSize(640, 480) # create main layout self.main_layout = QGridLayout() self.main_layout.addWidget(self.table_view, 1, 0) self.main_layout.addWidget(self.chart_view, 1, 1) self.main_layout.setColumnStretch(1, 1) self.main_layout.setColumnStretch(0, 0) self.setLayout(self.main_layout)
def __init__(self): QWidget.__init__(self) self.hello = ["Hallo welt!", "Ciao mondo!", "Hei maailma!", "Hola mundo!", "Hei verden!"] self.button = QPushButton("Click me!") self.text = QLabel("Hello World") self.text.setAlignment(Qt.AlignCenter) self.layout = QVBoxLayout() self.layout.addWidget(self.text) self.layout.addWidget(self.button) self.setLayout(self.layout) self.button.clicked.connect(self.magic)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.glWidget = GLWidget() self.xSlider = self.createSlider(SIGNAL("xRotationChanged(int)"), self.glWidget.setXRotation) self.ySlider = self.createSlider(SIGNAL("yRotationChanged(int)"), self.glWidget.setYRotation) self.zSlider = self.createSlider(SIGNAL("zRotationChanged(int)"), self.glWidget.setZRotation) mainLayout = QHBoxLayout() mainLayout.addWidget(self.glWidget) mainLayout.addWidget(self.xSlider) mainLayout.addWidget(self.ySlider) mainLayout.addWidget(self.zSlider) self.setLayout(mainLayout) self.xSlider.setValue(15 * 16) self.ySlider.setValue(345 * 16) self.zSlider.setValue(0 * 16) self.setWindowTitle(self.tr("Hello GL"))
def __init__(self, machine, material_dict, is_stator=False): """Initialize the widget according to machine Parameters ---------- self : SLamParam A SLamParam widget machine : Machine current machine to edit material_dict: dict Materials dictionary (library + machine) is_stator : bool To adapt the GUI to set either the stator or the rotor """ # Build the interface according to the .ui file QWidget.__init__(self) self.setupUi(self) # Saving arguments self.machine = machine self.material_dict = material_dict self.is_stator = is_stator # Set FloatEdit unit self.lf_L1.unit = "m" self.lf_Wrvd.unit = "m" self.u = gui_option.unit self.unit_L1.setText(self.u.get_m_name()) self.unit_Wrvd.setText(self.u.get_m_name()) # Get the correct object to set if self.is_stator: self.obj = machine.stator if self.obj.Kf1 is None: self.obj.Kf1 = 0.95 # Defaut value else: self.obj = machine.rotor if self.obj.L1 is None: # Default value for rotor is the stator one self.obj.L1 = self.machine.stator.L1 if self.obj.Kf1 is None: # Default value for rotor is the stator one self.obj.Kf1 = self.machine.stator.Kf1 if self.obj.axial_vent is None: self.obj.axial_vent = list() self.w_mat.update(self.obj, "mat_type", self.material_dict) self.lf_L1.setValue(self.obj.L1) self.lf_Kf1.setValue(self.obj.Kf1) # Ventilation setup self.update_avd_text() if len(self.obj.axial_vent) > 0 and self.obj.axial_vent[0].Zh > 0: self.g_ax_vent.setChecked(True) if self.obj.Nrvd is None or self.obj.Nrvd == 0: self.si_Nrvd.setValue(0) else: self.si_Nrvd.setValue(self.obj.Nrvd) self.g_rad_vent.setChecked(True) if self.obj.Wrvd is None or self.obj.Wrvd == 0: self.lf_Wrvd.setValue(0) else: self.lf_Wrvd.setValue(self.obj.Wrvd) self.g_rad_vent.setChecked(True) self.update_lenght() # Update out_length if possible # Connecting the signal self.lf_L1.editingFinished.connect(self.set_L1) self.lf_Kf1.editingFinished.connect(self.set_Kf1) self.g_rad_vent.toggled.connect(self.enable_rad_vent) self.g_ax_vent.toggled.connect(self.enable_ax_vent) self.b_axial_duct.clicked.connect(self.set_avd) self.si_Nrvd.editingFinished.connect(self.set_Nrvd) self.lf_Wrvd.editingFinished.connect(self.set_Wrvd) self.b_plot.clicked.connect(self.s_plot) self.w_mat.saveNeeded.connect(self.emit_save)
def __init__(self): QWidget.__init__(self)
def __init__(self, parent): self.parent = parent QWidget.__init__(self) self.initUI()
def __init__(self): QWidget.__init__(self) m = QMenu(self) b = QPushButton("Hello", self) b.setMenu(m)
def __init__(self, parent, data): if not type(data) == binaryninja.binaryview.BinaryView: raise Exception('expected widget data to be a BinaryView') self.bv = data self.debug_state = binjaplug.get_state(data) memory_view = self.debug_state.memory_view self.debug_state.ui.debug_view = self QWidget.__init__(self, parent) View.__init__(self) self.setupView(self) self.current_offset = 0 self.splitter = QSplitter(Qt.Orientation.Horizontal, self) frame = ViewFrame.viewFrameForWidget(self) self.memory_editor = LinearView(memory_view, frame) self.binary_editor = DisassemblyContainer(frame, data, frame) self.binary_text = TokenizedTextView(self, memory_view) self.is_raw_disassembly = False # TODO: Handle these and change views accordingly # Currently they are just disabled as the DisassemblyContainer gets confused # about where to go and just shows a bad view self.binary_editor.getDisassembly().actionHandler().bindAction( "View in Hex Editor", UIAction()) self.binary_editor.getDisassembly().actionHandler().bindAction( "View in Linear Disassembly", UIAction()) self.binary_editor.getDisassembly().actionHandler().bindAction( "View in Types View", UIAction()) self.memory_editor.actionHandler().bindAction("View in Hex Editor", UIAction()) self.memory_editor.actionHandler().bindAction( "View in Disassembly Graph", UIAction()) self.memory_editor.actionHandler().bindAction("View in Types View", UIAction()) small_font = QApplication.font() small_font.setPointSize(11) bv_layout = QVBoxLayout() bv_layout.setSpacing(0) bv_layout.setContentsMargins(0, 0, 0, 0) bv_label = QLabel("Loaded File") bv_label.setFont(small_font) bv_layout.addWidget(bv_label) bv_layout.addWidget(self.binary_editor) self.bv_widget = QWidget() self.bv_widget.setLayout(bv_layout) disasm_layout = QVBoxLayout() disasm_layout.setSpacing(0) disasm_layout.setContentsMargins(0, 0, 0, 0) disasm_label = QLabel("Raw Disassembly at PC") disasm_label.setFont(small_font) disasm_layout.addWidget(disasm_label) disasm_layout.addWidget(self.binary_text) self.disasm_widget = QWidget() self.disasm_widget.setLayout(disasm_layout) memory_layout = QVBoxLayout() memory_layout.setSpacing(0) memory_layout.setContentsMargins(0, 0, 0, 0) memory_label = QLabel("Debugged Process") memory_label.setFont(small_font) memory_layout.addWidget(memory_label) memory_layout.addWidget(self.memory_editor) self.memory_widget = QWidget() self.memory_widget.setLayout(memory_layout) self.splitter.addWidget(self.bv_widget) self.splitter.addWidget(self.memory_widget) # Equally sized self.splitter.setSizes([0x7fffffff, 0x7fffffff]) self.controls = ControlsWidget.DebugControlsWidget( self, "Controls", data, self.debug_state) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) layout.addWidget(self.controls) layout.addWidget(self.splitter, 100) self.setLayout(layout) self.needs_update = True self.update_timer = QTimer(self) self.update_timer.setInterval(200) self.update_timer.setSingleShot(False) self.update_timer.timeout.connect(lambda: self.updateTimerEvent()) # Add debugger state to the interpreter as `dbg` main_window = parent.window() dock_handler = main_window.findChild(DockHandler, '__DockHandler') if dock_handler: console = dock_handler.getDockWidget('Python Console') if console: # Hack: Currently no way to access the scripting provider directly # So just run the commands through the ui console.widget().addInput( "import debugger\ndbg = debugger.get(bv)")
def __init__(self, parent=None): QWidget.__init__(self, parent) self.ui = Ui_ImageLoader() self.ui.setupUi(self)
def __init__(self, lamination=None): """Initialize the GUI according to machine Parameters ---------- self : PWSlot61 A PWSlot61 widget lamination : Lamination current lamination to edit """ # Build the interface according to the .ui file QWidget.__init__(self) self.setupUi(self) self.lamination = lamination self.slot = lamination.slot # Set FloatEdit unit self.lf_W0.unit = "m" self.lf_W1.unit = "m" self.lf_W2.unit = "m" self.lf_W3.unit = "m" self.lf_H0.unit = "m" self.lf_H1.unit = "m" self.lf_H2.unit = "m" self.lf_H3.unit = "m" self.lf_H4.unit = "m" # Set unit name (m ou mm) wid_list = [ self.unit_W0, self.unit_W1, self.unit_W2, self.unit_H0, self.unit_H1, self.unit_H2, self.unit_W3, self.unit_H3, self.unit_H4, ] for wid in wid_list: wid.setText(gui_option.unit.get_m_name()) # Fill the fields with the machine values (if they're filled) self.lf_W0.setValue(self.slot.W0) self.lf_W1.setValue(self.slot.W1) self.lf_W2.setValue(self.slot.W2) self.lf_H0.setValue(self.slot.H0) self.lf_H1.setValue(self.slot.H1) self.lf_H2.setValue(self.slot.H2) self.lf_W3.setValue(self.slot.W3) self.lf_H3.setValue(self.slot.H3) self.lf_H4.setValue(self.slot.H4) # Display the main output of the slot (surface, height...) self.comp_output() # Connect the signal self.lf_W0.editingFinished.connect(self.set_W0) self.lf_W1.editingFinished.connect(self.set_W1) self.lf_W2.editingFinished.connect(self.set_W2) self.lf_H0.editingFinished.connect(self.set_H0) self.lf_H1.editingFinished.connect(self.set_H1) self.lf_H2.editingFinished.connect(self.set_H2) self.lf_W3.editingFinished.connect(self.set_W3) self.lf_H3.editingFinished.connect(self.set_H3) self.lf_H4.editingFinished.connect(self.set_H4)
def __init__(self): QWidget.__init__(self) self.setWindowTitle("Problem plecakowy") """Inicjlizacja zmiennych, na których będą dokynowane obliczenia oraz utworzenie obiektów (tabela,pola edycyjne,przyciski)""" self.p = [] self.w = [] self.W = 0 self.table = QTableWidget() self.n = QLineEdit() self.U = QLineEdit() self.file_name = QLineEdit() self.from_keys = QPushButton("Wprowadź dane") self.random = QPushButton("Generuj losowe wartości") self.from_file = QPushButton("Wprowadź dane z pliku") self.clear = QPushButton("Wyczyść") self.quit = QPushButton("Zamknij") self.solve1 = QPushButton("Rozwiąż korzystając z programowania zachłannego") self.solve2 = QPushButton("Rozwiąż korzystając z programowania dynamicznego") self.save = QPushButton("Zapis macierz do pliku") self.result_text = QLabel("Wartość plecaka:") self.result1 = QLabel() self.result2 = QLabel() """Tworzenie layoutów a następnie dodawanie do nich widgetów""" self.left = QVBoxLayout() self.left.addWidget(QLabel("Ilość rzeczy")) self.left.addWidget(self.n) self.left.addWidget(QLabel("Maksymalny udżwig")) self.left.addWidget(self.U) self.left.addWidget(self.from_keys) self.left.addWidget(self.random) self.left.addWidget(self.from_file) self.left.addWidget(self.clear) self.left.addWidget(self.quit) self.center = QVBoxLayout() self.right = QVBoxLayout() """Tworzenie głównego layoutu a następnie dodawanie do nich trzech utworzonych wcześniej""" self.layout = QHBoxLayout() self.layout.addLayout(self.left) self.layout.addLayout(self.center) self.layout.addLayout(self.right) self.setLayout(self.layout) """Komunikacja pomiędzy obiektami""" self.from_keys.clicked.connect(self.create_table) self.random.clicked.connect(self.create_table) self.random.clicked.connect(self.random_values) self.from_file.clicked.connect(self.create_table) self.from_file.clicked.connect(self.values_from_file) self.solve1.clicked.connect(self.zapakuj_zachlannie) self.solve2.clicked.connect(self.zapakuj_dynamicznie) self.n.textChanged[str].connect(self.check_disable) self.U.textChanged[str].connect(self.check_disable)
def __init__(self, parent, name, data): # Read the configuration settings = Settings() settings.register_group("ghinja", "Ghinja") settings.register_setting( "ghinja.ghidra_install_path", """ { "title" : "Ghidra Installation Path", "type" : "string", "default" : "", "description" : "Path to analyzeHeadless file in Ghidra installation dir." } """) if not os.path.exists( settings.get_string("ghinja.ghidra_install_path")): show_message_box( "Path to Ghidra headless was not found!", "To allow the Ghinja plugin to work, you will be prompted to specify the path to the \"analyzeHeadless(.bat)\" file.", buttons=0, icon=2) settings.set_string( "ghinja.ghidra_install_path", get_open_filename_input( "Provide Path to Ghidra \"analyzeHeadless(.bat)\" file (Usually: <GHIDRA_INSTALL>/support/analyzeHeadless)" ).decode("utf-8")) self.rename_settings = Settings() self.rename_settings.register_group("ghinja_rename", "Rename") self.rename_settings.register_setting( "ghinja_rename.ghinja_rename_struct", """ { "title" : "Ghidra Rename Struct", "type" : "string", "default" : "{}", "description" : "Settings to hold renames for variables." } """) global instance_id self.binja_renames = {} # {"function_name":[{"original":"new"})]} self.current_function = None self.current_offset = None self.decomp = None self.current_view = None self.function_output = None self.decompile_result_path = None self.decompile_offset_path = None self.decompiler_done = False self.function_args = [] QWidget.__init__(self, parent) DockContextHandler.__init__(self, self, name) self.actionHandler = UIActionHandler() self.actionHandler.setupActionHandler(self) layout = QVBoxLayout() self.editor = QTextEdit(self) self.editor.setReadOnly(True) self.editor.installEventFilter(self) self.editor.setStyleSheet( "QTextEdit { background-color: #2a2a2a; font-family: Consolas }") self.editor.setPlainText( " Click anywhere in the dock to start decompiler") self.editor.selectionChanged.connect(self.onSelect) highlighter = Highlighter(self.editor.document(), "", self.function_args) layout.addWidget(self.editor) layout.setAlignment(QtCore.Qt.AlignLeft) self.setLayout(layout) instance_id += 1 self.data = data
def __init__(self, window, parent=None): QWidget.__init__(self, parent) self._window = window self._mousePressed = False
def __init__(self, parent=None): QWidget.__init__(self, parent) self.logData: Class.LogInfo = None self.resultMap = dict() self._initUI() self._initData()
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.pressedDown = False self.xo = 0 self.yo = 0
def __init__(self): QWidget.__init__(self) self.setWindowTitle("Simple Login Windows") self.setGeometry(300, 250, 400, 300)
def __init__(self, lamination=None): """Initialize the GUI according to conductor Parameters ---------- self : PCondType12 A PCondType12 widget lamination : Lamination current lamination to edit """ # Build the interface according to the .ui file QWidget.__init__(self) self.setupUi(self) # Set FloatEdit unit self.lf_Wwire.unit = "m" self.lf_Wins_wire.unit = "m" self.lf_Wins_cond.unit = "m" self.lf_Lewout.unit = "m" self.u = gui_option.unit # Set unit name (m ou mm) wid_list = [ self.unit_Wwire, self.unit_Wins_cond, self.unit_Wins_wire, self.unit_Lewout, ] for wid in wid_list: wid.setText(self.u.get_m_name()) # Fill the fields with the machine values (if they're filled) self.lam = lamination self.cond = self.lam.winding.conductor # Make sure that isinstance(cond, CondType12) if self.cond is None or not isinstance(self.cond, CondType12): self.cond = CondType12() self.cond._set_None() if self.cond.Nwppc is None: self.cond.Nwppc = 1 # Default value self.si_Nwpc1.setValue(self.cond.Nwppc) self.lf_Wwire.setValue(self.cond.Wwire) if self.cond.Wins_wire is None: self.cond.Wins_wire = 0 # Default value self.lf_Wins_wire.setValue(self.cond.Wins_wire) if self.cond.Wins_cond is None: self.cond.Wins_cond = 0 # Default value self.lf_Wins_cond.setValue(self.cond.Wins_cond) self.lf_Lewout.validator().setBottom(0) if self.lam.winding.Lewout is None: self.lam.winding.Lewout = 0 self.lf_Lewout.setValue(self.lam.winding.Lewout) # Display the conductor main output self.w_out.comp_output() # Connect the signal/slot self.si_Nwpc1.editingFinished.connect(self.set_Nwppc) self.lf_Wwire.editingFinished.connect(self.set_Wwire) self.lf_Wins_wire.editingFinished.connect(self.set_Wins_wire) self.lf_Wins_cond.editingFinished.connect(self.set_Wins_cond) self.lf_Lewout.editingFinished.connect(self.set_Lewout)
def __init__(self): QWidget.__init__(self) self.items = 0 # Example data self._data = { "Water": 24.5, "Electricity": 55.1, "Rent": 850.0, "Supermarket": 230.4, "Internet": 29.99, "Bars": 21.85, "Public transportation": 60.0, "Coffee": 22.45, "Restaurants": 120 } # Left self.table = QTableWidget() self.table.setColumnCount(2) self.table.setHorizontalHeaderLabels(["Description", "Price"]) self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) # Right self.description = QLineEdit() self.price = QLineEdit() self.add = QPushButton("Add") self.clear = QPushButton("Clear") self.quit = QPushButton("Quit") # Disabling 'Add' button self.add.setEnabled(False) self.right = QVBoxLayout() self.right.setMargin(10) self.right.addWidget(QLabel("Description")) self.right.addWidget(self.description) self.right.addWidget(QLabel("Price")) self.right.addWidget(self.price) self.right.addWidget(self.add) self.right.addStretch() self.right.addWidget(self.clear) self.right.addWidget(self.quit) # QWidget Layout self.layout = QHBoxLayout() #self.table_view.setSizePolicy(size) self.layout.addWidget(self.table) self.layout.addLayout(self.right) # Set the layout to the QWidget self.setLayout(self.layout) # Signals and Slots self.add.clicked.connect(self.add_element) self.quit.clicked.connect(self.quit_application) self.clear.clicked.connect(self.clear_table) self.description.textChanged[str].connect(self.check_disable) self.price.textChanged[str].connect(self.check_disable) # Fill example data self.fill_table()
def __init__(self, name, parent, bv, db): QWidget.__init__(self, parent) DockContextHandler.__init__(self, self, name) self.hitcounts = [] self.orig_hitcounts = [] self.db = db self.bv = bv self.descending = True self.highlight = False self.current_page = 0 self.hitcounts = self.db.get_hitcounts() self.orig_hitcounts = [e for e in self.hitcounts] self.actionHandler = UIActionHandler() self.actionHandler.setupActionHandler(self) vlayout = QVBoxLayout() # Top label self.hitcount_counter = QLabel("Basic block count: {}".format( self.db.hitcount_count)) self.hitcount_counter.setAlignment(Qt.AlignLeft | Qt.AlignTop) # BB Hitcount table self.hit_table = QTableWidget(0, 3) self.hit_table.setHorizontalHeaderLabels( ["Address", "Hitcount", "Function"]) self.hit_table.verticalHeader().hide() self.hit_table.horizontalHeader().setStretchLastSection(True) self.hit_table.itemDoubleClicked.connect(self._cb_table) self._render_page() # Option buttons optionslayout = QHBoxLayout() optionsbox = QGroupBox("Options") ascending_checkbox = QCheckBox("Sort ascending") highlight_checkbox = QCheckBox("Highlight basic blocks") ascending_checkbox.stateChanged.connect(self._cb_ascending) highlight_checkbox.stateChanged.connect(self._cb_highlight) optionslayout.addWidget(ascending_checkbox) optionslayout.addWidget(highlight_checkbox) optionsbox.setLayout(optionslayout) # Diffing buttons diffinglayout = QHBoxLayout() diffingoptions = QGroupBox("Diffing") diffing_reset_button = QPushButton("Reset") diffing_diff_button = QPushButton("Difference") diffing_inter_button = QPushButton("Intersection") diffing_reset_button.clicked.connect(self._cb_diff_reset) diffing_diff_button.clicked.connect(self._cb_diff_diff) diffing_inter_button.clicked.connect(self._cb_diff_inter) diffinglayout.addWidget(diffing_diff_button) diffinglayout.addWidget(diffing_inter_button) diffinglayout.addWidget(diffing_reset_button) diffingoptions.setLayout(diffinglayout) # Bottom buttons for page change prevnextlayout = QHBoxLayout() self.back_button = QPushButton("<") self.next_button = QPushButton(">") self.page_count_label = QLabel("") self.page_count_label.setAlignment(Qt.AlignCenter) self._render_nav_line() self.back_button.clicked.connect(self._cb_prev_page) self.next_button.clicked.connect(self._cb_next_page) prevnextlayout.addWidget(self.back_button) prevnextlayout.addWidget(self.page_count_label) prevnextlayout.addWidget(self.next_button) vlayout.addWidget(self.hitcount_counter) vlayout.addWidget(self.hit_table) vlayout.addWidget(optionsbox) vlayout.addWidget(diffingoptions) vlayout.addLayout(prevnextlayout) self.setLayout(vlayout)
def __init__(self, available_colors: list): """ Widget allowing the user to create between 2 and 6 colors for the Colors typed attributes :param available_colors: existing colors to initialize """ QWidget.__init__(self) # Widgets self.__add_btn = QPushButton() self.__add_btn.setIcon(get_icon("add")) self.__add_btn.setIconSize(QSize(35, 35)) self.__add_btn.setToolTip(tr("crs_create_btn_tooltip")) self.__add_btn.clicked.connect(self.__add_color) self.__add_btn.setStyleSheet("border: none;") self.__delete_btn = QPushButton() self.__delete_btn.setIcon(get_icon("del")) self.__delete_btn.setIconSize(QSize(35, 35)) self.__delete_btn.setToolTip(tr("btn_suppr")) self.__delete_btn.clicked.connect(self.__remove_color) self.__delete_btn.setStyleSheet("border: none;") self.__btns = [] for c in available_colors: # Fill in existing colors self.__btns.append(ColorChooser(c, False)) for i in range(AttrColorsChooser.MAX_COLORS - len(available_colors)): # Complete with 'empty' colors self.__btns.append( ColorChooser(AttrColorsChooser.DEFAULT_COLOR, False)) # Use white as default color self.__btns[-1].setVisible(False) if len(available_colors) <= AttrColorsChooser.MIN_COLORS: self.__delete_btn.setEnabled(False) # Displays at least the minimum of buttons for i in range(AttrColorsChooser.MIN_COLORS): self.__btns[i].setVisible(True) elif len(available_colors) >= AttrColorsChooser.MAX_COLORS: self.__add_btn.setEnabled(False) # Layout layout = QGridLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.__delete_btn, 0, 0, 2, 1) r, c = 0, 1 for b in self.__btns: layout.addWidget(b, r, c) c += 1 if c == 4: r, c = 1, 1 layout.addWidget(self.__add_btn, 0, 4, 2, 1) self.setLayout(layout)
def __init__(self, machine, matlib, is_stator=False): """Initialize the GUI according to machine Parameters ---------- self : SWSlot A SWSlot widget machine : Machine current machine to edit matlib : MatLib Material Library is_stator : bool To adapt the GUI to set either the stator or the rotor """ # Build the interface according to the .ui file QWidget.__init__(self) self.setupUi(self) # Saving arguments self.machine = machine self.matlib = matlib self.is_stator = is_stator self.b_help.hide() # Fill the combobox with the available slot self.c_slot_type.clear() for slot in SLOT_NAME: self.c_slot_type.addItem(slot) # Avoid erase all the parameters when navigating though the slots self.previous_slot = dict() for slot_type in INIT_INDEX: self.previous_slot[slot_type] = None if self.is_stator: self.obj = machine.stator else: self.obj = machine.rotor # If the Slot is not set, initialize it with a 1_0 if self.obj.slot is None or type(self.obj.slot) is Slot: self.obj.slot = SlotW10() self.obj.slot._set_None() if self.obj.slot.Zs is None: self.si_Zs.clear() else: self.si_Zs.setValue(self.obj.slot.Zs) self.set_slot_pitch(self.obj.slot.Zs) # Set the correct index for the type checkbox and display the object index = INIT_INDEX.index(type(self.obj.slot)) self.c_slot_type.setCurrentIndex(index) # Update the slot widget self.s_update_slot() # Connect the slot self.c_slot_type.currentIndexChanged.connect(self.s_change_slot) self.si_Zs.editingFinished.connect(self.set_Zs) self.b_plot.clicked.connect(self.s_plot)
def __init__(self, crossword_index, grid_data, grid_cell_length, clue_across_data, clue_down_data): QWidget.__init__(self) self.grid_model = CrosswordGridModel(crossword_index, grid_data) self.grid_table_view = QTableView(self) self.grid_table_view.setModel(self.grid_model) self.grid_horizontal_header = self.grid_table_view.horizontalHeader() self.grid_horizontal_header.setSectionResizeMode(QHeaderView.Fixed) self.grid_horizontal_header.setDefaultSectionSize(grid_cell_length) self.grid_horizontal_header.hide() self.grid_vertical_header = self.grid_table_view.verticalHeader() self.grid_vertical_header.setSectionResizeMode(QHeaderView.Fixed) self.grid_vertical_header.setDefaultSectionSize(grid_cell_length * 1.3) self.grid_vertical_header.hide() self.clue_across_model = CrosswordClueModel(clue_across_data, 'পাশাপাশি') self.clue_across_table_view = QTableView(self) self.clue_across_table_view.setModel(self.clue_across_model) self.clue_across_horizontal_header = self.clue_across_table_view.horizontalHeader( ) self.clue_across_horizontal_header.setSectionResizeMode( QHeaderView.ResizeToContents) self.clue_across_vertical_header = self.clue_across_table_view.verticalHeader( ) self.clue_across_vertical_header.setSectionResizeMode( QHeaderView.Fixed) self.clue_across_vertical_header.setDefaultSectionSize( grid_cell_length) self.clue_down_model = CrosswordClueModel(clue_down_data, 'উপর নীচে') self.clue_down_table_view = QTableView(self) self.clue_down_table_view.setModel(self.clue_down_model) self.clue_down_horizontal_header = self.clue_down_table_view.horizontalHeader( ) self.clue_down_horizontal_header.setSectionResizeMode( QHeaderView.ResizeToContents) self.clue_down_vertical_header = self.clue_down_table_view.verticalHeader( ) self.clue_down_vertical_header.setSectionResizeMode(QHeaderView.Fixed) self.clue_down_vertical_header.setDefaultSectionSize(grid_cell_length) self.clue_layout = QHBoxLayout(self) self.clue_layout.addWidget(self.clue_across_table_view) self.clue_layout.addWidget(self.clue_down_table_view) self.clue_widget = QWidget(self) self.clue_widget.setLayout(self.clue_layout) self.buttons_layout = QHBoxLayout(self) self.save_button = QPushButton("Save") self.load_button = QPushButton("Load") self.clear_button = QPushButton("Clear") self.save_button.clicked.connect(self.save_solution) self.load_button.clicked.connect(self.grid_model.load_solution) self.clear_button.clicked.connect(self.grid_model.clear_solution) self.buttons_layout.addWidget(self.save_button) self.buttons_layout.addWidget(self.load_button) self.buttons_layout.addWidget(self.clear_button) self.buttons_widget = QWidget(self) self.buttons_widget.setLayout(self.buttons_layout) self.grid_layout = QVBoxLayout(self) self.grid_layout.addWidget(self.grid_table_view) self.grid_layout.addWidget(self.buttons_widget) self.grid_widget = QWidget(self) self.grid_widget.setLayout(self.grid_layout) self.main_layout = QHBoxLayout(self) self.main_layout.addWidget(self.grid_widget) self.main_layout.addWidget(self.clue_widget) self.setLayout(self.main_layout)
def __init__(self, lamination=None): """Initialize the GUI according to current lamination Parameters ---------- self : PWSlot13 A PWSlot13 widget lamination : Lamination current lamination to edit """ # Build the interface according to the .ui file QWidget.__init__(self) self.setupUi(self) self.lamination = lamination self.slot = lamination.slot # Set FloatEdit unit self.lf_W0.unit = "m" self.lf_W1.unit = "m" self.lf_W2.unit = "m" self.lf_W3.unit = "m" self.lf_H0.unit = "m" self.lf_H2.unit = "m" # Set unit name (m ou mm) wid_list = [ self.unit_W0, self.unit_W1, self.unit_W2, self.unit_W3, self.unit_H0, self.unit_H2, ] for wid in wid_list: wid.setText(gui_option.unit.get_m_name()) # Fill the fields with the machine values (if they're filled) self.lf_W0.setValue(self.slot.W0) self.lf_W1.setValue(self.slot.W1) self.lf_W2.setValue(self.slot.W2) self.lf_W3.setValue(self.slot.W3) self.lf_H0.setValue(self.slot.H0) if self.slot.H1_is_rad is None: self.slot.H1_is_rad = False # defaut unit [m] if self.slot.H1_is_rad: self.lf_H1.setValue(self.slot.H1) else: # convert m unit self.lf_H1.setValue(gui_option.unit.get_m(self.slot.H1)) self.lf_H2.setValue(self.slot.H2) # Update the unit combobox with the current m unit name self.c_H1_unit.clear() self.c_H1_unit.addItems([gui_option.unit.get_m_name(), "rad", "deg"]) if self.slot.H1_is_rad: # rad self.c_H1_unit.setCurrentIndex(1) else: self.c_H1_unit.setCurrentIndex(0) # Display the main output of the slot (surface, height...) self.w_out.comp_output() # Connect the signal/slot self.lf_W0.editingFinished.connect(self.set_W0) self.lf_W1.editingFinished.connect(self.set_W1) self.lf_W2.editingFinished.connect(self.set_W2) self.lf_W3.editingFinished.connect(self.set_W3) self.lf_H0.editingFinished.connect(self.set_H0) self.lf_H1.editingFinished.connect(self.set_H1) self.lf_H2.editingFinished.connect(self.set_H2) self.c_H1_unit.currentIndexChanged.connect(self.set_H1_unit)
def __init__(self): QWidget.__init__(self) self.model = CustomTableModel() self.table_view = QTableView() self.table_view.setModel(self.model) self.table_view.horizontalHeader().setSectionResizeMode( QHeaderView.Stretch) self.table_view.verticalHeader().setSectionResizeMode( QHeaderView.Stretch) self.chart = QtCharts.QChart() self.chart.setAnimationOptions(QtCharts.QChart.AllAnimations) self.series = QtCharts.QLineSeries() self.series.setName("Line 1") self.mapper = QtCharts.QVXYModelMapper(self) self.mapper.setXColumn(0) self.mapper.setYColumn(1) self.mapper.setSeries(self.series) self.mapper.setModel(self.model) self.chart.addSeries(self.series) # for storing color hex from the series seriesColorHex = "#000000" # get the color of the series and use it for showing the mapped area seriesColorHex = "{}".format(self.series.pen().color().name()) self.model.add_mapping(seriesColorHex, QRect(0, 0, 2, self.model.rowCount())) # series 2 self.series = QtCharts.QLineSeries() self.series.setName("Line 2") self.mapper = QtCharts.QVXYModelMapper(self) self.mapper.setXColumn(2) self.mapper.setYColumn(3) self.mapper.setSeries(self.series) self.mapper.setModel(self.model) self.chart.addSeries(self.series) # get the color of the series and use it for showing the mapped area seriesColorHex = "{}".format(self.series.pen().color().name()) self.model.add_mapping(seriesColorHex, QRect(2, 0, 2, self.model.rowCount())) self.chart.createDefaultAxes() self.chart_view = QtCharts.QChartView(self.chart) self.chart_view.setRenderHint(QPainter.Antialiasing) self.chart_view.setMinimumSize(640, 480) # create main layout self.main_layout = QGridLayout() self.main_layout.addWidget(self.table_view, 1, 0) self.main_layout.addWidget(self.chart_view, 1, 1) self.main_layout.setColumnStretch(1, 1) self.main_layout.setColumnStretch(0, 0) self.setLayout(self.main_layout) self.thread_quote = ThreadQuote() self.thread_quote.test.connect(self.random_update) self.thread_quote.start()
def __init__(self): QWidget.__init__(self) self._calendarIcon = QIcon("../images/calendar25x25.png") self.setWindowTitle( "Sonstige Ausgaben: Rechnungen, Abgaben, Gebühren etc.") self._gridLayout = QtWidgets.QGridLayout(self) self._gridLayout.setObjectName("gridLayout") #### save button btn = QPushButton() btn.clicked.connect(self.onSave) btn.setFlat(True) btn.setEnabled(False) btn.setToolTip("Änderungen dieser View speichern") icon = QIcon("../images/save_30.png") btn.setIcon(icon) size = QSize(30, 30) btn.setFixedSize(size) iconsize = QSize(30, 30) btn.setIconSize(iconsize) self._gridLayout.addWidget(btn, 0, 0, 1, 1) self._btnSave = btn self._cboBuchungsjahr = QtWidgets.QComboBox(self) font = QtGui.QFont() font.setPointSize(12) font.setBold(True) font.setWeight(75) self._cboBuchungsjahr.setFont(font) self._cboBuchungsjahr.setToolTip( "Das hier eingestellte Jahr bestimmt die Rechnungen, die in der Tabelle angezeigt werden." ) self._cboBuchungsjahr.currentIndexChanged.connect( self._buchungsjahrChanged) self._gridLayout.addWidget(self._cboBuchungsjahr, 1, 0, 1, 1) self._ddmmBuchung = QtWidgets.QLineEdit(self) self._ddmmBuchung.setToolTip( "Buchungstag und -monat. Tag und Monat mit \',\' oder \'.\' trennen." ) self._ddmmBuchung.setPlaceholderText("Buchungstag u. -monat") self._gridLayout.addWidget(self._ddmmBuchung, 1, 1, 1, 1) btn = QPushButton(self) btn.setMaximumSize(QSize(25, 25)) btn.setIcon(self._calendarIcon) btn.clicked.connect(self._onShowBuchungCalendar) self._gridLayout.addWidget(btn, 1, 2, 1, 1) self._btnCalendarBuchung = btn self._tableView = TableViewExt(self) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(0) self._tableView.setSizePolicy(sizePolicy) self._gridLayout.addWidget(self._tableView, 1, 4, 9, 1) self._treeView = TreeView(self) self._treeView.setStyleSheet("gridline-color: rgb(94, 94, 94);") self._treeView.setObjectName("treeView") self._gridLayout.addWidget(self._treeView, 2, 0, 1, 4) self._kreditor = QtWidgets.QLineEdit(self) self._kreditor.setToolTip( "Kreditor: wie im Baum ausgewählt oder freie Eingabe") self._kreditor.setPlaceholderText("Kreditor") self._gridLayout.addWidget(self._kreditor, 3, 0, 1, 1) self._cboMasterobjekt = QtWidgets.QComboBox(self) self._cboMasterobjekt.setEditable(True) self._cboMasterobjekt.setToolTip( "Haus: wie im Baum ausgewählt oder freie Eingabe") self._cboMasterobjekt.setPlaceholderText("Haus") self._gridLayout.addWidget(self._cboMasterobjekt, 3, 1, 1, 1) self._cboMietobjekt = QtWidgets.QComboBox(self) self._cboMietobjekt.setEditable(True) self._cboMietobjekt.setToolTip( "Wohnung: wie im Baum ausgewählt oder freie Eingabe") self._cboMietobjekt.setPlaceholderText("Wohnung") self._gridLayout.addWidget(self._cboMietobjekt, 3, 2, 1, 1) self._rgnr = QtWidgets.QLineEdit(self) self._rgnr.setPlaceholderText("Rechnungsnummer") self._gridLayout.addWidget(self._rgnr, 4, 0, 1, 1) self._ddmmRechnung = QtWidgets.QLineEdit(self) self._ddmmRechnung.setToolTip( "Rechnungstag und -monat. Tag und Monat mit \',\' oder \'.\' trennen." ) self._ddmmRechnung.setPlaceholderText("Rechnungstag u. -monat") self._gridLayout.addWidget(self._ddmmRechnung, 4, 1, 1, 1) #self._cboRechnungsjahr = QtWidgets.QComboBox( self ) #self._gridLayout.addWidget( self._cboRechnungsjahr, 4, 2, 1, 1 ) btn = QPushButton(self) btn.setMaximumSize(QSize(25, 25)) btn.setIcon(self._calendarIcon) btn.clicked.connect(self._onShowRechnungCalendar) self._gridLayout.addWidget(btn, 4, 2, 1, 1) self._btnCalendarRechnung = btn cb = QCheckBox(self) cb.setText("umlegbar") self._gridLayout.addWidget(cb, 5, 0, 1, 1) self._cbUmlegbar = cb cb = QCheckBox(self) cb.setText("werterhaltend") self._gridLayout.addWidget(cb, 5, 1, 1, 1) self._cbWerterhaltend = cb self._betrag = QtWidgets.QLineEdit(self) font = QtGui.QFont() font.setPointSize(11) font.setBold(True) font.setWeight(75) self._betrag.setFont(font) self._betrag.setPlaceholderText("Betrag") self._betrag.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self._betrag.setValidator(QDoubleValidator(0, 9999, 2, self)) self._gridLayout.addWidget(self._betrag, 7, 0, 1, 1) self._bemerkung = QtWidgets.QTextEdit(self) self._bemerkung.setMaximumSize(QtCore.QSize(16777215, 50)) self._bemerkung.setPlaceholderText( "Erläuterungen zur Rechnung oder Abgabe") self._gridLayout.addWidget(self._bemerkung, 8, 0, 1, 4) self._btnUebernehmen = QtWidgets.QPushButton(self) self._btnUebernehmen.setDefault(True) self._btnUebernehmen.setText("Übernehmen") self._gridLayout.addWidget(self._btnUebernehmen, 9, 0, 1, 1) self._btnReset = QtWidgets.QPushButton(self) self._btnReset.setText("Felder leeren") self._gridLayout.addWidget(self._btnReset, 9, 1, 1, 1) self._buchungsjahrChangedCallback = None #self._rechnungsjahrChangedCallback = None self._ddmmBuchung.setFocus()
def __init__(self): '''Class d'initialisation des 3 potentiometres => Les fonctions à la fin (knob1,2,3 et ligne1,2,3) permettent de synchroniser la valeur du potentiometre avec le lineEdit => dial1 > Translation Z ; dial2 > Rotation Y ; dial3 > Rotation X ''' QWidget.__init__(self) self.__restriction1 = QIntValidator(-180, 180) self.__restriction2 = QDoubleValidator(-10, 10, 2) A = QFont("Arial", 70) self.titre = QLabel("S T L B O A T") self.titre.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter) #self.titre.adjustSize() self.titre.setFont(A) self.dial1 = QDial() self.dial1.setValue(0) self.dial1.setMaximum(100) self.dial1.setMinimum(-100) self.dial1.valueChanged.connect(self.knob1) self.dial2 = QDial() self.dial2.valueChanged.connect(self.knob2) self.dial2.setMinimum(-180) self.dial2.setMaximum(180) self.dial2.setValue(0) self.dial3 = QDial() self.dial3.setMinimum(-180) self.dial3.setMaximum(180) self.dial3.setValue(0) self.dial3.valueChanged.connect(self.knob3) self.layout = QGridLayout() self.__lab1 = QLabel('Translation Z (m)') self.__lab1.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter) self.__lab2 = QLabel('Rotation Y (deg)') self.__lab2.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter) self.__lab3 = QLabel('Rotation X (deg)') self.__lab3.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter) self.line1 = QLineEdit() self.line1.setValidator(self.__restriction2) self.line1.editingFinished.connect(self.ligne1) self.line1.setText('0') self.line2 = QLineEdit() self.line2.setValidator(self.__restriction1) self.line2.editingFinished.connect(self.ligne2) self.line2.setText('0') self.line3 = QLineEdit() self.line3.setValidator(self.__restriction1) self.line3.setText('0') self.line3.editingFinished.connect(self.ligne3) self.layout.addWidget(self.titre, 0, 0, 1, 0) self.layout.addWidget(self.dial1, 1, 0) self.layout.addWidget(self.dial2, 1, 1) self.layout.addWidget(self.dial3, 1, 2) self.layout.addWidget(self.__lab1, 2, 0) self.layout.addWidget(self.__lab2, 2, 1) self.layout.addWidget(self.__lab3, 2, 2) self.layout.addWidget(self.line1, 3, 0) self.layout.addWidget(self.line2, 3, 1) self.layout.addWidget(self.line3, 3, 2) self.setLayout(self.layout) self.show()
def __init__(self, machine, material_dict, is_stator=False): """Initialize the widget according to machine Parameters ---------- self : SMachineType A SMachineType widget machine : Machine current machine to edit material_dict: dict Materials dictionary (library + machine) is_stator : bool To adapt the GUI to set either the stator or the rotor """ # Build the interface according to the .ui file QWidget.__init__(self) self.setupUi(self) # Saving arguments self.machine = machine self.material_dict = material_dict self.is_stator = is_stator # Dynamic import to avoid import loop module = __import__(PACKAGE_NAME + ".GUI.Dialog.DMachineSetup", fromlist=["DMachineSetup"]) self.mach_list = getattr(module, "mach_list") self.mach_index = getattr(module, "mach_index") # Fill the combobox self.c_type.clear() self.c_type.addItems( [self.mach_dict["name"] for self.mach_dict in self.mach_list]) # Update the GUI to the current machine type index = self.mach_index.index(type(self.machine)) self.mach_dict = self.mach_list[index] self.txt_type_machine.setText(self.mach_dict["txt"]) self.img_type_machine.setPixmap(QPixmap(self.mach_dict["img"])) self.c_type.setCurrentIndex(index) if machine.stator.get_pole_pair_number() is not None: self.si_p.setValue(machine.stator.winding.p) else: self.si_p.clear() # Empty spinbox # Set default values self.machine.stator.is_stator = True self.machine.rotor.is_stator = False if machine.rotor.is_internal is None: self.machine.rotor.is_internal = True self.machine.stator.is_internal = False self.is_inner_rotor.setCheckState(Qt.Checked) elif machine.rotor.is_internal: self.is_inner_rotor.setCheckState(Qt.Checked) else: self.is_inner_rotor.setCheckState(Qt.Unchecked) # WRSM can only have inner rotor if self.machine.type_machine == 9: self.is_inner_rotor.setEnabled(False) else: self.is_inner_rotor.setEnabled(True) if machine.name not in [None, ""]: self.le_name.setText(machine.name) # Connect the slot/signal self.si_p.editingFinished.connect(self.set_p) self.is_inner_rotor.toggled.connect(self.set_inner_rotor) self.le_name.editingFinished.connect(self.s_set_name) self.c_type.currentIndexChanged.connect(self.set_machine_type)
def __init__(self, lamination=None): """Initialize the GUI according to current lamination Parameters ---------- self : PWSlot23 A PWSlot23 widget lamination : Lamination current lamination to edit """ # Build the interface according to the .ui file QWidget.__init__(self) self.setupUi(self) self.lamination = lamination self.slot = lamination.slot # Set FloatEdit unit self.lf_W0.unit = "m" self.lf_W1.unit = "m" self.lf_W2.unit = "m" self.lf_W3.unit = "m" self.lf_H0.unit = "m" self.lf_H1.unit = "m" self.lf_H2.unit = "m" # Set unit name (m ou mm) wid_list = [ self.unit_W0, self.unit_W1, self.unit_W2, self.unit_W3, self.unit_H0, self.unit_H1, self.unit_H2, ] for wid in wid_list: wid.setText(gui_option.unit.get_m_name()) # Fill the fields with the machine values (if they're filled) self.lf_W0.setValue(self.slot.W0) self.lf_H0.setValue(self.slot.H0) self.lf_H1.setValue(self.slot.H1) self.lf_H2.setValue(self.slot.H2) if self.slot.W3 is None: self.lf_W3.clear() self.is_cst_tooth.setChecked(False) self.lf_W3.setEnabled(False) # No W3 => Constant slot self.lf_W1.setValue(self.slot.W1) self.lf_W2.setValue(self.slot.W2) else: # Cste tooth self.lf_W3.setValue(self.slot.W3) # W3 is set => constant Tooth so W1 and W2 should be disabled self.is_cst_tooth.setChecked(True) self.slot.W1 = None self.slot.W2 = None self.lf_W1.clear() self.lf_W2.clear() self.lf_W1.setEnabled(False) self.lf_W2.setEnabled(False) # Display the main output of the slot (surface, height...) self.w_out.comp_output() # Connect the signal self.lf_W0.editingFinished.connect(self.set_W0) self.lf_W1.editingFinished.connect(self.set_W1) self.lf_W2.editingFinished.connect(self.set_W2) self.lf_W3.editingFinished.connect(self.set_W3) self.lf_H0.editingFinished.connect(self.set_H0) self.lf_H1.editingFinished.connect(self.set_H1) self.lf_H2.editingFinished.connect(self.set_H2) self.is_cst_tooth.toggled.connect(self.set_is_cst_tooth)
def __init__(self, parent=None): QWidget.__init__(self, parent) QIntValidator.__init__(self, parent)
def __init__(self): QWidget.__init__(self) self.penFromEnum = None self.penFromInteger = None
def __init__(self, parent = None): QWidget.__init__(self, parent) self._sequence = [] self.setAttribute(Qt.WA_AcceptTouchEvents) QTimer.singleShot(200, self.generateEvent)
def __init__(self): QWidget.__init__(self) """ PROCESSING ATTRIBUTES """ self.loop_simulation = False self.parameters_window = None self.term = Terminal() self.stl_model = None self.stl_model_pressure = None self.stl_model_display = None self.object_mass = DEFAULT_OBJECT_MASS self.dichotomy_precision = DEFAULT_DICHOTOMY_PRECISION self.fluid_density = DEFAULT_FLUID_DENSITY self.show_draught = DEFAULT_SHOW_DRAUGHT self.setWindowTitle("G5 SIMULATION OBJECT FLOTABILITY") self.setFixedSize(1280, 1024) self.main_layout = QVBoxLayout() self.main_layout.setMargin(0) self.main_layout.setSpacing(0) self.setLayout(self.main_layout) """ TOPBAR WIDGETS """ self.topbar_layout = QGridLayout() self.topbar_layout.setAlignment(Qt.AlignTop) self.topbar_layout.setSpacing(32) buttons_icons = [ 'stl_file', 'parameters', 'prepare_simulation', 'start_simulation', 'loop_simulation', 'stop_simulation', 'generate_animation_gif' ] group_buttons_labels = ['LOAD 3D MODEL', 'PARAMETERS', 'SIMULATION'] buttons_slots = [ self.loadSTLModel, self.displayParametersWindow, self.prepareSimulation, self.startSimulation, self.loopSimulation, self.stopSimulation, self.generateAnimationsGIF ] buttons_tooltips = [ 'Load 3d model', 'Set parameters', 'Prepare the simulation', 'Start the simulation', 'Loop the simulation', 'Stop the simulation', 'Generate animations GIF' ] self.buttons = [QPushButton() for i in range(7)] for i, button in enumerate(self.buttons): button.setIcon(QIcon(ICONS_FOLDER + buttons_icons[i] + '_icon.png')) button.setIconSize(QSize(50, 50)) button.setStyleSheet('border:none; margin-top : 24px;') button.clicked.connect(buttons_slots[i]) button.setToolTip(buttons_tooltips[i]) if i > 0: button.setDisabled(True) self.topbar_layout.addWidget(button, 0, i, 1, 1) for i, group_buttons_label in enumerate(group_buttons_labels): label = QLabel(group_buttons_label) label.setFixedHeight(32) label.setAlignment(Qt.AlignCenter) label.setStyleSheet( 'border-top : 2px solid #dfdfdf; font-family: Calibri; font-size : 10pt; color: #2C3E50;' ) self.topbar_layout.addWidget(label, 1, i, 1, 1 if i != 2 else 5) self.main_layout.addLayout(self.topbar_layout) """ BODY_WIDGETS """ self.body_layout = QGridLayout() self.body_layout.setSpacing(0) self.stl_model_graph = QLabel() self.stl_model_graph.setPixmap(QPixmap(DEFAULT_STL_MODEL_GRAPH_FOLDER)) self.stl_model_graph.setFixedSize(640, 480) self.draught_graph = QLabel() self.draught_graph.setPixmap(QPixmap(DEFAULT_DRAUGHT_GRAPH_FOLDER)) self.draught_graph.setFixedSize(640, 480) self.body_layout.addWidget(self.stl_model_graph, 0, 0, 1, 1) self.body_layout.addWidget(self.draught_graph, 0, 1, 1, 1) self.colored_parts_legend = QLabel() self.colored_parts_legend.setPixmap( QPixmap(LEGEND_FOLDER + 'colored_parts_legend.png')) self.colored_parts_legend.setStyleSheet( 'padding : 0 0 13px 24px; background : #fff') self.body_layout.addWidget(self.colored_parts_legend, 1, 0, 1, 2) self.draught_legend = QLabel() self.draught_legend.setPixmap( QPixmap(LEGEND_FOLDER + 'draught_legend.png')) self.draught_legend.setStyleSheet( 'padding : 0 0 13px 24px; background : #fff') self.draught_legend.hide() self.body_layout.addWidget(self.draught_legend, 2, 0, 1, 2) self.term.setFixedWidth(1280) self.main_layout.addLayout(self.body_layout) self.main_layout.addWidget(self.term) self.show()
def __init__(self, settings): QWidget.__init__(self) self.settings = settings self.setWindowTitle('PARAMETERS') self.setFixedSize(360, 500) self.main_layout = QGridLayout() self.main_layout.setAlignment(Qt.AlignTop) self.setLayout(self.main_layout) calculous_parameters_label = QLabel('CALCULOUS PARAMETERS') calculous_parameters_label.setAlignment(Qt.AlignCenter) calculous_parameters_label.setFixedHeight(58) calculous_parameters_label.setStyleSheet( 'font-family: Calibri; font-size : 10pt; color: #2C3E50;') self.main_layout.addWidget(calculous_parameters_label, 0, 0, 1, 2) object_mass_label = QLabel('Object mass (kg)') object_mass_label.setStyleSheet( 'font-family: Calibri; font-size : 10pt; color: #2C3E50;') object_mass_label.setFixedHeight(32) self.main_layout.addWidget(object_mass_label, 1, 0, 1, 1) self.object_mass_input = QLineEdit() self.object_mass_input.setAlignment(Qt.AlignRight) self.object_mass_input.setText(str(self.settings.object_mass)) self.object_mass_input.textChanged.connect(self.updateObjectMass) self.main_layout.addWidget(self.object_mass_input, 1, 1, 1, 1) dichotomy_precision_label = QLabel('Dichotomy precision') dichotomy_precision_label.setFixedHeight(32) dichotomy_precision_label.setStyleSheet( 'font-family: Calibri; font-size : 10pt; color: #2C3E50;') self.main_layout.addWidget(dichotomy_precision_label, 2, 0, 1, 1) self.dichotomy_precision_input = QLineEdit() self.dichotomy_precision_input.setAlignment(Qt.AlignRight) self.dichotomy_precision_input.setText( str(self.settings.dichotomy_precision)) self.dichotomy_precision_input.textChanged.connect( self.updateDichotomyPrecision) self.main_layout.addWidget(self.dichotomy_precision_input, 2, 1, 1, 1) fluid_density_label = QLabel('Fluid density (kg/m3)') fluid_density_label.setFixedHeight(32) fluid_density_label.setStyleSheet( 'font-family: Calibri; font-size : 10pt; color: #2C3E50;') self.main_layout.addWidget(fluid_density_label, 3, 0, 1, 1) self.fluid_density_options = QComboBox() if self.settings.fluid_density == SALTWATER_DENSITY: self.fluid_density_options.addItem('saltwater (' + str(SALTWATER_DENSITY) + ' kg/m3)') self.fluid_density_options.addItem('freshwater (' + str(FRESHWATER_DENSITY) + ' kg/m3)') else: self.fluid_density_options.addItem('freshwater (' + str(FRESHWATER_DENSITY) + ' kg/m3)') self.fluid_density_options.addItem('saltwater (' + str(SALTWATER_DENSITY) + ' kg/m3)') self.fluid_density_options.addItem('Other') self.fluid_density_options.activated.connect( self.updateFluidDensityWithOption) self.main_layout.addWidget(self.fluid_density_options, 3, 1, 1, 1) self.fluid_density_input = QLineEdit() self.fluid_density_input.setAlignment(Qt.AlignRight) self.fluid_density_input.textChanged.connect( self.updateFluidDensityWithInput) if self.settings.fluid_density in [ FRESHWATER_DENSITY, SALTWATER_DENSITY ]: self.fluid_density_input.hide() else: self.fluid_density_input.setText(str(self.settings.fluid_density)) self.main_layout.addWidget(self.fluid_density_input, 4, 1, 1, 1) display_parameters_label = QLabel('DISPLAY PARAMETERS') display_parameters_label.setAlignment(Qt.AlignCenter) display_parameters_label.setFixedHeight(58) display_parameters_label.setStyleSheet( 'font-family: Calibri; font-size : 10pt; color: #2C3E50;') self.main_layout.addWidget(display_parameters_label, 5, 0, 1, 2) show_draught_label = QLabel('Show draught') show_draught_label.setFixedHeight(32) show_draught_label.setStyleSheet( 'font-family: Calibri; font-size : 10pt; color: #2C3E50;') self.main_layout.addWidget(show_draught_label, 6, 0, 1, 1) self.show_draught_checkbox = QCheckBox() self.show_draught_checkbox.stateChanged.connect(self.updateShowDraught) self.show_draught_checkbox.setCheckState( Qt.CheckState.Checked if self.settings.show_draught else Qt. CheckState.Unchecked) self.main_layout.addWidget(self.show_draught_checkbox, 6, 1, 1, 1) self.show()
def __init__(self): QWidget.__init__(self) self.items = 0 # Left Layout self.left = QVBoxLayout() # Left self.copy_bash_btn = QPushButton("Copy Bash !") self.copy_netcat_btn = QPushButton("Copy Netcat !") self.copy_python_btn = QPushButton("Copy Python2 !") self.copy_php_btn = QPushButton("Copy PHP !") self.copy_ruby_btn = QPushButton("Copy Ruby !") self.edit_text_bash = QTextEdit() self.edit_text_netcat = QTextEdit() self.edit_text_python = QTextEdit() self.edit_text_php = QTextEdit() self.edit_text_ruby = QTextEdit() # Adding Left Widgets self.left.addWidget(self.edit_text_bash) self.left.addWidget(self.copy_bash_btn) self.left.addWidget(self.edit_text_netcat) self.left.addWidget(self.copy_netcat_btn) self.left.addWidget(self.edit_text_python) self.left.addWidget(self.copy_python_btn) self.left.addWidget(self.edit_text_php) self.left.addWidget(self.copy_php_btn) self.left.addWidget(self.edit_text_ruby) self.left.addWidget(self.copy_ruby_btn) # Right layout self.right = QVBoxLayout() self.right.setMargin(10) # Right self.ip_input = QLineEdit() self.port_input = QLineEdit() self.generate_btn = QPushButton("Generate") self.edit_text_listener = QTextEdit() self.copy_listener_btn = QPushButton("Copy Listener !") self.text_tty = QTextEdit() self.copy_tty_btn = QPushButton("Copy TTY !") self.clear_btn = QPushButton("Clear") self.quit_btn = QPushButton("Quit") self.generate_btn.setEnabled(False) self.set_local_ip() # IP label = QLabel("IP addr:") label.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Fixed) self.right.addWidget(label) self.right.addWidget(self.ip_input) # Port label = QLabel("Port:") label.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Fixed) self.right.addWidget(label) self.right.addWidget(self.port_input) # Generate self.right.addWidget(self.generate_btn) # Listener self.right.addWidget(self.edit_text_listener) self.right.addWidget(self.copy_listener_btn) # TTY self.right.addWidget(self.text_tty) self.right.addWidget(self.copy_tty_btn) self.text_tty.setText( "python -c 'import pty; pty.spawn(\"/bin/bash\")'") # Fill Space self.right.addWidget(QFrame()) # Clearn and Quit self.right.addWidget(self.clear_btn) self.right.addWidget(self.quit_btn) # Tabs Layout self.layout = QHBoxLayout() self.layout.addLayout(self.left) self.layout.addLayout(self.right) self.setLayout(self.layout) # Signals and Slots self.ip_input.textChanged.connect(self.check_generate) self.port_input.textChanged.connect(self.check_generate) self.generate_btn.clicked.connect(self.generate_reverse_shell) self.clear_btn.clicked.connect(self.clear_text) self.quit_btn.clicked.connect(self.quit_application) # Signal Copy self.copy_bash_btn.clicked.connect( partial(self.copy_text, self.edit_text_bash)) self.copy_netcat_btn.clicked.connect( partial(self.copy_text, self.edit_text_netcat)) self.copy_python_btn.clicked.connect( partial(self.copy_text, self.edit_text_python)) self.copy_php_btn.clicked.connect( partial(self.copy_text, self.edit_text_php)) self.copy_ruby_btn.clicked.connect( partial(self.copy_text, self.edit_text_ruby)) self.copy_listener_btn.clicked.connect( partial(self.copy_text, self.edit_text_listener)) self.copy_tty_btn.clicked.connect( partial(self.copy_text, self.text_tty))