This commit is contained in:
David Rose 2009-08-14 01:00:43 +00:00
parent 752487a7ff
commit 21c514fd2b
3 changed files with 57 additions and 12 deletions

View File

@ -361,19 +361,29 @@ subprocess_run() {
if (_image_filename_changed) { if (_image_filename_changed) {
update_image_filename(_image_filename, _image_filename_temp); update_image_filename(_image_filename, _image_filename_temp);
override = true;
} }
_image_filename_changed = false; _image_filename_changed = false;
if (override || have_event || install_label != prev_label) { if (override || have_event || install_label != prev_label) {
redraw(install_label); redraw(install_label);
override = false; override = false;
XFillRectangle(_display, _window, _graphics_context, 12, _height - 18,
(unsigned int)(install_progress * (_width - 24)), 7); // Don't draw the progress bar unless we have some text in
// install_label.
if (!install_label.empty()) {
XFillRectangle(_display, _window, _graphics_context, 12, _height - 18,
(unsigned int)(install_progress * (_width - 24)), 7);
}
XFlush(_display); XFlush(_display);
} else if (install_progress != prev_progress) { } else if (install_progress != prev_progress) {
XFillRectangle(_display, _window, _graphics_context, 12, _height - 18, if (!install_label.empty()) {
(unsigned int)(install_progress * (_width - 24)), 7); XFillRectangle(_display, _window, _graphics_context, 12, _height - 18,
(unsigned int)(install_progress * (_width - 24)), 7);
}
} }
prev_label = install_label; prev_label = install_label;
prev_progress = install_progress; prev_progress = install_progress;
@ -502,11 +512,21 @@ redraw(string label) {
} }
XClearArea(_display, _window, 10, _height - 20, _width - 20, 10, false); XClearArea(_display, _window, 10, _height - 20, _width - 20, 10, false);
} }
// Draw the rest - the label and the progress bar outline. if (!label.empty()) {
XDrawString(_display, _window, _graphics_context, _width / 2 - label.size() * 3, // Draw the rest - the label and the progress bar outline.
_height - 30, label.c_str(), label.size()); int text_width = label.size() * 6;
XDrawRectangle(_display, _window, _graphics_context, 10, _height - 20, _width - 20, 10); int text_height = 10;
int text_x = (_width - text_width) / 2;
int text_y = _height - 30;
XClearArea(_display, _window,
text_x - 2, text_y - text_height - 2,
text_width + 4, text_height + 4, false);
XDrawString(_display, _window, _graphics_context, text_x, text_y,
label.c_str(), label.size());
XDrawRectangle(_display, _window, _graphics_context, 10, _height - 20, _width - 20, 10);
}
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -855,8 +855,6 @@ class Packager:
not already been included. Returns the new name within the not already been included. Returns the new name within the
package tree. """ package tree. """
assert not filename.isLocal()
filename = Filename(filename) filename = Filename(filename)
filename.makeCanonical() filename.makeCanonical()
@ -1370,6 +1368,32 @@ class Packager:
version = args.get('version', None) version = args.get('version', None)
self.require(packageName, version = version) self.require(packageName, version = version)
def parse_model_path(self, words):
"""
model_path directory
"""
newName = None
try:
command, dirName = words
except ValueError:
raise ArgumentError
getModelPath().appendDirectory(Filename.fromOsSpecific(dirName))
def parse_reset_model_path(self, words):
"""
reset_model_path
"""
newName = None
try:
(command,) = words
except ValueError:
raise ArgumentError
getModelPath().clear()
def parse_module(self, words): def parse_module(self, words):
""" """
module moduleName [newName] module moduleName [newName]

View File

@ -116,6 +116,7 @@ def makePackedApp(args):
mainModule = main.cStr().replace('/', '.') mainModule = main.cStr().replace('/', '.')
packager.installDir = appDir packager.installDir = appDir
getModelPath().appendDirectory(root)
packager.setup() packager.setup()
packager.beginPackage(appBase, p3dApplication = True) packager.beginPackage(appBase, p3dApplication = True)