Example #1
0
    def __init__(self, parent):
        wal.VPanel.__init__(self, parent)
        from uc2 import libimg, libpango, libcairo, cms
        import reportlab

        data = [[_('Component'), _('Version')]]
        mark = '' if not uc2const.BUILD else ' build %s' % uc2const.BUILD
        uc_ver = '%s %s%s' % (uc2const.VERSION, uc2const.REVISION, mark)
        data.append(['Python', sys.version])
        data.append(['wxWidgets', wal.VERSION])
        data.append(['UniConvertor', uc_ver])
        data.append(['LCMS', cms.libcms.get_version()])
        data.append(['Cairo', libcairo.get_version()[0]])
        data.append(['pycairo', libcairo.get_version()[1]])
        data.append(['Pillow', libimg.get_version()])
        data.append(['ImageMagick', libimg.get_magickwand_version()[0]])
        data.append(['Pango', libpango.get_version()])
        data.append(['Reportlab', reportlab.Version])

        if not wal.IS_MSW:
            import cups
            try:
                cups.require('10.0')
            except RuntimeError as e:
                data.append(['pycups', str(e).split()[-1]])

        vp = wal.VPanel(self)
        vp.set_bg(wal.UI_COLORS['border'])
        slist = wal.ReportList(vp, data, border=False)
        vp.pack(slist, expand=True, fill=True, padding_all=1)
        self.pack(vp, expand=True, fill=True, padding_all=5)
        slist.set_column_width(0, wal.LIST_AUTOSIZE)
Example #2
0
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

import threading
import config
import cups
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gdk
from gi.repository import Gtk
import Queue

cups.require ("1.9.60")

import authconn
from debug import *
import debug
import gettext
gettext.install(domain=config.PACKAGE, localedir=config.localedir, unicode=True)


######
###### An asynchronous libcups API using IPP with a separate worker
###### thread.
######

###
### This is the worker thread.
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

import threading
import config
import cups
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gdk
from gi.repository import Gtk
import queue

cups.require("1.9.60")

import authconn
from debug import *
import debug
import gettext

gettext.install(domain=config.PACKAGE, localedir=config.localedir)


######
###### An asynchronous libcups API using IPP with a separate worker
###### thread.
######

###
import sys

from debug import *
import asyncconn
import config
import cups
import cupshelpers
import dnssdresolve
import jobviewer
import killtimer
import newprinter
import PhysicalDevice
import ppdcache
import printerproperties

cups.require ("1.9.52")

CONFIG_BUS='org.fedoraproject.Config.Printing'
CONFIG_PATH='/org/fedoraproject/Config/Printing'
CONFIG_IFACE='org.fedoraproject.Config.Printing'
CONFIG_NEWPRINTERDIALOG_IFACE=CONFIG_IFACE + ".NewPrinterDialog"
CONFIG_PRINTERPROPERTIESDIALOG_IFACE=CONFIG_IFACE + ".PrinterPropertiesDialog"
CONFIG_JOBVIEWER_IFACE=CONFIG_IFACE + ".JobViewer"

g_ppds = None
g_killtimer = None

class FetchedPPDs(GObject.GObject):
    __gsignals__ = {
        'ready': (GObject.SIGNAL_RUN_LAST, None, ()),
        'error': (GObject.SIGNAL_RUN_LAST, None,
Example #5
0
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

import cups
cups.require ("1.9.42")
import sys
from debug import *

import dbus
import dbus.glib
import dbus.service
import gobject
import time
import locale
import gettext
import cupshelpers.installdriver
from gettext import gettext as _
DOMAIN="system-config-printer"
gettext.textdomain (DOMAIN)
try:
Example #6
0
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

from debug import *
from gi.repository import Gtk
import cups
import ppdippstr
import re

cups.require ("1.9.55")

# Special IPP type
class IPPResolution(tuple):
    def __new__ (cls, values):
        cls.UNITS_BY_VAL = { cups.IPP_RES_PER_INCH: "dpi",
                             cups.IPP_RES_PER_CM: "dpc" }
        cls.UNITS_DEFAULT = cups.IPP_RES_PER_INCH

        cls.UNITS_BY_STR = {}
        for v, s in cls.UNITS_BY_VAL.items ():
            cls.UNITS_BY_STR[s] = v

        if isinstance (values, str):
            matches = re.match (r"(\d+)\D+(\d+)(.*)", values).groups ()
            xres = int (matches[0])
import sys

from debug import *
import asyncconn
import config
import cups
import cupshelpers
import dnssdresolve
import jobviewer
import killtimer
import newprinter
import PhysicalDevice
import ppdcache
import printerproperties

cups.require("1.9.52")

CONFIG_BUS = 'org.fedoraproject.Config.Printing'
CONFIG_PATH = '/org/fedoraproject/Config/Printing'
CONFIG_IFACE = 'org.fedoraproject.Config.Printing'
CONFIG_NEWPRINTERDIALOG_IFACE = CONFIG_IFACE + ".NewPrinterDialog"
CONFIG_PRINTERPROPERTIESDIALOG_IFACE = CONFIG_IFACE + ".PrinterPropertiesDialog"
CONFIG_JOBVIEWER_IFACE = CONFIG_IFACE + ".JobViewer"

g_ppds = None
g_killtimer = None


class FetchedPPDs(GObject.GObject):
    __gsignals__ = {
        'ready': (GObject.SIGNAL_RUN_LAST, None, ()),
Example #8
0
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

import config
import cups
cups.require("1.9.50")
import dbus
import dbus.glib
from gi.repository import GObject
from gi.repository import GLib
import time
from debug import *
import pprint
import gettext
gettext.install(domain=config.PACKAGE, localedir=config.localedir)
import ppdcache
import statereason
from statereason import StateReason

CONNECTING_TIMEOUT = 60 # seconds
MIN_REFRESH_INTERVAL = 1 # seconds
Example #9
0
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

from debug import *
from gi.repository import Gtk
import cups
import ppdippstr
import re

cups.require("1.9.55")


# Special IPP type
class IPPResolution(tuple):
    def __new__(cls, values):
        cls.UNITS_BY_VAL = {
            cups.IPP_RES_PER_INCH: "dpi",
            cups.IPP_RES_PER_CM: "dpc"
        }
        cls.UNITS_DEFAULT = cups.IPP_RES_PER_INCH

        cls.UNITS_BY_STR = {}
        for v, s in cls.UNITS_BY_VAL.items():
            cls.UNITS_BY_STR[s] = v
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

import cups
from functools import reduce
cups.require ("1.9.42")
import sys
import socket
import getpass
from debug import *

import dbus

# set up global default main loop
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)

import dbus.service
import gi
from gi.repository import GObject
from gi.repository import GLib
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

import asyncconn
import cups
from gi.repository import GLib
from gi.repository import Gdk
from gi.repository import Gtk
import os
import tempfile
from debug import *

cups.require("1.9.50")


class PPDCache:
    def __init__(self, host=None, port=None, encryption=None):
        self._cups = None
        self._exc = None
        self._cache = dict()
        self._modtimes = dict()
        self._host = host
        self._port = port
        self._encryption = encryption
        self._queued = list()
        self._connecting = False
        debugprint("+%s" % self)
Example #12
0
#!/usr/bin/python3 -u
from http.server import HTTPServer, BaseHTTPRequestHandler
from http.client import BAD_REQUEST, INTERNAL_SERVER_ERROR, NOT_IMPLEMENTED
from http.client import IncompleteRead
from socketserver import ForkingMixIn
import os
import select
import socket
from tempfile import TemporaryFile
import cups
from io import BytesIO
from gi.repository import printerd
from gi.repository import GLib
from gi.repository import Gio

cups.require ("1.9.70")

if os.getuid() == 0:
    server_address = ('', 631)
else:
    server_address = ('', 8631)

class ObjectAddress:
    """
    Base class for manipulating object addresses.
    """

    DBUS_PATH_PREFIX = ""
    URI_FORMAT = ""
    ID_TYPE = str
Example #13
0
#!/usr/bin/python3 -u
from http.server import HTTPServer, BaseHTTPRequestHandler
from http.client import BAD_REQUEST, INTERNAL_SERVER_ERROR, NOT_IMPLEMENTED
from http.client import IncompleteRead
from socketserver import ForkingMixIn
import os
import select
import socket
from tempfile import TemporaryFile
import cups
from io import BytesIO
from gi.repository import printerd
from gi.repository import GLib
from gi.repository import Gio

cups.require("1.9.70")

if os.getuid() == 0:
    server_address = ('', 631)
else:
    server_address = ('', 8631)


class ObjectAddress:
    """
    Base class for manipulating object addresses.
    """

    DBUS_PATH_PREFIX = ""
    URI_FORMAT = ""
    ID_TYPE = str