コード例 #1
0
# encoding: utf-8

from yast import import_module
import_module('UI')
from yast import *
class IntField1Client:
    def main(self):
      UI.OpenDialog(
        VBox(
          IntField("Percentage:", 0, 100, 50),
          PushButton(Opt("default"), "&OK")
        )
      )
      UI.UserInput()
      UI.CloseDialog()


IntField1Client().main()

コード例 #2
0
# encoding: utf-8

from yast import import_module
import_module('UI')
from yast import *


class ComboBoxSetInputMaxLengthClient:
    def main(self):

        UI.OpenDialog(
            VBox(
                ComboBox(Id("input"), Opt("editable"), "Combo Box",
                         ["pizza", "pasta", "pronta"]),
                IntField(Id("field"), "Limit characters to...", -1, 100, -1),
                PushButton(Id("butt"), "limit input"),
                PushButton(Id("exitButton"), "Exit")))

        ret = None
        ret = UI.UserInput()

        while (ret != "exitButton"):
            chars = UI.QueryWidget(Id("field"), "Value")
            UI.ChangeWidget("input", "InputMaxLength", chars)

            ret = UI.UserInput()

        UI.CloseDialog()


ComboBoxSetInputMaxLengthClient().main()
コード例 #3
0
# encoding: utf-8

from yast import import_module
import_module('Directory')
import_module('UI')
from yast import *


class TimezoneSelectorClient:
    def main(self):

        # Build a dialog with a "special" widget - one that may not be supported
        # by all UIs.

        examples = {
            "Europe/Amsterdam": "Netherlands",
            "Europe/Athens": "Greece",
            "Europe/Berlin": "Germany",
            "Europe/Bratislava": "Slovakia",
            "Europe/Brussels": "Belgium",
            "Europe/Helsinki": "Finland",
            "Europe/Istanbul": "Turkey",
            # time zone
            "Europe/Kaliningrad": "Russia (Kaliningrad)",
            "Europe/Kiev": "Ukraine",
            "Europe/Malta": "Malta",
            # time zone
            "Europe/Minsk": "Belarus",
            "Europe/Monaco": "Monaco",
            # time zone
            "Europe/Moscow": "Russia (Moscow)",
# encoding: utf-8

# Full-fledged pattern selection
from yast import import_module
import_module('UI')
import_module('Pkg')
from yast import *
class PatternSelectorWizardWithPackagesClient:
    def main(self):

      # Pkg::SourceCreate( "http://dist.suse.de/install/SLP/SUSE-10.1-Beta3/i386/CD1/", "" );
      #    Pkg::SourceCreate( "file:/srv/sles-10-i386/CD1/", "" );
      Pkg.SourceStartManager(True)
      Pkg.TargetInit("/", False)



      if not UI.HasSpecialWidget("PatternSelector"):
        detailedSelection() # Fallback: Do detailed selection right away
        return


      UI.OpenDialog(
        Opt("defaultsize"),
        #Wizard("back", "", "cancel", "&Cancel", "ok", "&OK")
        Wizard(Opt("stepsEnabled"), Id("back"), "", Id("cancel"), "&Cancel", Id("ok"), "&OK")
      )


      help_text = "<p>The available software for this system is shown by category in the left column.  To view a description for an item, select it in the list.</p>" + "<p>Change the status of items by clicking on their status icon or right-click on any icon for a context menu. With the context menu you can also change the status of all items.</p>" + "<p><b>Details</b> opens the detailed software package selection where you can view and select individual software packages.</p>" + "<p>The <b>disk usage</b> display in the lower right corner shows the remaining disk space after all requested changes will have been performed. Please notice that hard disk partitions that are full or nearly full can degrade system performance and in some cases even cause serious problems. The system needs some available disk space to run properly.</p>"
コード例 #5
0
ファイル: SambaAPI.py プロジェクト: yast/yast-samba-client
from yast import Declare, ycpbuiltins, import_module
import_module('PackageSystem')
import_module('Package')
from yast import PackageSystem, Package
if not PackageSystem.Installed('samba-python3'):
    if not Package.InstallAll(['samba-python3']):
        raise ImportError("Failed to install samba python bindings samba-python3")
from samba.net import Net
from samba.credentials import Credentials
from samba.dcerpc import nbt

# Global response to net.finddc()
cldap_ret = None

def net_lookup(domain):
    global cldap_ret
    net = Net(Credentials())
    cldap_ret = net.finddc(domain=domain, flags=(nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS))

# Check if a given workgroup is a Active Directory domain and return the name
# of AD domain controler
#
# @param workgroup      the name of a workgroup to be tested
# @return string        non empty when ADS was found
@Declare('string', 'string')
def GetLDAPDS(workgroup):
    global cldap_ret
    if not cldap_ret:
        net_lookup(workgroup)
    ycpbuiltins.y2milestone('Found LDAP/DS server %s via cldap ping' % cldap_ret.pdc_dns_name if cldap_ret else '')
    return cldap_ret.pdc_dns_name if cldap_ret else ''
コード例 #6
0
from dialogs import DNS
from yast import import_module
import_module('Wizard')
import_module('UI')
import_module('Sequencer')
from yast import Wizard, UI, Sequencer, Symbol


def DNSSequence():
    aliases = {
        'dns': [(lambda: DNS().Show())],
    }

    sequence = {
        'ws_start': 'dns',
        'dns': {
            Symbol('abort'): Symbol('abort'),
            Symbol('next'): Symbol('next'),
        },
    }

    Wizard.CreateDialog()
    Wizard.SetTitleIcon('yast2-dns-manager')

    ret = Sequencer.Run(aliases, sequence)

    UI.CloseDialog()
    return ret
コード例 #7
0
ファイル: complex.py プロジェクト: yast/yast2-dns-manager
from yast import import_module
import_module('SambaToolDnsAPI')
from yast import SambaToolDnsAPI
from samba.netcmd import CommandError
from samba.dcerpc import dnsp


def dns_type_flag(rec_type):
    rtype = rec_type.upper()
    if rtype == 'A':
        record_type = dnsp.DNS_TYPE_A
    elif rtype == 'AAAA':
        record_type = dnsp.DNS_TYPE_AAAA
    elif rtype == 'PTR':
        record_type = dnsp.DNS_TYPE_PTR
    elif rtype == 'NS':
        record_type = dnsp.DNS_TYPE_NS
    elif rtype == 'CNAME':
        record_type = dnsp.DNS_TYPE_CNAME
    elif rtype == 'SOA':
        record_type = dnsp.DNS_TYPE_SOA
    elif rtype == 'MX':
        record_type = dnsp.DNS_TYPE_MX
    elif rtype == 'SRV':
        record_type = dnsp.DNS_TYPE_SRV
    elif rtype == 'TXT':
        record_type = dnsp.DNS_TYPE_TXT
    elif rtype == 'ALL':
        record_type = dnsp.DNS_TYPE_ALL
    else:
        raise Exception('Unknown type of DNS record %s' % rec_type)
コード例 #8
0
# encoding: utf-8

# NCurses SlideShow demo: No Wizard or MultiProgressMeter widget available,
# thus using simpler layout
from yast import import_module
import_module('Wizard')
import_module('UI')
from yast import *
import copy

class NCursesSlideShowDemoClient:
    def main(self):

      self.initialRpms = [600, 150, 30, 100]
      self.rpms = copy.deepcopy(self.initialRpms)
      self.totalToInstall = 0
      self.useTimeout = False
      self.currentCd = 1
      megaBytesPerSecond = 2



      #
      # ----------------------------- main() ----------------------------------
      #



      help_text = "<p>Please wait while packages are being installed.</p>"
      slide_text = "\t\t\t\t\t\t\t\t<table cellspacing=\"10\" cellpadding=\"5\">\t\t\t\t\t\t<tr>\t\t\t\t\t\t\t\t\t\t\t<td width =\"*\">\t\t\t\t\t\t\t\t\t<img src=\"/opt/kde3/share/icons/crystalsvg/128x128/apps/kscd.png\"  width=\"100\"\talign=\"left\">\t\t\t\t\t\t\t\t\t\t</td>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td width=\"*\">\t\t\t\t\t\t\t\t\t<p><font color=\"#00007f\"><b>XMMS and JuK - Powerful Jukeboxes</b></font></p>\t\t<p>XMMS is an excellent sound player for Linux. It is easy to use and supports\t\tvarious formats, including audio CDs. Test the many visualization plug-ins or\t\tdownload your favorite XMMS skins from the web.</p>\t\t\t\t\t<p>New in KDE: JuK, which classifies your MP3s and organizes your music\t\t\tcollection.</p>\t\t\t\t\t\t\t\t\t\t<p><b>Want More?</b></p>\t\t\t\t\t\t\t\t<p>The SUSE distribution features a wide range of applications for playing\t\tyour CDs and MP3 songs. For example, KsCD is a user-friendly CD player. The\t\ttrack information for most CDs is available on the Internet. Simply activate\t\tthe respective function to display the list.</p>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\t\t\t\t\t\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t</table>"
コード例 #9
0
# encoding: utf-8

# Full-fledged pattern selection
from yast import import_module

import_module('UI')
import_module('Pkg')
from yast import *


class PatternSelectorWizardWithPackagesClient:
    def main(self):

        # Pkg::SourceCreate( "http://dist.suse.de/install/SLP/SUSE-10.1-Beta3/i386/CD1/", "" );
        #    Pkg::SourceCreate( "file:/srv/sles-10-i386/CD1/", "" );
        Pkg.SourceStartManager(True)
        Pkg.TargetInit("/", False)

        if not UI.HasSpecialWidget("PatternSelector"):
            detailedSelection()  # Fallback: Do detailed selection right away
            return

        UI.OpenDialog(
            Opt("defaultsize"),
            #Wizard("back", "", "cancel", "&Cancel", "ok", "&OK")
            Wizard(Opt("stepsEnabled"), Id("back"), "", Id("cancel"),
                   "&Cancel", Id("ok"), "&OK"))

        help_text = "<p>The available software for this system is shown by category in the left column.  To view a description for an item, select it in the list.</p>" + "<p>Change the status of items by clicking on their status icon or right-click on any icon for a context menu. With the context menu you can also change the status of all items.</p>" + "<p><b>Details</b> opens the detailed software package selection where you can view and select individual software packages.</p>" + "<p>The <b>disk usage</b> display in the lower right corner shows the remaining disk space after all requested changes will have been performed. Please notice that hard disk partitions that are full or nearly full can degrade system performance and in some cases even cause serious problems. The system needs some available disk space to run properly.</p>"

        UI.WizardCommand(
コード例 #10
0
# encoding: utf-8

from yast import import_module
import_module('Wizard')
import_module('UI')
import_module('Label')
from yast import *
class WindowIDClient:
    def main(self):

      image = SCR.Read(Path(".target.byte"), "empty.gif")

      Wizard.CreateDialog()

      help = "Help"
      caption = "Penguins"
      penguins = Frame("Penguins", Image(Id("img"), image, "Penguins"))
      Wizard.SetContentsButtons(
        caption,
        penguins,
        help,
        Label.BackButton(),
        Label.NextButton(),
      )

      windowID = UI.QueryWidget(Id("img"), "WindowID")
      ycpbuiltins.y2debug("windowID=%1", windowID)

      run = ycpbuiltins.sformat("/usr/bin/xpenguins --id %1", windowID)
      # string run = sformat ("/usr/X11R6/lib/xscreensaver/xmatrix -window-id %1", windowID);
      # string run = sformat ("/usr/X11R6/lib/xscreensaver/xflame -window-id %1", windowID);
コード例 #11
0
# encoding: utf-8

# SetDesktopTitle Example
#
# Set the window title that is shown by the window manager
# Searches for the desktop file and uses its name attribute
# Note: this works in qt and gtk only, ncurses doesn't have a window title
from yast import import_module
import_module('Wizard')
from yast import *


class WizardSetDesktopTitleClient:
    def main(self):

        Wizard.CreateDialog()
        Wizard.SetContentsButtons(
            "SetDesktopTitle Example",
            Label(
                "Read 'Network Settings' from the lan.desktop file and set this string as window title"
            ),
            "Help",
            #Label.BackButton,
            #Label.NextButton
            "Back",
            "Next")

        Wizard.SetDesktopTitle("lan")  # use "lan" as an example

        Wizard.UserInput()
        Wizard.CloseDialog()
コード例 #12
0
# encoding: utf-8

from yast import import_module
import_module('Directory')
import_module('UI')
from yast import *

class TimezoneSelectorClient:
    def main(self):

      # Build a dialog with a "special" widget - one that may not be supported
      # by all UIs.

      examples = {
        "Europe/Amsterdam"    : "Netherlands",
        "Europe/Athens"       : "Greece",
        "Europe/Berlin"       : "Germany",
        "Europe/Bratislava"   : "Slovakia",
        "Europe/Brussels"     : "Belgium",
        "Europe/Helsinki"     : "Finland",
        "Europe/Istanbul"     : "Turkey",
        # time zone
        "Europe/Kaliningrad"  : "Russia (Kaliningrad)",
        "Europe/Kiev"         : "Ukraine",
        "Europe/Malta"        : "Malta",
        # time zone
        "Europe/Minsk"        : "Belarus",
        "Europe/Monaco"       : "Monaco",
        # time zone
        "Europe/Moscow"       : "Russia (Moscow)",
        "Europe/Oslo"         : "Norway",
コード例 #13
0
#
# File: mysql-server/dialog.py
# Package:      Configuration of mysql-server
# Summary:      dialog
# Authors:      Christian Kornacker <*****@*****.**>
#
# $Id: defaults.py 43761 2008-01-21 10:01:31Z ckornacker $
#

from yast import textdomain, _

textdomain('mysql')

import yast

yast.import_module('UI')
yast.import_module('Wizard')
yast.import_module('Label')
from yast import *

import Mysql

from defaults import ServerTypeSettings
from defaults import DatabaseUsageSettings
from defaults import ServerConnectionSettings
from defaults import CharacterSetSettings
from defaults import ServerFeaturesSettings
from defaults import SecuritySettings

caption = _('MySQL Server Configuration')