~ubuntu-branches/ubuntu/hardy/gnue-common/hardy

« back to all changes in this revision

Viewing changes to src/cursing/utility.py

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2005-03-09 11:06:31 UTC
  • Revision ID: james.westby@ubuntu.com-20050309110631-8gvvn39q7tjz1kj6
Tags: upstream-0.5.14
ImportĀ upstreamĀ versionĀ 0.5.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# This file is part of GNU Enterprise.
 
3
#
 
4
# GNU Enterprise is free software; you can redistribute it
 
5
# and/or modify it under the terms of the GNU General Public
 
6
# License as published by the Free Software Foundation; either
 
7
# version 2, or (at your option) any later version.
 
8
#
 
9
# GNU Enterprise is distributed in the hope that it will be
 
10
# useful, but WITHOUT ANY WARRANTY; without even the implied
 
11
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 
12
# PURPOSE. See the GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public
 
15
# License along with program; see the file COPYING. If not,
 
16
# write to the Free Software Foundation, Inc., 59 Temple Place
 
17
# - Suite 330, Boston, MA 02111-1307, USA.
 
18
#
 
19
# Copyright 2002-2005 Free Software Foundation
 
20
#
 
21
# FILE:
 
22
# utility.py
 
23
#
 
24
# DESCRIPTION:
 
25
#
 
26
# NOTES:
 
27
#
 
28
 
 
29
 
 
30
import curses
 
31
 
 
32
#
 
33
# utility.py
 
34
#
 
35
 
 
36
from constants import *
 
37
 
 
38
def _paintBorder(dialog, Y, X, H, W, integrateUpper = 0, 
 
39
                 caption=None, color=0, captionColor=0):
 
40
  """ draw a border with curses_graphics
 
41
  """
 
42
  Screen = dialog.SCREEN
 
43
 
 
44
  dialog.LoLight()
 
45
  dialog.AutoRefresh = 0
 
46
 
 
47
  upperRC = tiURC
 
48
  upperLC = tiULC
 
49
 
 
50
  if integrateUpper :
 
51
    upperRC = tiUTEE
 
52
    upperLC = tiUTEE
 
53
 
 
54
  # first line
 
55
  Screen.PrintAt( Y,X, chr(upperLC) + (W-2) * chr(tiHLINE) + chr(upperRC), color)
 
56
 
 
57
  if caption:
 
58
    Screen.PrintAt (Y,X + 2, " %s " % caption, captionColor or color)
 
59
 
 
60
 
 
61
 
 
62
 
 
63
  # "body"
 
64
  for i in range(Y+1,Y+H-1):
 
65
    Screen.PrintAt(i,X, chr(tiVLINE) + (W-2)*' ' + chr(tiVLINE), color)
 
66
 
 
67
  # last line
 
68
  Screen.PrintAt( Y+H-1, X, chr(tiLLC) + (W-2) * chr(tiHLINE) + chr(tiLRC), color)
 
69
 
 
70
  # add title-text ?
 
71
  if dialog.HasProperty("TITLETEXT"):
 
72
    Screen.PrintAt( Y, X + 2, ' ' + dialog.TITLETEXT+ ' ')
 
73
 
 
74
  dialog.AutoRefresh = 1
 
75
 
 
76