コード例 #1
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def BarGraph(values, labels, ID=None, opts=[]):
    """Horizontal bar graph (optional widget)

    Synopsis
    BarGraph ( list values, list labels );

    Parameters
    list values

    Optional Arguments
    list labels
    """
    from ycp import BarGraph, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(values)
        result.append(labels)
        result = tuple(result)

        return BarGraph(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #2
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def Tree(label, items, ID=None, opts=[]):
    """Scrollable tree selection

    Synopsis
    Tree ( string label );

    Parameters
    string label

    Options
    immediate  make `notify trigger immediately when the selected item changes

    Optional Arguments
    itemList items  the items contained in the tree

    """
    from ycp import Tree, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(label)
        result.append(items)
        result = tuple(result)

        return Tree(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #3
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def ButtonBox(buttons, ID=None, opts=[]):
    """Layout for push buttons that takes button order into account

    Synopsis
    ButtonBox ( term button1, term button2 );

    Parameters
    term buttons  list of PushButton items

    """
    from ycp import ButtonBox, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.extend(buttons)
        result = tuple(result)

        return ButtonBox(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #4
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def Heading(label, ID=None, opts=[]):
    """Simple static text

    Synopsis
    Heading ( string label );

    Parameters
    string label

    Options
    outputField  make the label look like an input field in read-only mode
    boldFont  use a bold font

    """
    from ycp import Heading, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(label)
        result = tuple(result)

        return Heading(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #5
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def Password(label, defaulttext=None, ID=None, opts=[]):
    """Input field

    Synopsis
    Password ( string label, string defaulttext );

    Parameters
    string label  the label describing the meaning of the entry

    Options
    shrinkable  make the input field very small

    Optional Arguments
    string defaulttext  The text contained in the text entry

    """
    from ycp import Password, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(label)
        if defaulttext is not None:
            result.append(defaulttext)
        result = tuple(result)

        return Password(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #6
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def RichText(text, ID=None, opts=[]):
    """Static text with HTML-like formatting

    Synopsis
    RichText ( string text );

    Parameters
    string text

    Options
    plainText  don't interpret text as HTML
    autoScrollDown  automatically scroll down for each text change
    shrinkable  make the widget very small

    """
    from ycp import RichText, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(text)
        result = tuple(result)

        return RichText(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #7
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def BusyIndicator(label, timeout=None, ID=None, opts=[]):
    """Graphical busy indicator

    Synopsis
    BusyIndicator ( string label, integer timeout );

    Parameters
    string label  the label describing the bar

    Optional Arguments
    integer timeout  the timeout in milliseconds until busy indicator changes to stalled state, 1000ms by default

    """
    from ycp import BusyIndicator, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(label)
        if timeout:
            result.append(timeout)
        result = tuple(result)

        return BusyIndicator(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #8
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def ReplacePoint(child, ID=None, opts=[]):
    """Pseudo widget to replace parts of a dialog

    Synopsis
    ReplacePoint ( term child );

    Parameters
    term child  the child widget
    """
    from ycp import ReplacePoint, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if len(opts) > 0:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(child)
        result = tuple(result)

        return ReplacePoint(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #9
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def PushButton(label, ID=None, opts=[]):
    """Perform action on click

    Synopsis
    PushButton ( string label );

    Parameters
    string label

    Options
    default  makes this button the dialogs default button
    helpButton  automatically shows topmost `HelpText
    okButton  assign the [OK] role to this button (see ButtonBox)
    cancelButton  assign the [Cancel] role to this button (see ButtonBox)
    applyButton  assign the [Apply] role to this button (see ButtonBox)
    customButton  override any other button role assigned to this button

    """
    from ycp import PushButton, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(label)
        result = tuple(result)

        return PushButton(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #10
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def MinSize(width, height, child):
    """Layout minimum size

    Synopsis
    MinSize ( float|integer size, float|integer size, term child );

    Parameters
    float|integer size  minimum width
    float|integer size  minimum height
    term child  The contained child widget

    """
    from ycp import MinSize
    ycp.widget_names()

    try:
        result = []
        result.append(width)
        result.append(height)
        result.append(child)
        result = tuple(result)

        return MinSize(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #11
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def DumbTab(tabs, contents, ID=None, opts=[]):
    """Simplistic tab widget that behaves like push buttons

    Synopsis
    DumbTab ( list tabs , term contents );

    Parameters
    list tabs  page headers
    term contents  page contents - usually a ReplacePoint
    """
    from ycp import DumbTab, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if len(opts) > 0:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(tabs)
        result.append(contents)
        result = tuple(result)

        return DumbTab(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #12
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def IntField(ID=None, opts=[]):
    """

    Synopsis
    IntField (  );

    Parameters

    """
    from ycp import IntField, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result = tuple(result)

        return IntField(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #13
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def Top(child, pixmap=None, ID=None, opts=[]):
    """Layout alignment

    Synopsis
    Top ( term child, string pixmap );

    Parameters
    term child  The contained child widget

    Optional Arguments
    background pixmap

    """
    from ycp import Top, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(child)
        if pixmap is not None:
            result.append(Term('BackgroundPixmap', pixmap))
        result = tuple(result)

        return Top(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #14
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def Frame(label, child, ID=None, opts=[]):
    """Frame with label

    Synopsis
    Frame ( string label, term child );

    Parameters
    string label  title to be displayed on the top left edge
    term child  the contained child widget

    """
    from ycp import Frame, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(label)
        result.append(child)
        result = tuple(result)

        return Frame(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #15
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def Node(label, expanded=False, children=[], ID=None):
    from ycp import Term
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        result.append(label)
        result.append(expanded)
        result.append(children)
        result = tuple(result)

        return Term('item', *result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #16
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def Empty():
    """

    Synopsis
    Empty (  );

    Parameters

    """
    from ycp import Term
    ycp.widget_names()

    try:
        return Term('Empty')
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #17
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def VBox(*children):
    """Generic layout: Arrange widgets vertically

    Synopsis
    VBox ( children... );

    Optional Arguments
    list children  children widgets

    """
    from ycp import VBox
    ycp.widget_names()

    try:
        return VBox(*children)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #18
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def ComboBox(label, items=[], ID=None, opts=[]):
    """drop-down list selection (optionally editable)

    Synopsis
    ComboBox ( string label, list items );

    Parameters
    string label

    Options
    editable  the user can enter any value.

    Optional Arguments
    list items  the items contained in the combo box

    """
    from ycp import ComboBox, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        result.append(label)
        options = []
        for item in items:
            if type(item) is tuple:
                options.append(Term('item', *item))
            else:
                options.append(item)
        result.append(options)
        result = tuple(result)

        return ComboBox(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #19
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def Table(header, items=[], ID=None, opts=[]):
    """Multicolumn table widget

    Synopsis
    Table ( term header, list items );

    Parameters
    term header  the headers of the columns

    Optional Arguments
    list items  the items contained in the selection box

    """
    from ycp import Table, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if ID is not None:
            result.append(Term('id', ID))
        if opts is not None:
            for opt in opts:
                result.append(Term('opt', Symbol(opt)))
        header = tuple(header)
        result.append(Term('header', *header))
        contents = []
        for item in items:
            if type(item) is list:
                contents.append(Term('item', Term('id', item[0]), *(item[1])))
            else:
                contents.append(Term('item', *item))
        result.append(contents)
        result = tuple(result)

        return Table(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #20
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def VStretch(size=None):
    """Fixed size empty space for layout

    Synopsis
    VStretch ( integer|float size );

    Optional Arguments
    integer|float size

    """
    from ycp import VStretch, Term, Symbol
    ycp.widget_names()

    try:
        result = []
        if size is not None:
            result.append(size)
        result = tuple(result)

        return VStretch(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #21
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
def HWeight(weight, child):
    """

    Synopsis
    HWeight ( integer weight, term child );

    Parameters
    integer weight  the new weight of the child widget
    term child  the child widget

    """
    from ycp import HWeight
    ycp.widget_names()

    try:
        result = []
        result.append(weight)
        result.append(child)
        result = tuple(result)

        return HWeight(*result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(1)
コード例 #22
0
ファイル: yui.py プロジェクト: dmulder/yast-py-buffer
        ret = Sequencer.Run(aliases, sequence)

        UI.CloseDialog()
        return ret


import gettext
from gettext import textdomain

textdomain('aduc')

import ycp
ycp.import_module('UI')
from ycp import *
ycp.widget_names()
import Wizard

import sys
import traceback


class DialogTop:
    @staticmethod
    def UserInput():
        while True:
            yield UI.UserInput()

    @staticmethod
    def QueryWidget(ID, symbol):
        return UI.QueryWidget(Term('id', ID), Symbol(symbol))