コード例 #1
0
ファイル: ezdialog.py プロジェクト: ezcad-dev/ezcad
    def select_file(self, edit, filters=None, new=False):
        """Select file.

        :param edit: box to display the selected file.
        :type edit: QLineEdit
        :param filters: filters by filename extension
        :type filters: str
        :param new: select existing or create new file.
        :type new: bool
        """
        initdir = to_text_string(edit.text())
        if osp.isdir(initdir):
            basedir = initdir
        else:
            basedir = osp.dirname(initdir)
            if not osp.isdir(basedir):
                basedir = getcwd_or_home()
        if filters is None:
            filters = _("All files (*)")
        title = _("Select file")
        if new:
            filename, _selfilter = getsavefilename(self, title, basedir,
                                                   filters)
        else:
            filename, _selfilter = getopenfilename(self, title, basedir,
                                                   filters)
        if filename:
            edit.setText(filename)
            self.load_lines()
        # Push default object name
        if self.object_name is not None:
            path, fn = osp.split(filename)
            object_name = osp.splitext(fn)[0]
            self.object_name.edit.setText(object_name)
コード例 #2
0
ファイル: terminal.py プロジェクト: ezcad-dev/ezcad
 def show_help(self):
     QMessageBox.information(
         self, _('How to use'),
         _("The project console provides API to the project.<br>"
           "For example, try run myprint(self.database).<br>"
           "Due to Cython compiler, use myprint() for print().<br>"
           "<b>TODO</b> add more.<br>"))
コード例 #3
0
ファイル: ezdialog.py プロジェクト: ezcad-dev/ezcad
 def create_cubeframe(self):
     widget = QWidget(self)
     lbl_iline = QLabel(_("Iline first, last, step"))
     widget.le_il_frst = QLineEdit()
     widget.le_il_last = QLineEdit()
     widget.le_il_ncrt = QLineEdit()
     lbl_xline = QLabel(_("Xline first, last, step"))
     widget.le_xl_frst = QLineEdit()
     widget.le_xl_last = QLineEdit()
     widget.le_xl_ncrt = QLineEdit()
     lbl_depth = QLabel(_("Depth first, last, step"))
     widget.le_dp_frst = QLineEdit()
     widget.le_dp_last = QLineEdit()
     widget.le_dp_ncrt = QLineEdit()
     layout = QGridLayout()
     layout.addWidget(lbl_iline, 0, 0)
     layout.addWidget(widget.le_il_frst, 0, 1)
     layout.addWidget(widget.le_il_last, 0, 2)
     layout.addWidget(widget.le_il_ncrt, 0, 3)
     layout.addWidget(lbl_xline, 1, 0)
     layout.addWidget(widget.le_xl_frst, 1, 1)
     layout.addWidget(widget.le_xl_last, 1, 2)
     layout.addWidget(widget.le_xl_ncrt, 1, 3)
     layout.addWidget(lbl_depth, 2, 0)
     layout.addWidget(widget.le_dp_frst, 2, 1)
     layout.addWidget(widget.le_dp_last, 2, 2)
     layout.addWidget(widget.le_dp_ncrt, 2, 3)
     layout.setContentsMargins(0, 0, 0, 0)
     widget.setLayout(layout)
     return widget
コード例 #4
0
ファイル: terminal.py プロジェクト: ezcad-dev/ezcad
    def setup_buttons(self):

        # TODO how to fix this bug?
        # shortcut in plugin conflicts with shortcut in mainwindow
        # QAction::eventFilter: Ambiguous shortcut overload: Ctrl+O

        openfile_btn = create_toolbutton(self,
                                         icon=ima.icon('fileopen'),
                                         tip=_('Open file'),
                                         shortcut="Ctrl+O",
                                         triggered=self.open_file)
        savefile_btn = create_toolbutton(self,
                                         icon=ima.icon('filesave'),
                                         tip=_('Save to new file'),
                                         shortcut="Ctrl+S",
                                         triggered=self.save_file)
        runfile_btn = create_toolbutton(self,
                                        icon=ima.icon('run_file'),
                                        tip=_('Run code in file'),
                                        triggered=self.run_file)
        run_btn = create_toolbutton(self,
                                    icon=ima.icon('run'),
                                    tip=_('Run code in view'),
                                    shortcut="Ctrl+R",
                                    triggered=self.emit_script)
        help_btn = create_toolbutton_help(self, triggered=self.show_help)
        buttons = (openfile_btn, savefile_btn, runfile_btn, run_btn, help_btn)
        return buttons
コード例 #5
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
    def setup_page(self):
        lblMethod = QLabel(_("Method"))
        self.rbAuto = QRadioButton(_("Auto"))
        self.rbEqual = QRadioButton(_("Equal"))
        self.rbFixed = QRadioButton(_("Fixed"))
        bgSystem = QButtonGroup()
        bgSystem.addButton(self.rbAuto)
        bgSystem.addButton(self.rbEqual)
        bgSystem.addButton(self.rbFixed)
        hbox = QHBoxLayout()
        hbox.addWidget(lblMethod)
        hbox.addWidget(self.rbAuto)
        hbox.addWidget(self.rbEqual)
        hbox.addWidget(self.rbFixed)
        self.layout.addLayout(hbox)

        text = _("Fixed ratio Y/X")
        self.ratio = self.create_lineedit(text, default='1.0')
        self.layout.addWidget(self.ratio)

        action = self.create_action()
        self.layout.addWidget(action)

        self.rbAuto.toggled.connect(lambda: self.set_method(self.rbAuto))
        self.rbEqual.toggled.connect(lambda: self.set_method(self.rbEqual))
        self.rbFixed.toggled.connect(lambda: self.set_method(self.rbFixed))
        self.rbEqual.setChecked(True)
        self.ratio.setEnabled(False)
コード例 #6
0
 def create_browsefile(self,
                       text,
                       option,
                       default=NoDefault,
                       tip=None,
                       filters=None):
     widget = self.create_lineedit(text,
                                   option,
                                   default,
                                   alignment=Qt.Horizontal)
     for edit in self.lineedits:
         if widget.isAncestorOf(edit):
             break
     msg = _('Invalid file path')
     self.validate_data[edit] = (osp.isfile, msg)
     browse_btn = QPushButton(ima.icon('FileIcon'), '', self)
     browse_btn.setToolTip(_("Select file"))
     browse_btn.clicked.connect(lambda: self.select_file(edit, filters))
     layout = QHBoxLayout()
     layout.addWidget(widget)
     layout.addWidget(browse_btn)
     layout.setContentsMargins(0, 0, 0, 0)
     browsefile = QWidget(self)
     browsefile.lineedit = widget
     browsefile.setLayout(layout)
     return browsefile
コード例 #7
0
ファイル: ezdialog.py プロジェクト: ezcad-dev/ezcad
    def create_action(self, ok=True, apply_label='Apply'):
        """Create action buttons.

        :param ok: have the OK button
        :type ok: bool
        :param apply_label: label of the apply button
        :type apply_label: str
        :return: QWidget
        """
        if ok:
            btn_ok = QPushButton(_('OK'))
            btn_ok.clicked.connect(self.apply_and_close)
        btn_apply = QPushButton(_(apply_label))
        btn_apply.clicked.connect(self.apply)
        btn_close = QPushButton(_('Cancel'))
        btn_close.clicked.connect(self.close)
        btn_help = QPushButton(_('Help'))
        btn_help.clicked.connect(self.show_help)
        layout = QHBoxLayout()
        layout.addStretch()
        if ok:
            layout.addWidget(btn_ok)
        layout.addWidget(btn_apply)
        layout.addWidget(btn_close)
        layout.addWidget(btn_help)
        action = QWidget(self)
        action.setLayout(layout)
        return action
コード例 #8
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
class CreatePropertyDialog(EasyDialog):
    NAME = _("Create property")
    HELP_BODY = _("The new property is initialized with zeros.<br>")
    sig_start = Signal(str, str)

    def __init__(self, parent=None):
        EasyDialog.__init__(self, parent)
        self.setup_page()

    def setup_page(self):
        text = _("Object")
        self.grabob = self.create_grabob(text, geom=GEOMETRY_TYPES)
        self.layout.addWidget(self.grabob)

        text = _("Property name")
        self.prop_name = self.create_lineedit(text)
        self.layout.addWidget(self.prop_name)

        action = self.create_action()
        self.layout.addWidget(action)

    def grab_object_rc(self):
        """ Used when dialog is brought up by right click in tree. """
        dob = self.treebase.grab_object(GEOMETRY_TYPES)
        self.grabob.lineedit.edit.setText(dob.name)

    def apply(self):
        object_name = self.grabob.lineedit.edit.text()
        prop_name = self.prop_name.edit.text()
        # self.treebase.create_property(object_name, prop_name)
        self.sig_start.emit(object_name, prop_name)
コード例 #9
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
class SaveObjectDialog(EasyDialog):
    NAME = _("Save object")
    HELP_BODY = _("The recommended filename extension is db (e.g. myobj.db), "
        "which is the default filter at load object. But the filename can "
        "have any extension, and you'd switch the filter to \"All files\".")
    sig_start = Signal(str, str)

    def __init__(self, parent=None):
        EasyDialog.__init__(self, parent)
        self.setup_page()

    def setup_page(self):
        text = _("Object")
        self.grabob = self.create_grabob(text, geom=GEOMETRY_TYPES)
        self.layout.addWidget(self.grabob)

        self.output = self.create_browsefile(_("File"), new=True)
        self.layout.addWidget(self.output)

        action = self.create_action()
        self.layout.addWidget(action)

    def apply(self):
        fn = self.output.lineedit.edit.text()
        object_name = self.grabob.lineedit.edit.text()
        self.sig_start.emit(object_name, fn)
コード例 #10
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
class LoadObjectDialog(EasyDialog):
    NAME = _("Load object")
    HELP_BODY = _("The original object name was saved into the db file, "
        "so you don't have to supply it, in which case, just leave it "
        "blank or DEFAULT.")
    sig_start = Signal(str, str)

    def __init__(self, parent=None):
        EasyDialog.__init__(self, parent)
        self.setup_page()

    def setup_page(self):
        filters = "DB files (*.db)" + FILTER_ALL_FILES
        self.input = self.create_browsefile(_("Object file"), filters=filters)
        self.layout.addWidget(self.input)

        # Avoid use self.object_name so not set filename as default
        # The desired default is blank, so use the name saved in db.
        self.name = self.create_lineedit("Object name", default="DEFAULT")
        self.layout.addWidget(self.name)

        action = self.create_action()
        self.layout.addWidget(action)

    def apply(self):
        fn = self.input.lineedit.edit.text()
        object_name = self.name.edit.text()
        self.sig_start.emit(fn, object_name)
コード例 #11
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
    def setup_page(self):
        text = _("Email server")
        default = 'localhost'
        self.server = self.create_lineedit(text, default=default)
        self.layout.addWidget(self.server)

        text = _("Sender")
        default = 'email address e.g. [email protected]'
        self.sender = self.create_lineedit(text, default=default)
        self.layout.addWidget(self.sender)

        text = _("Receivers")
        default = 'email addresses separated by comma'
        self.receivers = self.create_lineedit(text, default=default)
        self.layout.addWidget(self.receivers)

        text = _("Subject")
        self.subject = self.create_lineedit(text)
        self.layout.addWidget(self.subject)

        self.body = QTextEdit(self)
        self.body.setFontFamily("monospace")
        self.body.setText(self.helpMessage)
        self.layout.addWidget(self.body)

        action = self.create_action()
        self.layout.addWidget(action)
コード例 #12
0
ファイル: zoep_dialog.py プロジェクト: ezcad-dev/opt20s
 def set_reflection(self, rb):
     if rb.isChecked():
         if rb.text() == _('PP'):
             self.reflection = 'PP'
         elif rb.text() == _('PS'):
             self.reflection = 'PS'
         else:
             raise ValueError("Unknown value")
コード例 #13
0
ファイル: zoep_dialog.py プロジェクト: ezcad-dev/opt20s
 def set_complex(self, rb):
     if rb.isChecked():
         if rb.text() == _('amplitude'):
             self.complex = 'amplitude'
         elif rb.text() == _('phase'):
             self.complex = 'phase'
         else:
             raise ValueError("Unknown value")
コード例 #14
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
    def __init__(self, parent=None, objname=None):
        QDialog.__init__(self, parent)

        # If used for data object in tree, the main is the tree widget.
        self.parent = parent
        self.objname = objname

        # Widgets
        self.pages_widget = QStackedWidget()
        self.contents_widget = QListWidget()
        self.button_reset = QPushButton(_('Reset to defaults'))

        bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Apply |
                                QDialogButtonBox.Cancel)
        self.apply_btn = bbox.button(QDialogButtonBox.Apply)

        # Widgets setup
        # Destroying the C++ object right after closing the dialog box,
        # otherwise it may be garbage-collected in another QThread
        # (e.g. the editor's analysis thread in Ezcad), thus leading to
        # a segmentation fault on UNIX or an application crash on Windows
        self.setAttribute(Qt.WA_DeleteOnClose)
        if self.objname is None:
            self.setWindowTitle(_('Preferences'))
        else:
            self.setWindowTitle(_('Preferences of ') + self.objname)
        self.setWindowIcon(ima.icon('configure'))
        self.contents_widget.setMovement(QListView.Static)
        self.contents_widget.setSpacing(1)
        self.contents_widget.setCurrentRow(0)

        # Layout
        hsplitter = QSplitter()
        hsplitter.addWidget(self.contents_widget)
        hsplitter.addWidget(self.pages_widget)
        hsplitter.setSizes([150,500])

        btnlayout = QHBoxLayout()
        btnlayout.addWidget(self.button_reset)
        btnlayout.addStretch(1)
        btnlayout.addWidget(bbox)

        vlayout = QVBoxLayout()
        vlayout.addWidget(hsplitter)
        vlayout.addLayout(btnlayout)

        self.setLayout(vlayout)

        # Signals and slots
        self.pages_widget.currentChanged.connect(self.current_page_changed)
        self.contents_widget.currentRowChanged.connect(
            self.pages_widget.setCurrentIndex)
        bbox.accepted.connect(self.accept)
        bbox.rejected.connect(self.reject)
        bbox.clicked.connect(self.button_clicked)

        # Ensures that the config is present on ezcad first run
        CONF.set('main', 'interface_language', load_lang_conf())
コード例 #15
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
    def setup_page(self):
        text = _("Object")
        self.grabob = self.create_grabob(text, geom=GEOMETRY_TYPES)
        self.layout.addWidget(self.grabob)

        self.output = self.create_browsefile(_("File"), new=True)
        self.layout.addWidget(self.output)

        action = self.create_action()
        self.layout.addWidget(action)
コード例 #16
0
ファイル: zoep_dialog.py プロジェクト: ezcad-dev/opt20s
 def set_equation(self, rb):
     if rb.isChecked():
         if rb.text() == _('Linear'):
             self.equation = 'linear'
         elif rb.text() == _('Quadratic'):
             self.equation = 'quadratic'
         elif rb.text() == _('Zoeppritz'):
             self.equation = 'zoeppritz'
         else:
             raise ValueError("Unknown value")
コード例 #17
0
ファイル: ezdialog.py プロジェクト: ezcad-dev/ezcad
 def test(self):
     vbox = QVBoxLayout()
     label1 = QLabel(_("Open existing file"))
     file1 = self.create_browsefile(_("File"))
     label2 = QLabel(_("Create new file"))
     file2 = self.create_browsefile(_("File"), new=True)
     vbox.addWidget(label1)
     vbox.addWidget(file1)
     vbox.addWidget(label2)
     vbox.addWidget(file2)
     self.setLayout(vbox)
コード例 #18
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
    def setup_page(self):
        text = _("Object")
        self.grabob = self.create_grabob(text, geom=GEOMETRY_TYPES)
        self.layout.addWidget(self.grabob)

        text = _("Property")
        self.prop = self.create_combobox(text)
        self.layout.addWidget(self.prop)

        action = self.create_action()
        self.layout.addWidget(action)
コード例 #19
0
ファイル: log_box.py プロジェクト: ezcad-dev/ezcad
 def setup_buttons(self):
     clear_btn = create_toolbutton(self,
                                   icon=ima.icon('clear_text'),
                                   tip=_('Clear text'),
                                   shortcut="Ctrl+L",
                                   triggered=self.textBrowser.clear)
     dummy_btn = create_toolbutton(self,
                                   icon=ima.icon('fromcursor'),
                                   tip=_('Do nothing'))
     help_btn = create_toolbutton_help(self, triggered=self.show_help)
     return clear_btn, dummy_btn, help_btn
コード例 #20
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
 def set_method(self, rb):
     if rb.isChecked():
         if rb.text() == _("Auto"):
             self.method = 'Auto'
         elif rb.text() == _("Equal"):
             self.method = 'Equal'
         elif rb.text() == _("Fixed"):
             self.method = 'Fixed'
             self.ratio.setEnabled(True)
         else:
             raise ValueError("unknown value {}".format(rb.text()))
コード例 #21
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
    def setup_page(self):
        text = _("Object")
        self.grabob = self.create_grabob(text, geom=GEOMETRY_TYPES)
        self.layout.addWidget(self.grabob)

        text = _("New name")
        self.new_name = self.create_lineedit(text)
        self.layout.addWidget(self.new_name)

        action = self.create_action()
        self.layout.addWidget(action)
コード例 #22
0
 def select_file(self, edit, filters=None):
     """Select File"""
     basedir = osp.dirname(to_text_string(edit.text()))
     if not osp.isdir(basedir):
         basedir = getcwd_or_home()
     if filters is None:
         filters = _("All files (*)")
     title = _("Select file")
     filename, _selfilter = getopenfilename(self, title, basedir, filters)
     if filename:
         edit.setText(filename)
コード例 #23
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
class ReportBugDialog(EasyDialog):
    NAME = _("Report bug")
    HELP_BODY = _("Please copy-n-paste the error message in the "
        "Process log (if any). Please explain briefly what you were "
        "doing when the bug occurred. Please add anything that can "
        "help me reproduce the error. Thanks for your time and "
        "contribution to improving ezcad.")
    sig_start = Signal(str, str, str, str, str)

    def __init__(self, parent=None):
        EasyDialog.__init__(self, parent)
        self.setup_page()

    def setup_page(self):
        text = _("Email server")
        default = 'localhost'
        self.server = self.create_lineedit(text, default=default)
        self.layout.addWidget(self.server)

        text = _("Sender")
        default = 'email address e.g. [email protected]'
        self.sender = self.create_lineedit(text, default=default)
        self.layout.addWidget(self.sender)

        text = _("Receivers")
        default = 'email addresses separated by comma'
        self.receivers = self.create_lineedit(text, default=default)
        self.layout.addWidget(self.receivers)

        text = _("Subject")
        self.subject = self.create_lineedit(text)
        self.layout.addWidget(self.subject)

        self.body = QTextEdit(self)
        self.body.setFontFamily("monospace")
        self.body.setText(self.helpMessage)
        self.layout.addWidget(self.body)

        action = self.create_action()
        self.layout.addWidget(action)

    def apply(self):
        server = self.server.edit.text()
        sender = self.sender.edit.text()
        receivers = self.receivers.edit.text()
        subject = self.subject.edit.text()
        body = self.body.toPlainText()
        receivers = [x.strip() for x in receivers.split(',')]
        self.sig_start.emit(sender, receivers, subject, body, server)
コード例 #24
0
    def add_item_agent(self, dob):
        parent = self._name
        geom = dob.geometry_type
        if geom not in ['Point', 'Label', 'Line']:
            QMessageBox.critical(
                self, _("Warning"),
                _("{} cannot display {}".format(parent, dob.name)))
            return

        logger.info('{} is adding {}'.format(parent, dob.name))
        if parent not in dob.vs2d:
            dob.make_vs2d(parent=parent)
        item = dob.vs2d[parent]
        self.add_item(item)
        self.save_display_state(dob.name, 'object', 'self', True)
コード例 #25
0
ファイル: trimmer.py プロジェクト: JoeXinfa/trimts
    def setup_page(self):
        text = _("Folder")
        self.folder = self.create_browsedir(text)
        self.layout.addWidget(self.folder)

        text = _("File extension")
        self.extension = self.create_lineedit(text, default=".py")
        self.layout.addWidget(self.extension)

        text = _("File")
        self.file = self.create_browsefile(text)
        self.layout.addWidget(self.file)

        action = self.create_action()
        self.layout.addWidget(action)
コード例 #26
0
    def create_fontgroup(self,
                         option=None,
                         text=None,
                         title=None,
                         tip=None,
                         fontfilters=None,
                         without_group=False):
        """Option=None -> setting plugin font"""

        if title:
            fontlabel = QLabel(title)
        else:
            fontlabel = QLabel(_("Font: "))
        fontbox = QFontComboBox()

        if fontfilters is not None:
            fontbox.setFontFilters(fontfilters)

        sizelabel = QLabel("  " + _("Size: "))
        sizebox = QSpinBox()
        sizebox.setRange(7, 100)
        self.fontboxes[(fontbox, sizebox)] = option
        layout = QHBoxLayout()

        for subwidget in (fontlabel, fontbox, sizelabel, sizebox):
            layout.addWidget(subwidget)
        layout.addStretch(1)

        widget = QWidget(self)
        widget.fontlabel = fontlabel
        widget.sizelabel = sizelabel
        widget.fontbox = fontbox
        widget.sizebox = sizebox
        widget.setLayout(layout)

        if not without_group:
            if text is None:
                text = _("Font style")

            group = QGroupBox(text)
            group.setLayout(layout)

            if tip is not None:
                group.setToolTip(tip)

            return group
        else:
            return widget
コード例 #27
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
    def setup_page(self):
        text = _("Object")
        self.grabob = self.create_grabob(text, geom=GEOMETRY_TYPES)
        self.layout.addWidget(self.grabob)

        action = self.create_action()
        self.layout.addWidget(action)
コード例 #28
0
ファイル: dialogs.py プロジェクト: ezcad-dev/ezcad
class RenameObjectDialog(EasyDialog):
    NAME = _("Rename object")
    sig_start = Signal(str, str)

    def __init__(self, parent=None):
        EasyDialog.__init__(self, parent)
        self.setup_page()

    def setup_page(self):
        text = _("Object")
        self.grabob = self.create_grabob(text, geom=GEOMETRY_TYPES)
        self.layout.addWidget(self.grabob)

        text = _("New name")
        self.new_name = self.create_lineedit(text)
        self.layout.addWidget(self.new_name)

        action = self.create_action()
        self.layout.addWidget(action)

    def grab_object_rc(self):
        """ Used when dialog is brought up by right click in tree. """
        dob = self.treebase.grab_object(GEOMETRY_TYPES)
        self.grabob.lineedit.edit.setText(dob.name)

    def apply(self):
        object_name = self.grabob.lineedit.edit.text()
        new_name = self.new_name.edit.text()
        # self.treebase.rename_object(object_name, new_name)
        self.sig_start.emit(object_name, new_name)
コード例 #29
0
ファイル: ezdialog.py プロジェクト: ezcad-dev/ezcad
    def create_browsefile(self,
                          text,
                          default=None,
                          tip=None,
                          filters=None,
                          new=False):
        """Create browse file widget.

        :param text: key
        :type text: str
        :param default: default value
        :type default: str
        :param tip: tool tip
        :type tip: str
        :param filters: filters by filename extension
        :type filters: str
        :param new: select existing or create new file.
        :type new: bool
        :return: QWidget
        """
        widget = self.create_lineedit(text, default=default, tip=tip)
        edit = widget.edit
        browse_btn = QPushButton(ima.icon('FileIcon'), '', self)
        browse_btn.setToolTip(_("Select file"))
        browse_btn.clicked.connect(
            lambda: self.select_file(edit, filters, new))
        layout = QHBoxLayout()
        layout.addWidget(widget)
        layout.addWidget(browse_btn)
        layout.setContentsMargins(0, 0, 0, 0)
        browsefile = QWidget(self)
        browsefile.lineedit = widget
        browsefile.setLayout(layout)
        return browsefile
コード例 #30
0
ファイル: trimmer.py プロジェクト: JoeXinfa/trimts
class Trimmer(EasyDialog):
    NAME = _("Trim trailing spaces")
    sigRun = Signal(str, str, str)

    def __init__(self, parent=None):
        EasyDialog.__init__(self, parent)
        self.setup_page()

    def setup_page(self):
        text = _("Folder")
        self.folder = self.create_browsedir(text)
        self.layout.addWidget(self.folder)

        text = _("File extension")
        self.extension = self.create_lineedit(text, default=".py")
        self.layout.addWidget(self.extension)

        text = _("File")
        self.file = self.create_browsefile(text)
        self.layout.addWidget(self.file)

        action = self.create_action()
        self.layout.addWidget(action)

    def apply(self):
        path = self.folder.lineedit.edit.text()
        ext = self.extension.edit.text()
        file = self.file.lineedit.edit.text()
        #trim(path, ext, file)
        self.sigRun.emit(path, ext, file)