- move spritz constants to a separate file


git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1360 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
(no author)
2008-03-02 15:30:52 +00:00
parent 80d7def7ab
commit ef76b07a4f
9 changed files with 239 additions and 223 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ import logging
from urlgrabber.progress import *
# Yumex imports
from misc import const
from spritz_setup import const
#from yumgui.callbacks import RPMInstallCallback
#from yumgui import *
from i18n import _
+1 -1
View File
@@ -28,7 +28,7 @@ except:
from ConfigParser import ConfigParser,SafeConfigParser
from misc import const,cleanMarkupSting,SpritzConf,unicode2htmlentities
from spritz_setup import const,cleanMarkupSting,SpritzConf,unicode2htmlentities
from i18n import _
class ConfirmationDialog:
+1 -1
View File
@@ -17,7 +17,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from misc import const,cleanMarkupSting
from spritz_setup import const,cleanMarkupSting
from i18n import _
from dialogs import questionDialog,LicenseDialog
+1 -1
View File
@@ -23,7 +23,7 @@ import etpgui
import gobject
import types
import sys, os
from misc import const
from spritz_setup import const
import vte
class SpritzConsole(vte.Terminal):
+2 -1
View File
@@ -18,7 +18,8 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from etpgui import *
from misc import SpritzQueue, SpritzConf, const, cleanMarkupSting
from spritz_setup import SpritzConf, const, cleanMarkupSting
from misc import SpritzQueue
from views import *
from etpgui.widgets import SpritzConsole
from i18n import _
-216
View File
@@ -17,109 +17,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import logging
import gtk
import gobject
import time
from i18n import _
import packages
from entropyConstants import *
class const:
''' This Class contains all the Constants in Yumex'''
__spritz_version__ = etpConst['entropyversion']
# Paths
MAIN_PATH = os.path.abspath( os.path.dirname( sys.argv[0] ) )
GLADE_FILE = MAIN_PATH+'/spritz.glade'
if not os.path.isfile(GLADE_FILE):
MAIN_PATH = '/usr/lib/entropy/spritz'
GLADE_FILE = MAIN_PATH+'/spritz.glade'
if MAIN_PATH == '/usr/lib/entropy/spritz':
PIXMAPS_PATH = '/usr/share/pixmaps/spritz'
else:
PIXMAPS_PATH = MAIN_PATH+'/../gfx'
if MAIN_PATH == '/usr/lib/entropy/spritz':
ICONS_PATH = '/usr/share/pixmaps/spritz'
else:
ICONS_PATH = MAIN_PATH+'/pixmaps'
# package categories
PACKAGE_CATEGORIES = [
"None",
"Groups",
"RPM Groups",
"Age"]
DAY_IN_SECONDS = 86400
# Page -> Notebook page numbers
PAGE_REPOS = 0
PAGE_PKG = 1
PAGE_OUTPUT = 2
PAGE_GROUP = 3
PAGE_QUEUE = 4
PAGE_FILESCONF = 5
PAGES = {
'packages' : PAGE_PKG,
'repos' : PAGE_REPOS,
'output' : PAGE_OUTPUT,
'queue' : PAGE_QUEUE,
'group' : PAGE_GROUP,
'filesconf' : PAGE_FILESCONF
}
PACKAGE_PROGRESS_STEPS = ( 0.1, # Depsolve
0.5, # Download
0.1, # Transaction Test
0.3 ) # Running Transaction
SETUP_PROGRESS_STEPS = ( 0.1, # Yum Config
0.2, # Repo Setup
0.1, # Sacksetup
0.2, # Updates
0.1, # Group
0.3) # get package Lists
CREDITS = (
(('Spritz Package Manager - %s' % __spritz_version__),
('Copyright 2008','Fabio Erculiani')),
(_("Programming:"),
("Fabio Erculiani",)),
(_("Yum Extender Programmers:"),
("Tim Lauridsen", "David Zamirski")),
(_("Translation:"),
("Tim Lauridsen (Danish)",
"MATSUURA Takanori (Japanese)",
"Rodrigo Padula de Oliveira (Brazilian)",
"Eric Tanguy (French)",
"Soohyung Cho (Korean)",
"Danilo (Italian)",
"Serta . YILDIZ (Turkish)",
"Dawid Zamirski, Patryk Zawadzki (Polish)",
"Piotr Drag (Polish)",
"Tero Hietanen (Finnish)",
"Dieter Komendera (German)",
"Maxim Dziumanenko (Ukrainian)",
"Novotny Lukas (Czech)",
"Szll Tams (Hungarian)",
"Leonid Kanter, Nikita (Russian)",
"Diego Alonso (Spanish)",
"A Singh Alam (Punjabi)",
"Hao Song (Chinese(Simplified))")),
(_("Dedicated to:"),
("Sergio Erculiani",)
)
)
class SpritzQueue:
def __init__(self):
self.logger = logging.getLogger('yumex.YumexQueue')
self.packages = {}
self.groups = {}
self.before = []
@@ -437,120 +338,3 @@ class SpritzQueue:
if grp in self.groups[action]:
return action
return None
class SpritzConf:
""" Yum Extender Config Setting"""
autorefresh = True
recentdays = 14
debug = False
plugins = True
usecache = False
proxy = ""
font_console = 'Monospace 8'
font_pkgdesc = 'Monospace 8'
color_console_background = '#FFFFFF'
color_console_font = '#000000'
color_pkgdesc = '#68228B'
color_install = 'darkgreen'
color_update = 'red'
color_normal = 'black'
color_obsolete = 'blue'
filelist = True
changelog = False
disable_repo_page = False
branding_title = 'Spritz Package Manager'
def cleanMarkupSting(msg):
msg = str(msg) # make sure it is a string
msg = gobject.markup_escape_text(msg)
#msg = msg.replace('@',' AT ')
#msg = msg.replace('<','[')
#msg = msg.replace('>',']')
return msg
class fakeoutfile:
"""
A fake output file object. It sends output to a GTK TextView widget,
and if asked for a file number, returns one set on instance creation
"""
def __init__(self, fn):
self.fn = fn
self.text_written = []
def close(self):
pass
def flush(self):
self.close()
def fileno(self):
return self.fn
def isatty(self):
return False
def read(self, a):
return ''
def readline(self):
return ''
def readlines(self):
return []
def write(self, s):
os.write(self.fn,s)
self.text_written.append(s)
# cut at 1024 entries
if len(self.text_written) > 1024:
self.text_written = self.text_written[-1024:]
#sys.stdout.write(s+"\n")
def write_line(self, s):
self.write(s)
def writelines(self, l):
for s in l:
self.write(s)
def seek(self, a):
raise IOError, (29, 'Illegal seek')
def tell(self):
raise IOError, (29, 'Illegal seek')
def truncate(self):
self.tell()
class fakeinfile:
"""
A fake input file object. It receives input from a GTK TextView widget,
and if asked for a file number, returns one set on instance creation
"""
def __init__(self, fn):
self.fn = fn
def close(self): pass
flush = close
def fileno(self): return self.fn
def isatty(self): return False
def read(self, a): return self.readline()
def readline(self): ## just a fake
return os.read(self.fn,2048)
def readlines(self): return []
def write(self, s): return None
def writelines(self, l): return None
def seek(self, a): raise IOError, (29, 'Illegal seek')
def tell(self): raise IOError, (29, 'Illegal seek')
truncate = tell
from htmlentitydefs import codepoint2name
def unicode2htmlentities(u):
htmlentities = list()
for c in u:
if ord(c) < 128:
htmlentities.append(c)
else:
htmlentities.append('&%s;' % codepoint2name[ord(c)])
return ''.join(htmlentities)
+1 -1
View File
@@ -46,7 +46,7 @@ from etpgui import *
import filters
from gui import SpritzGUI
from dialogs import *
from misc import const, fakeoutfile, fakeinfile
from spritz_setup import const, fakeoutfile, fakeinfile
from i18n import _
import time
+231
View File
@@ -0,0 +1,231 @@
#!/usr/bin/python -tt
# -*- coding: iso-8859-1 -*-
# Yum Exteder (yumex) - A GUI for yum
# Copyright (C) 2006 Tim Lauridsen < tim<AT>yum-extender<DOT>org >
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import gtk, gobject
import os, sys
from i18n import _
from entropyConstants import *
class const:
''' This Class contains all the Constants in Yumex'''
__spritz_version__ = etpConst['entropyversion']
# Paths
MAIN_PATH = os.path.abspath( os.path.dirname( sys.argv[0] ) )
GLADE_FILE = MAIN_PATH+'/spritz.glade'
if not os.path.isfile(GLADE_FILE):
MAIN_PATH = '/usr/lib/entropy/spritz'
GLADE_FILE = MAIN_PATH+'/spritz.glade'
if MAIN_PATH == '/usr/lib/entropy/spritz':
PIXMAPS_PATH = '/usr/share/pixmaps/spritz'
else:
PIXMAPS_PATH = MAIN_PATH+'/../gfx'
if MAIN_PATH == '/usr/lib/entropy/spritz':
ICONS_PATH = '/usr/share/pixmaps/spritz'
else:
ICONS_PATH = MAIN_PATH+'/pixmaps'
# package categories
PACKAGE_CATEGORIES = [
"None",
"Groups",
"RPM Groups",
"Age"]
DAY_IN_SECONDS = 86400
# Page -> Notebook page numbers
PAGE_REPOS = 0
PAGE_PKG = 1
PAGE_OUTPUT = 2
PAGE_GROUP = 3
PAGE_QUEUE = 4
PAGE_FILESCONF = 5
PAGES = {
'packages' : PAGE_PKG,
'repos' : PAGE_REPOS,
'output' : PAGE_OUTPUT,
'queue' : PAGE_QUEUE,
'group' : PAGE_GROUP,
'filesconf' : PAGE_FILESCONF
}
PACKAGE_PROGRESS_STEPS = ( 0.1, # Depsolve
0.5, # Download
0.1, # Transaction Test
0.3 ) # Running Transaction
SETUP_PROGRESS_STEPS = ( 0.1, # Yum Config
0.2, # Repo Setup
0.1, # Sacksetup
0.2, # Updates
0.1, # Group
0.3) # get package Lists
CREDITS = (
(('Spritz Package Manager - %s' % __spritz_version__),
('Copyright 2008','Fabio Erculiani')),
(_("Programming:"),
("Fabio Erculiani",)),
(_("Yum Extender Programmers:"),
("Tim Lauridsen", "David Zamirski")),
(_("Translation:"),
("Tim Lauridsen (Danish)",
"MATSUURA Takanori (Japanese)",
"Rodrigo Padula de Oliveira (Brazilian)",
"Eric Tanguy (French)",
"Soohyung Cho (Korean)",
"Danilo (Italian)",
"Serta . YILDIZ (Turkish)",
"Dawid Zamirski, Patryk Zawadzki (Polish)",
"Piotr Drag (Polish)",
"Tero Hietanen (Finnish)",
"Dieter Komendera (German)",
"Maxim Dziumanenko (Ukrainian)",
"Novotny Lukas (Czech)",
"Szll Tams (Hungarian)",
"Leonid Kanter, Nikita (Russian)",
"Diego Alonso (Spanish)",
"A Singh Alam (Punjabi)",
"Hao Song (Chinese(Simplified))")),
(_("Dedicated to:"),
("Sergio Erculiani",)
)
)
class SpritzConf:
""" Yum Extender Config Setting"""
autorefresh = True
recentdays = 14
debug = False
plugins = True
usecache = False
proxy = ""
font_console = 'Monospace 8'
font_pkgdesc = 'Monospace 8'
color_console_background = '#FFFFFF'
color_console_font = '#000000'
color_pkgdesc = '#68228B'
color_install = 'darkgreen'
color_update = 'red'
color_normal = 'black'
color_obsolete = 'blue'
filelist = True
changelog = False
disable_repo_page = False
branding_title = 'Spritz Package Manager'
def cleanMarkupSting(msg):
msg = str(msg) # make sure it is a string
msg = gobject.markup_escape_text(msg)
#msg = msg.replace('@',' AT ')
#msg = msg.replace('<','[')
#msg = msg.replace('>',']')
return msg
class fakeoutfile:
"""
A fake output file object. It sends output to a GTK TextView widget,
and if asked for a file number, returns one set on instance creation
"""
def __init__(self, fn):
self.fn = fn
self.text_written = []
def close(self):
pass
def flush(self):
self.close()
def fileno(self):
return self.fn
def isatty(self):
return False
def read(self, a):
return ''
def readline(self):
return ''
def readlines(self):
return []
def write(self, s):
os.write(self.fn,s)
self.text_written.append(s)
# cut at 1024 entries
if len(self.text_written) > 1024:
self.text_written = self.text_written[-1024:]
#sys.stdout.write(s+"\n")
def write_line(self, s):
self.write(s)
def writelines(self, l):
for s in l:
self.write(s)
def seek(self, a):
raise IOError, (29, 'Illegal seek')
def tell(self):
raise IOError, (29, 'Illegal seek')
def truncate(self):
self.tell()
class fakeinfile:
"""
A fake input file object. It receives input from a GTK TextView widget,
and if asked for a file number, returns one set on instance creation
"""
def __init__(self, fn):
self.fn = fn
def close(self): pass
flush = close
def fileno(self): return self.fn
def isatty(self): return False
def read(self, a): return self.readline()
def readline(self): ## just a fake
return os.read(self.fn,2048)
def readlines(self): return []
def write(self, s): return None
def writelines(self, l): return None
def seek(self, a): raise IOError, (29, 'Illegal seek')
def tell(self): raise IOError, (29, 'Illegal seek')
truncate = tell
from htmlentitydefs import codepoint2name
def unicode2htmlentities(u):
htmlentities = list()
for c in u:
if ord(c) < 128:
htmlentities.append(c)
else:
htmlentities.append('&%s;' % codepoint2name[ord(c)])
return ''.join(htmlentities)
+1 -1
View File
@@ -22,7 +22,7 @@ import gobject
import logging
import glob
import ConfigParser
from misc import const
from spritz_setup import const
from etpgui.widgets import UI
from etpgui import *
from entropyConstants import *