示例#1
0
	def choose_your_destiny(self, src, attachments, current_text, current_count):
		current_text = current_text.replace('(', '').replace(')','')
		fcd = hildon.FileChooserDialog(self.window, action=gtk.FILE_CHOOSER_ACTION_SAVE)
		fcd.set_transient_for(self.window)
		if os.path.isdir("/home/user/MyDocs/"):
			fcd.set_current_folder("/home/user/MyDocs/")
		fcd.set_default_response(gtk.RESPONSE_OK)
		if current_count == 1:
			fn = current_text
			fcd.set_current_name(fn)
			fcd.set_title(gettext.ldgettext('hildon-fm', 'sfil_ti_save_file'))
		else:
			strng = 'sfil_va_number_of_objects_attachment'
			txt = gettext.ldngettext('hildon-fm',strng, strng, current_count) % current_count
			fcd.set_property('save-multiple', txt)
			fcd.set_title(gettext.ldgettext('hildon-fm', 'sfil_ti_save_objects_files'))
		ret = fcd.run()
		cur_folder = fcd.get_current_folder_uri()
		cur_uri = fcd.get_uri()
		fcd.destroy()
		if ret == gtk.RESPONSE_OK:
			dst = cur_uri.replace('file://', '')
			if current_count == 1:
				# dst is fullpath + fn here
				srcfn = "%s/%s" % (src, fn)
				self.copy_file(srcfn, dst)
			else:
				# dst is only fullpath here
				files = current_text.split(',')
				for fn in files:
					dstfn = "%s/%s" % (dst, fn)
					srcfn = "%s/%s" % (src, fn)
					self.copy_file(srcfn, dstfn)
#

from pyanaconda import iutil
import sys
import os
from pyanaconda.storage.errors import DasdFormatError
from pyanaconda.storage.devices import deviceNameToDiskByPath
from pyanaconda.constants import *
from pyanaconda.flags import flags

import logging
log = logging.getLogger("anaconda")

import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)

def getDasdPorts():
    """ Return comma delimited string of valid DASD ports. """
    ports = []

    f = open("/proc/dasd/devices", "r")
    lines = map(lambda x: x.strip(), f.readlines())
    f.close()

    for line in lines:
        if "unknown" in line:
            continue

        if "(FBA )" in line or "(ECKD)" in line:
            ports.append(line.split('(')[0])
示例#3
0
#

import fcntl
import ctypes
import os
from blivet.errors import DasdFormatError
from blivet.devices import deviceNameToDiskByPath
from blivet import util
from blivet import arch

import logging
log = logging.getLogger("blivet")

import gettext
_ = lambda x: gettext.ldgettext("blivet", x)
P_ = lambda x, y, z: gettext.ldngettext("blivet", x, y, z)

# ioctl crap that the fcntl module should really do for us...
_IOC_NRBITS = 8
_IOC_TYPEBITS = 8
_IOC_SIZEBITS = 14
_IOC_DIRBITS = 2

_IOC_NRMASK = ((1 << _IOC_NRBITS)-1)
_IOC_TYPEMASK = ((1 << _IOC_TYPEBITS)-1)
_IOC_SIZEMASK = ((1 << _IOC_SIZEBITS)-1)
_IOC_DIRMASK = ((1 << _IOC_DIRBITS)-1)

_IOC_NRSHIFT = 0
_IOC_TYPESHIFT = (_IOC_NRSHIFT+_IOC_NRBITS)
_IOC_SIZESHIFT = (_IOC_TYPESHIFT+_IOC_TYPEBITS)
示例#4
0
import iutil
import isys
import sys
import os
from storage.errors import DasdFormatError
from storage.devices import deviceNameToDiskByPath
from constants import *
from flags import flags
from baseudev import udev_trigger

import logging
log = logging.getLogger("anaconda")

import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)


class DASD:
    """ Controlling class for DASD interaction before the storage code in
        anaconda has initialized.

        The DASD class can determine if any DASD devices on the system are
        unformatted and can perform a dasdfmt on them.
    """
    def __init__(self):
        self._dasdlist = []
        self._ldldasdlist = []
        self._devices = []  # list of DASDDevice objects
        self.totalCylinders = 0
        self._completedCylinders = 0.0
示例#5
0
文件: dasd.py 项目: fabiand/blivet
#
# Red Hat Author(s): Samantha N. Bueno
#

import os
from blivet.errors import DasdFormatError
from blivet.devices import deviceNameToDiskByPath
from blivet import util
from blivet import arch

import logging
log = logging.getLogger("blivet")

import gettext
_ = lambda x: gettext.ldgettext("blivet", x)
P_ = lambda x, y, z: gettext.ldngettext("blivet", x, y, z)

def get_dasd_ports():
    """ Return comma delimited string of valid DASD ports. """
    ports = []

    with open("/proc/dasd/devices", "r") as f:
        lines = (line.strip() for line in f.readlines())

    for line in lines:
        if "unknown" in line:
            continue

        if "(FBA )" in line or "(ECKD)" in line:
            ports.append(line.split('(')[0])
示例#6
0
 def update_event(self, inp=-1):
     self.set_output_val(
         0,
         gettext.ldngettext(self.input(0), self.input(1), self.input(2),
                            self.input(3)))