コード例 #1
0
ファイル: parameters.py プロジェクト: FabianGentner/NOSE
    def _createCurrentSeriesEntries(self, table):
        """
        Creates the entry widgets used to specify the current series and the
        associated labels, and adds them to the given table.
        """
        data = (
            (2, '_startingCurrent',  gettext('_Starting Current')),
            (3, '_currentIncrement', gettext('Current _Increment')),
            (4, '_maxCurrent',       gettext('_Maximum Current')))

        for row, name, labelText in data:
            entry, box = createNumberEntryWithUnit(gettext('mA'))

            entry.set_text(str(getattr(self, name)))
            entry.connect(
                'focus-out-event', self._handleFocusOutEvent, name)
            entry.connect(
                'key-press-event', self._handleSpecialKeyPresses, name)
            setattr(self, name + 'Entry', entry)

            label = createMnemonicLabel(entry, '\t' + labelText)

            table.attach(label, 0, 1, row, row + 1)
            table.attach(box,   1, 2, row, row + 1)

            self._currentSeriesWidgets.append(label)
            self._currentSeriesWidgets.append(box)
コード例 #2
0
ファイル: parameters.py プロジェクト: FabianGentner/NOSE
    def _createSingleCurrentWidgets(self, table):
        """
        Creates the radio button for single current mode and the entry for the
        current and adds them to the given table.
        """
        self._singleCurrentRadioButton = gtk.RadioButton(
            None,
            gettext('Use _a Single Heating Current'),
            use_underline=True)
        # The signal handler is connected to the current series radio button.

        entry, box = createNumberEntryWithUnit(gettext('mA'))
        entry.set_text(str(self._singleCurrent))
        entry.connect(
            'focus-out-event', self._handleFocusOutEvent, '_singleCurrent')
        entry.connect(
            'key-press-event', self._handleSpecialKeyPresses, '_singleCurrent')
        box.set_sensitive(False)

        table.attach(
            alignLeft(self._singleCurrentRadioButton), 0, 1, 0, 1, yoptions=0)
        table.attach(box, 1, 2, 0, 1)

        self._singleCurrentEntry = entry
        self._singleCurrentWidgets = [box]
コード例 #3
0
ファイル: dialog.py プロジェクト: FabianGentner/NOSE
    def _createStatusBar(self):
        """
        Creates the status bar shown at the very bottom of the window.
        """
        pro = self._progressWidgetWrapper.handler

        self._progressBar = gtk.ProgressBar()
        self._progressBar.set_no_show_all(True)

        self._statusLabel = gtk.Label()
        self._statusLabel.set_alignment(0.0, 0.5)

        textNoWait = gettext('%(action)s')
        text = textNoWait + gettext(': %(stageTimeLeft)s remaining')

        pro.addStageProgressBar(self._progressBar, showText=False)
        pro.addProgressLabel(self._statusLabel, text, textNoWait)

        self._statusBar = gtk.HBox()
        self._statusBar.set_spacing(widgets.PANEL_BORDER_WIDTH)
        self._statusBar.pack_start(self._statusLabel)
        self._statusBar.pack_start(self._progressBar, expand=False)

        self._mainBox.pack_start(gtk.HSeparator(), expand=False)
        self._mainBox.pack_start(self._statusBar, expand=False)
コード例 #4
0
ファイル: systemprops.py プロジェクト: FabianGentner/NOSE
    def _createTable(self):
        table = gtk.Table(rows=7, columns=2)
        table.set_border_width(PANEL_BORDER_WIDTH)

        thresholdsCaption = gtk.Label()
        thresholdsCaption.set_markup(gettext('<b>Safe Limits</b>'))
        table.attach(alignLeft(thresholdsCaption), 0, 2, 0, 1)

        currentsCaption = gtk.Label()
        currentsCaption.set_markup(gettext('<b>Heating Currents</b>'))
        table.attach(alignLeft(currentsCaption), 0, 2, 4, 5)

        for text, unit, name, index in DATA:
            default = getattr(self._system, name)
            entry, box = createNumberEntryWithUnit(unit, default)
            label = createMnemonicLabel(entry, text)

            setattr(self, name, default)
            setattr(self, name + 'Entry', entry)

            entry.connect('focus-out-event', self._handleParameterChange, name)
            entry.connect('key-press-event', self._handleSpecialKeys, name)

            table.attach(label, 0, 1, index, index + 1)
            table.attach(box,   1, 2, index, index + 1)

        table.set_col_spacing(0, LABEL_WIDGET_SPACING)
        table.set_row_spacing(3, PANEL_SPACING)

        tableAlignment = gtk.Alignment()
        tableAlignment.add(table)

        self._mainBox.pack_start(tableAlignment)
コード例 #5
0
ファイル: dart.py プロジェクト: abelard2008/overlog
 def parse_test(self, x1):
     x2 = x1.getElementsByTagName("name")[0]
     self.name = self.sub_variables(gettext(x2.childNodes))
     x = x1.getElementsByTagName("outdir")
     if x:
         x2 = x[0]
         self.outdir = self.sub_variables(gettext(x2.childNodes))
コード例 #6
0
ファイル: actions.py プロジェクト: FabianGentner/NOSE
def createActionGroup(mainWindowHandler):
    """
    Creates a :class:`gtk.ActionGroup` object with the actions that are
    required to create the main window's menu. The actions that are created
    are added to ``mainWindowHandler._actions``.
    """
    actionGroup = gtk.ActionGroup('actions')

    # FILE MENU
    _makeMenuAction('file', gettext('_File'), actionGroup)
    QuitAction(mainWindowHandler, actionGroup)

    # SYSTEM MENU
    _makeMenuAction('system', gettext('_System'), actionGroup)
    EditSystemProperiesAction(mainWindowHandler, actionGroup)

    # CALIBRATION MENU
    _makeMenuAction('calibrate', gettext('_Calibrate'), actionGroup)
    ShowCalibrationDialogAction(mainWindowHandler, actionGroup)
    LoadCalibrationDataAction(mainWindowHandler, actionGroup)
    SaveCalibrationDataAction(mainWindowHandler, actionGroup)
    SaveCalibrationDataAsAction(mainWindowHandler, actionGroup)
    ClearCalibrationDataAction(mainWindowHandler, actionGroup)

    import gui.debug
    gui.debug.createDebugActions(mainWindowHandler, actionGroup)

    return actionGroup
コード例 #7
0
ファイル: entry.py プロジェクト: FabianGentner/NOSE
    def _createWidgets(self, buttonStock, useLabel):
        """
        Creates the widgets this class is responsible for.
        """
        unit = gettext('°C')
        self._entry, unitBox = widgets.createNumberEntryWithUnit(unit)
        self._entry.connect('changed', util.WeakMethod(self._textChanged))

        if useLabel:
            label = gtk.Label(gettext('_Temperature Measurement'))
            label.set_alignment(1.0, 0.5)
            label.set_use_underline(True)
            label.set_mnemonic_widget(self._entry)

            self._box = gtk.HBox()
            self._box.set_spacing(widgets.SPACING['wide'])
            self._box.pack_start(label)
            self._box.pack_start(unitBox)
        else:
            self._box = unitBox

        self._box.set_sensitive(False)

        self._button = gtk.Button(stock=buttonStock)
        self._button.set_sensitive(False)
        self._button.connect('clicked', util.WeakMethod(self._buttonClicked))

        hierarchyChanged = util.WeakMethod(self._hierarchyChanged)
        self._box.connect('hierarchy-changed', hierarchyChanged)
        self._button.connect('hierarchy-changed', hierarchyChanged)
コード例 #8
0
ファイル: progress.py プロジェクト: FabianGentner/NOSE
def makeList(currents):
    si = tuple(util.stringFromFloat(i, 2, True) for i in currents)
    if len(currents) == 1:
        return si[0]
    if len(currents) == 2:
        return si[0] + gettext(' and ') + si[1]
    else:
        return gettext(', ').join(si[:-1]) + gettext(', and ') + si[-1]
コード例 #9
0
ファイル: progress.py プロジェクト: FabianGentner/NOSE
 def addDefaultStageProgressLabel(self, label):
     """
     A convenience method that calls :meth:`addProgressLabel` with
     a suitable template for a label that is to show the progress of
     the ongoing calibration stage.
     """
     self.addProgressLabel(
         label,
         gettext(u'%(action)s \u2014 %(stageTimeLeft)s remaining'),
         gettext(u'%(action)s'))
コード例 #10
0
ファイル: progress.py プロジェクト: FabianGentner/NOSE
 def addDefaultTotalProgressLabel(self, label):
     """
     A convenience method that calls :meth:`addProgressLabel` with
     a suitable template for a label that is to show the calibration
     procedure's total progress.
     """
     self.addProgressLabel(
         label,
         gettext('Total time remaining: %(totalTimeLeft)s'),
         gettext('%(emptyString)s'))
コード例 #11
0
ファイル: dart.py プロジェクト: abelard2008/overlog
 def parse_variables(self, x1):
     variables = {}
     for i in range(len(x1.childNodes)):
         n = x1.childNodes[i]
         if n.nodeType == n.ELEMENT_NODE and n.nodeName == "name":
             name = gettext(n.childNodes)
             m = x1.childNodes[i + 1]
             assert m.nodeName == "value"
             value = gettext(m.childNodes)
             variables[name] = value
             i += 1
     return variables
コード例 #12
0
ファイル: dart.py プロジェクト: abelard2008/overlog
 def parse_topology(self, x1):
     x2 = x1.getElementsByTagName("project")[0]
     self.pid = self.sub_variables(gettext(x2.childNodes))
     x2 = x1.getElementsByTagName("experiment")[0]
     self.eid = self.sub_variables(gettext(x2.childNodes))
     x2 = x1.getElementsByTagName("nsfile")[0]
     self.nsfile = self.sub_variables(gettext(x2.childNodes))
     if not os.path.exists(self.nsfile):
         raise "ns-2 file %s does not exist" % self.nsfile
     x2 = x1.getElementsByTagName("eipsfile")[0]
     self.eipsfile = self.sub_variables(gettext(x2.childNodes))
     x2 = x1.getElementsByTagName("iipsfile")[0]
     self.iipsfile = self.sub_variables(gettext(x2.childNodes))
コード例 #13
0
ファイル: dart.py プロジェクト: abelard2008/overlog
 def parse_nodegroup(self, x2):
     e = {}
     x3 = x2.getElementsByTagName("nodes")[0]
     e["vnns"] = self.parse_nodes(self.sub_variables(gettext(
         x3.childNodes)))
     x3 = x2.getElementsByTagName("cmd")[0]
     e["cmd"] = self.dart_dir_sub(self.sub_variables(gettext(
         x3.childNodes)))
     if x3.hasAttribute("time"):
         e["time"] = int(self.dart_getAttribute(x3, "time"))
     else:
         e["time"] = 0
     return e
コード例 #14
0
ファイル: topology.py プロジェクト: abelard2008/overlog
 def parse(self, pathname):
     doc = xml.dom.minidom.parse(pathname)
     x1 = doc.getElementsByTagName("topologies")[0]
     for x2 in x1.getElementsByTagName("topology"):
         t = {}
         x3 = x2.getElementsByTagName("name")[0] 
         t["name"] = gettext(x3.childNodes)
         x3 = x2.getElementsByTagName("nrouters")[0] 
         t["nrouters"] = int(gettext(x3.childNodes))
         x3 = x2.getElementsByTagName("nhosts")[0] 
         t["nhosts"] = int(gettext(x3.childNodes))
         x3 = x2.getElementsByTagName("ns2")[0] 
         t["ns2"] = gettext(x3.childNodes)
         self.topologies.append(t)
コード例 #15
0
ファイル: dart.py プロジェクト: abelard2008/overlog
 def parse_commonfiles(self, x1):
     for x2 in x1.getElementsByTagName("dir"):
         x3 = x2.getElementsByTagName("src")[0]
         src = self.sub_variables(gettext(x3.childNodes))
         type = self.xml_read_type(x3)
         x3 = x2.getElementsByTagName("dst")[0]
         dst = self.sub_variables(self.dart_dir_sub(gettext(x3.childNodes)))
         self.commondirs[src] = {"dst": dst, "type": type}
     for x2 in x1.getElementsByTagName("file"):
         x3 = x2.getElementsByTagName("src")[0]
         src = self.sub_variables(gettext(x3.childNodes))
         type = self.xml_read_type(x3)
         x3 = x2.getElementsByTagName("dst")[0]
         dst = self.sub_variables(self.dart_dir_sub(gettext(x3.childNodes)))
         self.commonfiles[src] = {"dst": dst, "type": type}
コード例 #16
0
ファイル: movement.py プロジェクト: ssw-parser/SSW_Parser
    def __init__(self, cpt, unit):
        Item.__init__(self)
        cnode = cpt.getElementsByTagName("type")[0]
        self.type = gettext(cnode.childNodes)
        if self.type != "Torso-Mounted Cockpit":
            self.console = cnode.attributes["commandconsole"].value
        else:
            self.console = "FALSE"
        self.c_weight = 0
        self.unit = unit  # Reference to parent unit

        # Check for legal cockpit type, save data
        ident = False
        for i in COCKPIT:
            if (i[0] == self.type):
                ident = True
                self.wgt = i[1]
                self.r_level = i[2]
                self.cost = i[3]
        if not ident:
            error_exit((self.type))

        # Hack: Add console weight
        if self.console == "TRUE":
            self.c_weight = 3
コード例 #17
0
ファイル: movement.py プロジェクト: ssw-parser/SSW_Parser
    def __init__(self, gyr, etype, erating):
        Item.__init__(self)
        # We need engine info for calculations
        self.gtype = gettext(gyr.childNodes)
        self.g_base = int(gyr.attributes["techbase"].value)

        # Check for legal gyro type, save data
        ident = False
        for i in GYRO:
            if (i[0] == self.gtype and i[1] == self.g_base):
                ident = True
                self.gyro_bv = i[2]
                gweightm = i[3]
                self.r_level = i[4]
                self.cost = i[5]
        if not ident:
            error_exit((self.gtype, self.g_base))

        # Calculate weight
        rating = erating
        # Hack: Make sure Primitive Engines get right gyro weight
        if etype == "Primitive Fusion Engine":
            rating *= 1.2
            rating = ceil_5(rating)
        base_weight = ceil(float(rating) / 100.0)
        self.weight = gweightm * base_weight
コード例 #18
0
ファイル: movement.py プロジェクト: ssw-parser/SSW_Parser
    def __init__(self, eng, unit):
        Item.__init__(self)
        self.erating = int(eng.attributes["rating"].value)
        self.e_base = int(eng.attributes["techbase"].value)
        self.etype = gettext(eng.childNodes)
        self.speed = self.erating / unit.weight
        self.unit = unit  # Reference to parent unit
        # A note on primitive engines:
        # It seems like using engine rating directly does give
        # the right speed, even if rules says otherwise
        # This looks like an internal SSW issue, so
        # assume that the weight of these engines are incorrect

        # Check for legal engine type, save data
        ident = False
        for i in ENGINE:
            if (i[0] == self.etype and i[1] == self.e_base):
                ident = True
                self.eng_bv = i[2]
                if self.unit.type == "CV":
                    self.eweight = i[3](ceil_5(self.erating -
                                               self.get_suspension_factor()))
                else:
                    self.eweight = i[3](ceil_5(self.erating))
                self.r_level = i[4]
                self.cost = i[5]
                self.short = i[6]
        if not ident:
            error_exit((self.etype, self.e_base))
コード例 #19
0
ファイル: debug.py プロジェクト: FabianGentner/NOSE
 def __init__(self, system):
     self.simulation = system._interface
     self.window = gtk.Window()
     self.window.set_size_request(250, 100)
     self.window.set_title(gettext('Magic Pyrometer'))
     self.label = gtk.Label()
     self.window.add(self.label)
     gobject.timeout_add(250, self._update)
コード例 #20
0
ファイル: actions.py プロジェクト: FabianGentner/NOSE
 def run(self):
     parent = self.mainWindowHandler._window
     message = gettext('Really clear the calibration data?')
     if widgets.askUser(parent, message):
         # TODO: Should not create a new object!
         #       Actually, should create a new object!
         newCD = ops.calibration.data.CalibrationData()
         self.system.calibrationData = newCD
コード例 #21
0
ファイル: systemprops.py プロジェクト: FabianGentner/NOSE
    def _createWindow(self):
        self._window = gtk.Window()
        self._window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
        self._window.set_title(gettext('Production System Properties'))
        self._window.connect('delete_event', self._delete)

        self._mainBox = gtk.VBox()

        self._window.add(self._mainBox)
コード例 #22
0
ファイル: functions.py プロジェクト: FabianGentner/NOSE
    def _updateTable(self, calibrationData):
        """
        Updates the table containing the functions. `calibrationData` needs to
        be complete.
        """
        variables = (
            gettext('<i>T</i>'), gettext('<i>I</i>'), gettext('<i>U</i>'))

        for i in xrange(3):
            prefix = '_' + self.FUNCTIONS[i]
            nameLabel = getattr(self, prefix + 'NameLabel')
            alignment = getattr(self, prefix + 'NameLabelAlignment')
            functionLabel = getattr(self, prefix + 'FunctionLabel')

            c = getattr(calibrationData, self.FUNCTIONS[i] + 'Coefficients')
            functionLabel.set_markup(self._formatPolynomial(c, variables[i]))

            self._adjustNameLabelPosition(nameLabel, alignment, functionLabel)
コード例 #23
0
ファイル: debug.py プロジェクト: FabianGentner/NOSE
def createDebugActions(mainWindowHandler, actionGroup):
    _makeMenuAction('debug', gettext('_Debug'), actionGroup)
    MagicCalibrationAction(mainWindowHandler, actionGroup)
    FakeCalibrationAction(mainWindowHandler, actionGroup)
    ShowMagicPyrometerAction(mainWindowHandler, actionGroup)
    SetCalibrationSpeedNormalAction(mainWindowHandler, actionGroup)
    SetCalibrationSpeed5Action(mainWindowHandler, actionGroup)
    SetCalibrationSpeed10Action(mainWindowHandler, actionGroup)
    SetCalibrationSpeed25Action(mainWindowHandler, actionGroup)
    CollectGarbageAction(mainWindowHandler, actionGroup)
コード例 #24
0
ファイル: dialog.py プロジェクト: FabianGentner/NOSE
 def _confirmAbort(self):
     """
     Shows a dialog that asks the user to confirm the abortion of the
     calibration procedure, and aborts it if the reply is affirmative.
     """
     answer = widgets.askUser(self._window, gettext(
         'Are you sure you want to abort the calibration procedure?'))
     if answer:
         self._system.abortCalibration()
     return answer
コード例 #25
0
ファイル: dialog.py プロジェクト: FabianGentner/NOSE
    def _createWindow(self):
        """
        Creates the dialog's :class:`gtk.Window` and :attr:`_mainBox`.
        """
        self._window = gtk.Window()
        self._window.set_title(gettext('Calibration'))
        self._window.set_default_size(*DIALOG_SIZE)
        self._window.connect('delete_event', util.WeakMethod(self._close))

        self._mainBox = gtk.VBox()

        self._window.add(self._mainBox)
コード例 #26
0
ファイル: gear.py プロジェクト: ssw-parser/SSW_Parser
    def __init__(self, node):
        self.name = get_child_data(node, "name")
        self.typ = get_child_data(node, "type")
        self.rear = False
        self.turret = False

        # Extract tonnage for variable weight gear
        tons = node.getElementsByTagName("tons")
        if (tons):
            self.wgt = float(gettext(tons[0].childNodes))
        # Handle no info, we use 0.0 to indicate we get the weight from tables
        else:
            self.wgt = 0.0

        # Handle location info
        lnd = node.getElementsByTagName("location")
        # Normal case, no split
        if (lnd):
            lnode = lnd[0]
            self.loc = gettext(lnode.childNodes)
            if self.loc == "Turret":
                self.turret = True
        # Split location
        else:
            self.loc = []
        lnd = node.getElementsByTagName("splitlocation")
        for lnode in lnd:
            lnr = int(lnode.attributes["number"].value)
            loc_temp = gettext(lnode.childNodes)
            self.loc.append((loc_temp, lnr))
        # Check for rear-mounted stuff
        if self.name[0:4] == "(R) ":
            self.rear = True
            self.name = self.name[4:]
        # Also check if turret-mounted
        elif self.name[0:4] == "(T) ":
            self.turret = True
            self.name = self.name[4:]
コード例 #27
0
ファイル: parameters.py プロジェクト: FabianGentner/NOSE
    def _createCurrentSeriesRadioButton(self, table):
        """
        Creates the radio button for current series mode and adds it to the
        given table.
        """
        self._currentSeriesRadioButton = gtk.RadioButton(
            self._singleCurrentRadioButton,
            gettext('Use a S_eries of Heating Currents'),
            use_underline=True)
        self._currentSeriesRadioButton.set_active(True)
        self._currentSeriesRadioButton.connect(
            'toggled', self._handleRadioToggle)

        table.attach(alignLeft(self._currentSeriesRadioButton), 0, 2, 1, 2)
コード例 #28
0
ファイル: dialog.py プロジェクト: FabianGentner/NOSE
    def _createButtonBar(self):
        """
        Creates the button bar shown at the bottom of the window.
        """
        self._closeButton = gtk.Button(stock=gtk.STOCK_CLOSE)
        self._closeButton.connect('clicked', util.WeakMethod(self._close))

        self._runCalibrationButton = widgets.createHalfStockButton(
            gtk.STOCK_EXECUTE, gettext('_Run Calibration'))
        self._runCalibrationButton.connect('clicked',
            util.WeakMethod(self._runCalibrationClicked))
        self._runCalibrationButton.show()
        self._runCalibrationButton.set_no_show_all(True)

        self._abortCalibrationButton = widgets.createHalfStockButton(
            gtk.STOCK_CANCEL, gettext('Abort Calibration'))
        self._abortCalibrationButton.connect('clicked',
            util.WeakMethod(self._abortCalibrationClicked))
        self._abortCalibrationButton.set_no_show_all(True)

        calibrationButtonBox = widgets.createButtonBox(
            self._runCalibrationButton, self._abortCalibrationButton)

        applyButton = self._temperatureEntryHandler.button

        temperatureBoxAlignment = gtk.Alignment(
            xalign=1.0, yalign=0.5, xscale=0.0)
        temperatureBoxAlignment.add(self._temperatureEntryHandler.box)

        buttonBarBox = gtk.HBox()
        buttonBarBox.pack_start(calibrationButtonBox, expand=False)
        buttonBarBox.pack_start(temperatureBoxAlignment, expand=True)
        buttonBarBox.pack_end(widgets.createButtonBox(
            applyButton, self._closeButton), expand=False)


        self._mainBox.pack_start(buttonBarBox, expand=False)
コード例 #29
0
ファイル: dart.py プロジェクト: abelard2008/overlog
 def parse_faultgroup(self, x2):
     e = {}
     x3 = x2.getElementsByTagName("nodes")[0]
     e["vnns"] = self.parse_nodes(self.sub_variables(gettext(
         x3.childNodes)))
     nodefaults = x2.getElementsByTagName("nodefault")
     if not nodefaults:
         raise "Must specify a fault of some type"
     if len(nodefaults) > 1:
         raise "Only one fault per faultgroup"
     if nodefaults:
         nodefault = nodefaults[0]
         e["type"] = "node"
         e["subtype"] = self.dart_getAttribute(nodefaults[0], "type")
         e["time"] = int(self.dart_getAttribute(nodefaults[0], "time"))
     return e
コード例 #30
0
ファイル: debug.py プロジェクト: FabianGentner/NOSE
    def run(self):
        # TODO: Move body elsewhere?
        gc.collect()
        garbage = gc.garbage

        if garbage:
            txt = gettext('The following unreachable objects cannot be freed:')
            for g in garbage:
                txt += '\n%s\n' % g
            dialog = gtk.MessageDialog(
                mainWindowHandler.window,
                0,
                gtk.MESSAGE_WARNING,
                gtk.BUTTONS_CLOSE,
                txt)
            dialog.run()
            dialog.destroy()
コード例 #31
0
ファイル: progress.py プロジェクト: FabianGentner/NOSE
    def _createWidgets(self):
        self.handler.widget.show_all()
        self.handler.widget.hide()
        self.handler.widget.set_no_show_all(True)

        self._noCalibrationLabel = gtk.Label(
            gettext('The production system is not being calibrated.'))
        self._noCalibrationLabel.set_line_wrap(True)
        self._noCalibrationLabel.set_justify(gtk.JUSTIFY_CENTER)
        self._noCalibrationLabel.show()
        self._noCalibrationLabel.set_no_show_all(True)

        # TODO: Use predefined container from widgets?
        self._widget = gtk.HBox()
        self._widget.set_border_width(12)
        self._widget.pack_start(self.handler.widget)
        self._widget.pack_start(self._noCalibrationLabel)
        self._widget.show()
コード例 #32
0
ファイル: functions.py プロジェクト: FabianGentner/NOSE
    def _createWidgets(self):
        """
        Creates the widgets this class is responsible for.
        """
        widgets = (
            self._createFunctionTable(),
            gtk.Label(gettext('The production system is not calibrated.')))

        self._widget = createPanel(*widgets, yalign=0.5, xscale=1.0)
        self._widget.show_all()

        # The widget needs to have a reference to this instance to prevent it
        # from being reclaimed as garbage while the widget is still alive.
        self._widget.functionWidgetHandler = self

        for w in widgets:
            w.set_no_show_all(True)

        self._functionTable, self._notCalibratedLabel = widgets
コード例 #33
0
ファイル: movement.py プロジェクト: ssw-parser/SSW_Parser
    def __init__(self, enh, weight, eng_rating):
        Item.__init__(self)
        # Save engine weight
        self.eng_rating = eng_rating
        if enh is None:
            self.etb = 2
            self.enhancement = "---"
        else:
            enode = enh.getElementsByTagName("type")[0]
            self.enhancement = gettext(enode.childNodes)
            self.etb = int(enh.attributes["techbase"].value)

        # Check for legal enhancement type, save data
        ident = False
        for i in ENHANCEMENT:
            if (i[0] == self.enhancement and i[1] == self.etb):
                ident = True
                self.enhweight = i[2](weight)
        if not ident:
            error_exit((self.enhancement, self.etb))
コード例 #34
0
ファイル: parameters.py プロジェクト: FabianGentner/NOSE
    def _createUsedCurrentsComboBox(self, table):
        """
        Creates the combo box used to specify whether currents with existing
        measurements should be skipped and the associated label, and adds
        them to the given table.
        """
        self._usedCurrentsComboBox = gtk.combo_box_new_text()
        self._usedCurrentsComboBox.append_text('Skip')
        self._usedCurrentsComboBox.append_text('Replace Measurements')
        self._usedCurrentsComboBox.set_active(0)

        usedCurrentsLabel = createMnemonicLabel(
            self._usedCurrentsComboBox,
            '\t' + gettext('_Previously Used Currents'))

        table.attach(usedCurrentsLabel,          0, 1, 5, 6)
        table.attach(self._usedCurrentsComboBox, 1, 2, 5, 6)

        self._currentSeriesWidgets.append(usedCurrentsLabel)
        self._currentSeriesWidgets.append(self._usedCurrentsComboBox)
コード例 #35
0
ファイル: io.py プロジェクト: FabianGentner/NOSE
def _addFileFilters(chooser, type):
    """
    Creates two :class:`gtk.FileFilters` -- one that matches all files,
    and one that matches a known type of files -- and adds them to the given
    :class:`gtk.FileChooserDialog`. ``type`` must be one of the file types
    listed in :data:`FILE_TYPES`, where this function looks up a human-readable
    description for that type of file and its extension.
    """
    name, extension, module = FILE_TYPES[type]
    pattern = "*." + extension

    filterAll = gtk.FileFilter()
    filterAll.set_name(gettext("All Files"))
    filterAll.add_pattern("*")
    chooser.add_filter(filterAll)

    filterMatching = gtk.FileFilter()
    filterMatching.set_name("%s (%s)" % (name, pattern))
    filterMatching.add_pattern(pattern)
    chooser.add_filter(filterMatching)
    chooser.set_filter(filterMatching)
コード例 #36
0
ファイル: jump.py プロジェクト: ssw-parser/SSW_Parser
    def __init__(self, jets, weight):
        Item.__init__(self)
        self.weight = weight  # Mech weight, not JJ weight
        # Handle default
        if jets is None:
            self.jump = 0
            self.jjtype = ""
            self.r_level = 0
        else:
            self.jump = int(jets.attributes["number"].value)
            jnode = jets.getElementsByTagName("type")[0]
            self.jjtype = gettext(jnode.childNodes)

        # Check for legal jump-jet type, if jump-jets are mounted, save data
        if self.jump > 0:
            ident = False
            for i in JUMP_JET:
                if i[0] == self.jjtype:
                    ident = True
                    self.heat = i[1]
                    self.r_level = i[2]
                    self.cost = i[3]
            if not ident:
                error_exit(self.jjtype)
コード例 #37
0
ファイル: dart.py プロジェクト: abelard2008/overlog
 def parse_script(self, x1):
     x2 = x1.getElementsByTagName("script")[0]
     script = self.sub_variables(self.dart_dir_sub(gettext(x2.childNodes)))
     return script
コード例 #38
0
ファイル: charts.py プロジェクト: FabianGentner/NOSE

###############################################################################
# CONSTANTS                                                                   #
###############################################################################

#: The minimum size of the charts in pixels, as a tuple
#: :samp:`({width}, {height})`.
CHART_SIZE = (400, 330)

#: A tuple that lists the text of the dimension labels for heating current,
#: heating temperature, and temperature sensor voltage. Strings of the form
#: :samp:`'{numerator} / {denominator}'` are displayed as a proper fraction.
#: Pango Markup Language tags are supported.
DIMENSION_LABEL_TEXTS = (
    gettext('<i>I</i> / mA'),
    gettext('<i>T</i> / °C'),
    gettext('<i>U</i> / V'))

#: A tuple that lists the colors used for the graphs that show heating
#: current, heating temperature, and temperature sensor voltage, as
#: X11 color names (e.g. ``'blanched almond'``) or hexadecimal strings
#: (e.g. ``'#FFEBCD'``).
#:
#: If these colors are changed, the captions need to be adjusted as well.
COLORS = ('orange', 'red', 'blue')

#: A tuple of the captions used for the measurements chart, temperature chart,
#: and current chart if the estimation function could be fitted.
#: Pango Markup Language tags are supported.
COMPLETE_CAPTIONS = (