예제 #1
0
"""

from Cursors import CURSOR_WAIT
from Tkinter import *
import grailutil
import os
import printing.paper
import printing.settings
import Reader
import string
import sys
import tktools


USER_DATA_DIR = grailutil.abspath(
    os.path.join(grailutil.getgraildir(), "data"))


def get_scaling_adjustments(w):
    scheight = float(w.winfo_screenheight())
    scwidth = float(w.winfo_screenwidth())
    scheight_mm = float(w.winfo_screenmmheight())
    scwidth_mm = float(w.winfo_screenmmwidth())
    vert_pixels_per_in = scheight / (scheight_mm / 25)
    horiz_pixels_per_in = scwidth / (scwidth_mm / 25)
    result = (72.0 / horiz_pixels_per_in), (72.0 / vert_pixels_per_in)
##     print "scaling adjustments:", result
    return result


def PrintDialog(context, url, title):
예제 #2
0
from Viewer import Viewer


LOGO_IMAGES = "logo:"
FIRST_LOGO_IMAGE = LOGO_IMAGES + "T1.gif"


# Window title prefix
TITLE_PREFIX = "Grail: "


# If we have an icon file, replace tktools.make_toplevel so that it gets
# set up as the icon, otherwise don't do anything magic.
#
_mydir = os.path.dirname(grailutil.abspath(__file__))
_iconxbm_file = grailutil.which(
    'icon.xbm', (_mydir, os.path.join(_mydir, "data")))
if _iconxbm_file:
    _iconmask_file = os.path.join(os.path.dirname(_iconxbm_file),
                                  "iconmask.xbm")
    if not os.path.isfile(_iconmask_file):
        _iconmask_file = None
    def make_toplevel(*args, **kw):
        w = apply(tktools_make_toplevel, args, kw)
        # icon set up
        try: w.iconbitmap('@' + _iconxbm_file)
        except TclError: pass
        if _iconmask_file:
            try: w.iconmask('@' + _iconmask_file)
            except TclError: pass