code
stringlengths
1
1.72M
language
stringclasses
1 value
from django.conf import settings def path_context_processor(request): path = { 'PATH': settings.APP_PATH, } return path
Python
# -*- encoding: utf-8 -*- DATE_FORMAT = 'N j, Y'
Python
# -*- coding: utf-8 -*- DATE_FORMAT = r'j N Y'
Python
# -*- coding: utf-8 -*- ''' Copyright Cobalys (c) 2011 This file is part of 365Video. 365Video 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 3 of the License, or (at your option) any later version. 365Video 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 365Video. If not, see <http://www.gnu.org/licenses/>. ''' from django.conf.urls.defaults import * from video365.apps.administration import views as administration_views from video365.apps.tag import views as tag_views from video365.apps.videopost import views as videopost_views import video365.settings urlpatterns = patterns('', (r'^permalink/(?P<videopost_id>\d+)/$', videopost_views.retrieve), # Retrieve (r'^(?P<videopost_id>\d+)/([\w-]+).html$', videopost_views.retrieve), #Retrieve (r'^(?P<page>\d+)/$', videopost_views.retrieve_all), #Retrieve All (r'^date/(?P<page>\d+)/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', videopost_views.get_by_date), #Search by Date (r'^date/(?P<page>\d+)/(?P<year>\d{4})/(?P<month>\d+)/$', videopost_views.get_by_date), #Search by Date (r'^date/(?P<page>\d+)/(?P<year>\d{4})/$', videopost_views.get_by_date), #Search by Date (r'^tag/(?P<tag_id>\d+)/(?P<page>\d+)/([\w-]+).html$', videopost_views.get_by_tag), #Search by Tag (r'^tag/(?P<tag_id>\d+)/([\w-]+).html$', videopost_views.get_by_tag), #Search by Tag ) urlpatterns += patterns('', (r'^admin/videopost/(?P<page>\d+)$', videopost_views.admin_index), #Videopost Administration Panel. (r'^admin/videopost/$', videopost_views.admin_index), #Videopost Administration Panel. (r'^admin/videopost/create/$', videopost_views.create), #Create (r'^admin/videopost/update/(?P<videopost_id>\d+)/$', videopost_views.update), #Update (r'^admin/videopost/delete/(?P<videopost_id>\d+)/$', videopost_views.delete), #Delete ) urlpatterns += patterns('', (r'^admin/tag/$', tag_views.admin_index), #Tags Administration Panel. (r'^admin/tag/create/$', tag_views.create), #Create (r'^admin/tag/edit/(?P<tag_id>\d+)/$', tag_views.update), #Update (r'^admin/tag/delete/(?P<tag_id>\d+)/$', tag_views.delete), #Delete ) urlpatterns += patterns('', (r'^admin/$', administration_views.admin_panel), (r'^admin/change-password/$', administration_views.change_password), (r'^admin/login/$', 'django.contrib.auth.views.login', {'template_name': 'admin/login.html'}), (r'^admin/logout/$', 'django.contrib.auth.views.logout', {'template_name': 'admin/logout.html'}), ) urlpatterns += patterns('', (r'^index.html$', videopost_views.retrieve_all), (r'^$', videopost_views.retrieve_all), )
Python
# -*- coding: utf-8 -*- ''' Copyright Cobalys.com (c) 2011 This file is part of 365Video. 365Video 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 3 of the License, or (at your option) any later version. 365Video 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 365Video. If not, see <http://www.gnu.org/licenses/>. ''' ''' Load Celery ''' import djcelery djcelery.setup_loader() ''' Production Settings ''' DEBUG = True TEMPLATE_DEBUG = DEBUG SITE_ID = 1 ROOT_URLCONF = 'video365.urls' SECRET_KEY = '2^4=@x=c-cp&j95&%zk8@bf_(*!!aw$^l85dp0=&w-krc2#)t)' ''' Administrators and Error Notification ''' ADMINS = ( #('Your name here', 'youmail@example.com'), ) MANAGERS = ADMINS EMAIL_SUBJECT_PREFIX = '[DJANGO-365VIDEO]' SEND_BROKEN_LINKS_EMAIL = False ''' Mail ''' #EMAIL_USE_TLS = True #EMAIL_HOST = 'smtp.example.com' #EMAIL_HOST_USER = 'notification@example.com' #EMAIL_HOST_PASSWORD = 'password' #EMAIL_PORT = 587 ''' Database ''' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } } ''' Internationalization ''' TIME_ZONE = 'America/Chicago' LANGUAGE_CODE = 'en' USE_I18N = True USE_L10N = True DEFAULT_CHARSET = 'utf-8' FORMAT_MODULE_PATH = 'video365.formats' ''' Directories ''' APP_DOMAIN = "127.0.0.1" APP_PATH = "/" APPLICATION_DIR = '/usr/django/video365/' MEDIA_ROOT = '/var/www/media%s' % APP_PATH GENERATOR_DIR = '%s/templates/layout/generated/' % APPLICATION_DIR TEMPLATE_DIRS = ( '%stemplates' % APPLICATION_DIR ) PATH_VIDEOS = '%suploads/videos/' % MEDIA_ROOT PATH_TEMP = '%suploads/temp/' % MEDIA_ROOT PATH_SPLASH = '%suploads/splash/' % MEDIA_ROOT MEDIA_URL = '/media%s' % APP_PATH LOGIN_REDIRECT_URL = '%sadmin/' % APP_PATH LOGIN_URL = '%sadmin/login/' % APP_PATH ''' Loaders ''' TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ) MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage' MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ) TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.media", "django.core.context_processors.auth", "django.core.context_processors.request", 'video365.helpers.processors.path_context_processor', ) BROKER_BACKEND = "djkombu.transport.DatabaseTransport" INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.humanize', 'video365.apps.tag', 'video365.apps.videopost', 'djcelery', 'djkombu', )
Python
import sys import os sys.path.append('/usr/django') os.environ["CELERY_LOADER"] = "django" os.environ['DJANGO_SETTINGS_MODULE'] = 'video365.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
Python
# -*- coding: utf-8 -*- ''' Copyright Cobalys.com (c) 2011 This file is part of 365Video. 365Video 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 3 of the License, or (at your option) any later version. 365Video 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 365Video. If not, see <http://www.gnu.org/licenses/>. ''' from django import forms from django.utils.translation import ugettext as _ class VideoPostUpdateForm(forms.Form): title = forms.CharField(max_length=40, label=_('Title'), required=True) description = forms.CharField(label=_('Description'), required=False, widget=forms.Textarea) enabled = forms.BooleanField(label=_('Enabled'), initial=True) tags = forms.CharField(label=_('Tags'), required=False) class VideoPostCreateForm(forms.Form): title = forms.CharField(max_length=40, label=_('Title'), required=True) description = forms.CharField(label=_('Description'), required=False, widget=forms.Textarea) splash_image = forms.ImageField(label=_('Splash Image'), required=False) video = forms.FileField(label=_('Video'), required=True) enabled = forms.BooleanField(label=_('Enabled'), initial=True) tags = forms.CharField(label=_('Tags'), required=False)
Python
# -*- coding: utf-8 -*- ''' Copyright Cobalys.com (c) 2011 This file is part of 365Video. 365Video 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 3 of the License, or (at your option) any later version. 365Video 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 365Video. If not, see <http://www.gnu.org/licenses/>. ''' from django.conf import settings from django.db import models from django.template.defaultfilters import slugify from django.utils.translation import ugettext as _ from video365.apps.tag.models import Tag class VideoPost(models.Model): PENDING = 0 PROCESSING = 1 READY = 2 ERROR = 3 STATE = ( (PENDING, _('Pending')), (PROCESSING, _('Processing')), (READY, _('Ready')), (ERROR, _('Error')), ) title = models.CharField(max_length=40, verbose_name=_('Title'), null=False, blank=False) description = models.TextField(verbose_name=_('Description'), null=False, blank=False) splash_image = models.CharField(max_length=200, verbose_name=_('Splash Image'), null=True, blank=True) video = models.CharField(max_length=200, verbose_name=_('Video'), null=False, blank=False) enabled = models.BooleanField(verbose_name=_('Enabled'), default=True) publication_date = models.DateTimeField(auto_now=False, auto_now_add=False, null=True, blank=True) tags = models.ManyToManyField(Tag, verbose_name=_('Tag'), null=True, blank=True) locked = models.BooleanField(verbose_name=_('Locked'), default=True) state = models.IntegerField(default=0, verbose_name=_('State'), choices=STATE, unique=False, null=False, blank=False) class Meta: verbose_name = _('Video Post') verbose_name_plural = _('Video Posts') def __unicode__(self): return self.title def get_absolute_url(self): return "%s%i/%s.html" % (settings.APP_PATH, self.id, slugify(self.title))
Python
# -*- coding: utf-8 -*- ''' Copyright Cobalys.com (c) 2011 This file is part of 365Video. 365Video 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 3 of the License, or (at your option) any later version. 365Video 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 365Video. If not, see <http://www.gnu.org/licenses/>. ''' from celery.task import Task from django.conf import settings from video365.apps.videopost.models import VideoPost from video365.helpers.generation_utils import generate_date_menu, \ generate_tag_files, generate_tag_js import os import subprocess class CreateVideopostTask(Task): """ Converts the Video and creates the related files. """ def run(self, videopost_id, create_splash, **kwargs): logger = self.get_logger(**kwargs) logger.info("Starting Video Post conversion: %s" % videopost_id) videopost = VideoPost.objects.get(pk=videopost_id) videopost.state = VideoPost.PROCESSING videopost.save() path_relative_videos = 'uploads/videos/%d.flv' % videopost_id path_relative_splash = 'uploads/splash/%d.jpeg' % videopost_id path_absolute_videos = '%s%d.flv' % (settings.PATH_VIDEOS, videopost_id) path_absolute_temp = '%s%d' % (settings.PATH_TEMP, videopost_id) path_absolute_splash = '%s%d.jpeg' % (settings.PATH_SPLASH, videopost_id) if create_splash: command_splash = ["ffmpeg", "-deinterlace", "-ss", "55", "-i", path_absolute_temp, "-y", "-vcodec", "mjpeg", "-vframes", "1", "-an", "-f", "rawvideo", path_absolute_splash] subprocess.call(command_splash, shell=False) command_convert = ["ffmpeg", "-i", path_absolute_temp, "-y", "-sameq", "-ar", "44100", path_absolute_videos] p = subprocess.call(command_convert, shell=False) if p == 0: videopost.locked = False videopost.splash_image = path_relative_splash videopost.video = path_relative_videos videopost.state = VideoPost.READY videopost.save() else: videopost.state = VideoPost.ERROR videopost.save() try: os.remove(path_absolute_temp) except: pass generate_date_menu() generate_tag_files() generate_tag_js() return "Ready" class DeleteAsociatedFilesTask(Task): """ Deletes the Files related to a Video Post. """ def run(self, videopost_id, **kwargs): logger = self.get_logger(**kwargs) logger.info("Starting Video Post files deletion %s" % videopost_id) path_absolute_videos = '%s%d.flv' % (settings.PATH_VIDEOS, videopost_id) path_absolute_temp = '%s%d' % (settings.PATH_TEMP, videopost_id) path_absolute_splash = '%s%d.jpeg' % (settings.PATH_SPLASH, videopost_id) try: os.remove(path_absolute_videos) except: pass try: os.remove(path_absolute_splash) except: pass try: os.remove(path_absolute_temp) except: pass return "Ready" class DeleteVideopostTask(Task): """ Deletes the Files related to a Video Post and generates new menus. """ def run(self, videopost_id, **kwargs): logger = self.get_logger(**kwargs) logger.info("Starting Video Post deletion %s" % videopost_id) path_absolute_videos = '%s%d.flv' % (settings.PATH_VIDEOS, videopost_id) path_absolute_splash = '%s%d.jpeg' % (settings.PATH_SPLASH, videopost_id) try: os.remove(path_absolute_videos) except: pass try: os.remove(path_absolute_splash) except: pass generate_date_menu() generate_tag_files() generate_tag_js() return "Ready" class EditVideopostTask(Task): """ Generates new menus after the Update operation. """ def run(self, videopost_id, **kwargs): logger = self.get_logger(**kwargs) logger.info("Starting Video Post edition %s" % videopost_id) generate_date_menu() generate_tag_files() generate_tag_js() return "Ready"
Python
# -*- coding: utf-8 -*- ''' Copyright Cobalys.com (c) 2011 This file is part of 365Video. 365Video 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 3 of the License, or (at your option) any later version. 365Video 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 365Video. If not, see <http://www.gnu.org/licenses/>. ''' from django.conf import settings from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.template import RequestContext from django.template.loader import get_template from django.utils.translation import ugettext as _ from django.views.decorators.cache import never_cache from video365.apps.tag.models import Tag from video365.apps.videopost.forms import VideoPostCreateForm, \ VideoPostUpdateForm from video365.apps.videopost.models import VideoPost from video365.apps.videopost.tasks import CreateVideopostTask, \ DeleteAsociatedFilesTask, DeleteVideopostTask, EditVideopostTask from video365.helpers.date_utils import get_day_name, get_month_name from video365.helpers.pagination_utils import paginator_simple, \ paginator_numeric import datetime def retrieve(request, videopost_id): """ Gets one Video Post """ variables = dict() videopost_id = int(videopost_id) videopost = get_object_or_404(VideoPost, pk=videopost_id, enabled=True, locked=False) variables['videopost'] = videopost variables['title'] = videopost.title t = get_template('videopost/retrieve.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html) def retrieve_all(request, page=1): """ Gets All the Video Post URL: ^(?P<page>\d+)/$ """ variables = dict() max_results = 5 previous_page = int(page) - 1 next_page = int(page) + 1 videopost_list = VideoPost.objects.filter(enabled=True, locked=False).order_by('-publication_date') if videopost_list: videoposts_paginated = paginator_simple(videopost_list, max_results, page) variables['videoposts'] = videoposts_paginated variables['previous-page-link'] = "%d/" % previous_page variables['next-page-link'] = "%d/" % next_page else: messages.info(request, _('No Results Found.')) t = get_template('videopost/list.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html) def get_by_date(request, page, year, month=None, day=None): """ Gets All the Video Post by Date. URL: ^date/(?P<page>\d+)/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$ ^date/(?P<page>\d+)/(?P<year>\d{4})/(?P<month>\d{2})/$ ^date/(?P<page>\d+)/(?P<year>\d{4})/$ """ variables = dict() page = int(page) previous_page = page - 1 next_page = page + 1 max_results = 5 if year.isdigit(): year = int(year) else: return HttpResponse(status=400) headline = _('Showing result for %(year)s.') % {'year': year} previous_page_link = "date/%d/%d/" % (previous_page, year) next_page_link = "date/%d/%d/" % (next_page, year) videopost_list = VideoPost.objects.filter(enabled=True, locked=False) videopost_list = videopost_list.filter(publication_date__year=year).order_by('-publication_date') if month and month.isdigit(): month = int(month) month_name = get_month_name(month) videopost_list = videopost_list.filter(publication_date__month=month) previous_page_link = previous_page_link + str(month) + "/" next_page_link = next_page_link + str(month) + "/" headline = _('Showing result for: %(month)s %(year)d.') % {'month': month_name, 'year': year} if day and day.isdigit(): day = int(day) day_name = get_day_name(day) videopost_list = videopost_list.filter(publication_date__day=day) previous_page_link = previous_page_link + str(day) + "/" next_page_link = next_page_link + str(day) + "/" headline = _('Showing result for: %(day)s %(month)s %(year)d.') % {'day': day_name, 'month': month_name, 'year': year} if videopost_list: videoposts_paginated = paginator_simple(videopost_list, max_results, page) variables['videoposts'] = videoposts_paginated variables['headline'] = headline variables['previous-page-link'] = "%d/" % previous_page variables['next-page-link'] = "%d/" % next_page else: messages.info(request, _('No Results Found.')) t = get_template('videopost/list.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html) def get_by_tag(request, tag_id, page=1): """ Gets All the Video Post by Tag. URL: ^tag/(?P<tag_id>\d+)/(?P<page>\d+)/([\w-]+).html$ ^tag/(?P<tag_id>\d+)/([\w-]+).html$ """ variables = dict() max_results = 5 previous_page = page - 1 next_page = page + 1 tag_id = int(tag_id) tag = get_object_or_404(Tag, pk=tag_id) variables['tag'] = tag videopost_list = tag.videopost_set.filter(enabled=True, locked=False).order_by('-publication_date') if videopost_list: videoposts_paginated = paginator_simple(videopost_list, max_results, page) variables['videoposts'] = videoposts_paginated headline = _('Showing result for: %(tag)s.') % {'tag': tag.name} variables['headline'] = headline variables['previous-page-link'] = "tag/%d/%d/%s.html" % (tag_id, previous_page, tag.get_slug()) variables['next-page-link'] = "tag/%d/%d/%s.html" % (tag_id, next_page, tag.get_slug()) else: messages.info(request, _('No Results Found.')) t = get_template('videopost/list.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html) @never_cache @login_required def create(request): """ Creates a new Video Post. """ variables = dict() videopost_id = 0 variables['title'] = _('Create new Video Post.') if request.POST: video_form = VideoPostCreateForm(request.POST, request.FILES) if video_form.is_valid(): try: title = video_form.cleaned_data['title'] description = video_form.cleaned_data['description'] enabled = video_form.cleaned_data['enabled'] tags_string = video_form.cleaned_data['tags'] video = request.FILES['video'] videopost = VideoPost() videopost.publication_date = datetime.datetime.now() videopost.title = title videopost.description = description videopost.enabled = enabled videopost.locked = True videopost.state = VideoPost.PENDING videopost.save() videopost_id = videopost.id save_tag(tags_string, videopost) except: variables['form'] = video_form messages.error(request, _('There was an error while saving the Video Post.')) try: path_absolute_temp = '%s%d' % (settings.PATH_TEMP, videopost_id) path_absolute_splash = '%s%d.jpeg' % (settings.PATH_SPLASH, videopost_id) create_splash = False destination = open(path_absolute_temp, 'wb+') for chunk in video.chunks(): destination.write(chunk) destination.close() if 'splash_image' in request.FILES: splash_image = request.FILES['splash_image'] destination = open(path_absolute_splash, 'wb+') for chunk in splash_image.chunks(): destination.write(chunk) destination.close() else: create_splash = True CreateVideopostTask.delay(videopost_id, create_splash) messages.success(request, _('Video Post successfully created. The video is currently being processed.')) return HttpResponseRedirect(reverse(admin_index)) except: DeleteAsociatedFilesTask.delay(videopost_id) variables['form'] = video_form messages.error(request, _('There was an error while uploading the file.')) else: messages.warning(request, _('Correct the errors bellow.')) else: video_form = VideoPostCreateForm() variables['form'] = video_form t = get_template('videopost/admin/create.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html) @never_cache @login_required def update(request, videopost_id): """ Updates a Video Post """ variables = dict() variables['title'] = _('Update Video Post') videopost = get_object_or_404(VideoPost, id=videopost_id) if request.POST: try: video_form = VideoPostUpdateForm(request.POST) if video_form.is_valid(): title = video_form.cleaned_data['title'] description = video_form.cleaned_data['description'] enabled = video_form.cleaned_data['enabled'] tags_string = video_form.cleaned_data['tags'] videopost.publication_date = datetime.date.today() videopost.title = title videopost.description = description videopost.enabled = enabled videopost.save() videopost_id = videopost.id save_tag(tags_string, videopost) EditVideopostTask.delay(videopost_id) messages.success(request, _('Video Post successfully updated.')) return HttpResponseRedirect(reverse(admin_index)) else: messages.warning(request, _('Correct the errors bellow.')) except: variables['form'] = video_form messages.error(request, _('There was an error while updating the Video Post.')) else: try: videopost.tags.all() tags = ', '.join([video.name for video in videopost.tags.all()]) video_form = VideoPostUpdateForm(initial={'title': videopost.title, 'description': videopost.description, 'enabled': videopost.enabled, 'tags': tags, }) variables['title'] = videopost.title variables['videopost'] = videopost except: messages.error(request, _('There was an error while updating the Video Post.')) variables['form'] = video_form t = get_template('videopost/admin/update.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html) @never_cache @login_required def delete(request, videopost_id): """ Deletes a Video Post """ variables = dict() videopost_id = int(videopost_id) videopost = get_object_or_404(VideoPost, pk=videopost_id) if request.POST: try: videopost.delete() messages.success(request, _('Video Post successfully deleted.')) DeleteVideopostTask.delay(videopost_id) except: messages.error(request, _('There was an error while deleting the Video Post.')) return HttpResponseRedirect(reverse(admin_index)) else: variables['videopost'] = videopost t = get_template('videopost/admin/delete.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html) @never_cache @login_required def admin_index(request, page="1"): """ Loads the Administration panel for the Video Posts. """ variables = dict() videopost_list = VideoPost.objects.all().order_by('-publication_date') max_results = 10 if videopost_list: paginator_results, videoposts = paginator_numeric(videopost_list, max_results, page) variables.update(paginator_results) variables['videoposts'] = videoposts.object_list variables['pagination_list'] = videoposts variables['title'] = "Video Posts" else: messages.info(request, _('No Results Found.')) t = get_template('videopost/admin/list.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html) def save_tag(tags_string, videopost): """ Saves the tags associated to a Video Post. """ if tags_string.strip(): tags = tags_string.lower().split(',') videopost.tags.clear() for tag_name in tags: tag_name = tag_name.strip() if len(tag_name): if Tag.objects.filter(name__iexact=tag_name).count(): tag = Tag.objects.get(name__iexact=tag_name) else: tag = Tag() tag.name = tag_name tag.save() videopost.tags.add(tag) videopost.save()
Python
# -*- coding: utf-8 -*- ''' Copyright Cobalys.com (c) 2011 This file is part of 365Video. 365Video 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 3 of the License, or (at your option) any later version. 365Video 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 365Video. If not, see <http://www.gnu.org/licenses/>. ''' from django import forms from django.utils.translation import ugettext as _ class TagForm(forms.Form): name = forms.CharField(max_length=40, label=_('Name'), required=True)
Python
# -*- coding: utf-8 -*- ''' Copyright Cobalys.com (c) 2011 This file is part of 365Video. 365Video 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 3 of the License, or (at your option) any later version. 365Video 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 365Video. If not, see <http://www.gnu.org/licenses/>. ''' from django.db import models from django.template.defaultfilters import slugify from django.utils.translation import ugettext as _ from django.conf import settings class Tag(models.Model): name = models.CharField(unique=True, max_length=25, verbose_name=_('Name'), null=False, blank=False) videos_count = 0 class Meta: verbose_name = _('Tag') verbose_name_plural = _('Tags') def __unicode__(self): return self.name def get_absolute_url(self): return "%stag/%i/%s.html" % (settings.APP_PATH, self.id, slugify(self.name)) def get_slug(self): return slugify(self.name)
Python
# -*- coding: utf-8 -*- ''' Copyright Cobalys.com (c) 2011 This file is part of 365Video. 365Video 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 3 of the License, or (at your option) any later version. 365Video 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 365Video. If not, see <http://www.gnu.org/licenses/>. ''' from celery.task import Task from video365.helpers.generation_utils import generate_date_menu, \ generate_tag_files, generate_tag_js class UpdateTagFilesTask(Task): """ Updates the generated files. """ def run(self, **kwargs): logger = self.get_logger(**kwargs) logger.info("Starting Tag Deletion...") generate_date_menu() generate_tag_files() generate_tag_js() return "Ready"
Python
# -*- coding: utf-8 -*- ''' Copyright Cobalys.com (c) 2011 This file is part of 365Video. 365Video 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 3 of the License, or (at your option) any later version. 365Video 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 365Video. If not, see <http://www.gnu.org/licenses/>. ''' from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect from django.template import RequestContext from django.template.loader import get_template from django.utils.translation import ugettext as _ from django.views.decorators.cache import never_cache from video365.apps.tag.forms import TagForm from video365.apps.tag.models import Tag from video365.apps.tag.tasks import UpdateTagFilesTask from video365.helpers.pagination_utils import paginator_numeric @never_cache @login_required def admin_index(request, page="1"): """ Loads the Administration panel for the Tags. URL: ^admin/tag/$ """ variables = dict() tag_list = Tag.objects.all() max_results = 10 if tag_list: paginator_results, tags = paginator_numeric(tag_list, max_results, page) variables.update(paginator_results) variables['tags'] = tags.object_list variables['pagination_list'] = tags variables['title'] = "Tags" else: messages.warning(request, _('No Results Found.')) t = get_template('tag/admin/list.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html) @never_cache @login_required def create(request): """ Saves a tag. URL: ^admin/tag/create/$ """ variables = dict() variables['title'] = _('Create new Tag') if request.POST: try: tag_form = TagForm(request.POST) if tag_form.is_valid(): name = tag_form.cleaned_data['name'] tag = Tag() tag.name = name tag.save() UpdateTagFilesTask.delay() messages.success(request, _('Tag successfully created.')) return HttpResponseRedirect(reverse(admin_index)) else: messages.warning(request, _('Correct the errors bellow.')) except: messages.error(request, _('There was an error while saving the Tag.')) else: tag_form = TagForm() variables['tag_form'] = tag_form t = get_template('tag/admin/create.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html) @never_cache @login_required def update(request, tag_id): """ Updates a Tag. URL: ^admin/tag/edit/(?P<tag_id>\d+)/$ """ variables = dict() variables['title'] = _('Edit Tag') tag = Tag.objects.get(pk=tag_id) if request.POST: try: tag_form = TagForm(request.POST) if tag_form.is_valid(): name = tag_form.cleaned_data['name'] tag.name = name tag.save() messages.success(request, _('Tag successfully updated.')) UpdateTagFilesTask.delay() return HttpResponseRedirect(reverse(admin_index)) else: messages.warning(request, _('Correct the errors bellow.')) except: messages.error(request, _('There was an error while saving the Tag.')) else: tag_form = TagForm(initial={'name': tag.name}) variables['tag'] = tag variables['tag_form'] = tag_form t = get_template('tag/admin/update.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html) @never_cache @login_required def delete(request, tag_id): """ Deletes a Tag. URL: ^admin/tag/delete/(?P<tag_id>\d+)/$ """ variables = dict() tag = Tag.objects.get(pk=tag_id) if request.POST: try: tag.delete() UpdateTagFilesTask.delay() messages.success(request, _('Tag successfully deleted.')) except: messages.error(request, _('There was an error while saving the Tag.')) return HttpResponseRedirect(reverse(admin_index)) else: if tag_id is not None: variables['tag'] = tag t = get_template('tag/admin/delete.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html)
Python
# -*- coding: utf-8 -*- ''' Copyright Cobalys.com (c) 2011 This file is part of 365Video. 365Video 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 3 of the License, or (at your option) any later version. 365Video 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 365Video. If not, see <http://www.gnu.org/licenses/>. ''' from django.contrib import messages from django.contrib.auth.decorators import login_required from django.contrib.auth.forms import PasswordChangeForm from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect from django.template.context import RequestContext from django.template.loader import get_template from django.utils.translation import ugettext as _ from django.views.decorators.cache import never_cache @never_cache @login_required def admin_panel(request): t = get_template('admin/index.html') html = t.render(RequestContext(request)) return HttpResponse(html) @never_cache @login_required def change_password(request): variables = dict() if request.POST: try: configuration_form = PasswordChangeForm(user=request.user, data=request.POST) if configuration_form.is_valid(): configuration_form.save() messages.success(request, _('Password changed.')) return HttpResponseRedirect(reverse(admin_panel)) else: messages.warning(request, _('Correct the errors bellow.')) except: messages.error(request, _('There was an error while changing the Password.')) else: configuration_form = PasswordChangeForm(user=request.user) variables['form'] = configuration_form t = get_template('admin/change-password.html') html = t.render(RequestContext(request, variables)) return HttpResponse(html)
Python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '3dlp_slicer.ui' # # Created: Sat Jun 01 20:47:44 2013 # by: PyQt4 UI code generator 4.8.5 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(1324, 768) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(180, 180, 180)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(217, 217, 217)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(90, 90, 90)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(180, 180, 180)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(217, 217, 217)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(180, 180, 180)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(217, 217, 217)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(90, 90, 90)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(180, 180, 180)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(217, 217, 217)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(90, 90, 90)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(180, 180, 180)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(217, 217, 217)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(90, 90, 90)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(90, 90, 90)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(90, 90, 90)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(180, 180, 180)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(180, 180, 180)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(180, 180, 180)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush) MainWindow.setPalette(palette) MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "3DLP Slicer", None, QtGui.QApplication.UnicodeUTF8)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/Icons/icons/transform.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.frame = QtGui.QFrame(self.centralwidget) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) self.frame.setFrameShadow(QtGui.QFrame.Raised) self.frame.setObjectName(_fromUtf8("frame")) self.verticalLayout_2 = QtGui.QVBoxLayout(self.frame) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.groupBox = QtGui.QGroupBox(self.frame) self.groupBox.setMinimumSize(QtCore.QSize(0, 200)) self.groupBox.setMaximumSize(QtCore.QSize(254, 16777215)) self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Model Information", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.verticalLayout.addWidget(self.groupBox) self.groupBox_2 = QtGui.QGroupBox(self.frame) self.groupBox_2.setMinimumSize(QtCore.QSize(0, 100)) self.groupBox_2.setMaximumSize(QtCore.QSize(254, 16777215)) self.groupBox_2.setTitle(QtGui.QApplication.translate("MainWindow", "Model List", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) self.horizontalLayout_7 = QtGui.QHBoxLayout(self.groupBox_2) self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7")) self.verticalLayout_4 = QtGui.QVBoxLayout() self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.horizontalLayout_6 = QtGui.QHBoxLayout() self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6")) self.addModel = QtGui.QPushButton(self.groupBox_2) self.addModel.setText(QtGui.QApplication.translate("MainWindow", "Add", None, QtGui.QApplication.UnicodeUTF8)) self.addModel.setObjectName(_fromUtf8("addModel")) self.horizontalLayout_6.addWidget(self.addModel) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_6.addItem(spacerItem) self.removeModel = QtGui.QPushButton(self.groupBox_2) self.removeModel.setText(QtGui.QApplication.translate("MainWindow", "Remove", None, QtGui.QApplication.UnicodeUTF8)) self.removeModel.setObjectName(_fromUtf8("removeModel")) self.horizontalLayout_6.addWidget(self.removeModel) self.verticalLayout_4.addLayout(self.horizontalLayout_6) self.modelList = QtGui.QListWidget(self.groupBox_2) self.modelList.setFrameShadow(QtGui.QFrame.Plain) self.modelList.setAlternatingRowColors(False) self.modelList.setSpacing(1) self.modelList.setModelColumn(0) self.modelList.setObjectName(_fromUtf8("modelList")) self.verticalLayout_4.addWidget(self.modelList) self.horizontalLayout_7.addLayout(self.verticalLayout_4) self.verticalLayout.addWidget(self.groupBox_2) self.Transform_groupbox = QtGui.QGroupBox(self.frame) self.Transform_groupbox.setEnabled(False) self.Transform_groupbox.setMaximumSize(QtCore.QSize(254, 16777215)) self.Transform_groupbox.setTitle(QtGui.QApplication.translate("MainWindow", "Transform Model", None, QtGui.QApplication.UnicodeUTF8)) self.Transform_groupbox.setObjectName(_fromUtf8("Transform_groupbox")) self.horizontalLayout_5 = QtGui.QHBoxLayout(self.Transform_groupbox) self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.label_12 = QtGui.QLabel(self.Transform_groupbox) self.label_12.setText(QtGui.QApplication.translate("MainWindow", "Position:", None, QtGui.QApplication.UnicodeUTF8)) self.label_12.setObjectName(_fromUtf8("label_12")) self.verticalLayout_3.addWidget(self.label_12) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.label_9 = QtGui.QLabel(self.Transform_groupbox) self.label_9.setText(QtGui.QApplication.translate("MainWindow", "X:", None, QtGui.QApplication.UnicodeUTF8)) self.label_9.setObjectName(_fromUtf8("label_9")) self.horizontalLayout_4.addWidget(self.label_9) self.positionX = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.positionX.setMinimumSize(QtCore.QSize(55, 0)) self.positionX.setMinimum(-99.99) self.positionX.setObjectName(_fromUtf8("positionX")) self.horizontalLayout_4.addWidget(self.positionX) self.label_10 = QtGui.QLabel(self.Transform_groupbox) self.label_10.setText(QtGui.QApplication.translate("MainWindow", "Y:", None, QtGui.QApplication.UnicodeUTF8)) self.label_10.setObjectName(_fromUtf8("label_10")) self.horizontalLayout_4.addWidget(self.label_10) self.positionY = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.positionY.setMinimumSize(QtCore.QSize(55, 0)) self.positionY.setMinimum(-99.99) self.positionY.setObjectName(_fromUtf8("positionY")) self.horizontalLayout_4.addWidget(self.positionY) self.label_11 = QtGui.QLabel(self.Transform_groupbox) self.label_11.setText(QtGui.QApplication.translate("MainWindow", "Z:", None, QtGui.QApplication.UnicodeUTF8)) self.label_11.setObjectName(_fromUtf8("label_11")) self.horizontalLayout_4.addWidget(self.label_11) self.positionZ = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.positionZ.setMinimumSize(QtCore.QSize(55, 0)) self.positionZ.setMinimum(-99.99) self.positionZ.setObjectName(_fromUtf8("positionZ")) self.horizontalLayout_4.addWidget(self.positionZ) self.verticalLayout_3.addLayout(self.horizontalLayout_4) self.label_4 = QtGui.QLabel(self.Transform_groupbox) self.label_4.setText(QtGui.QApplication.translate("MainWindow", "Rotation:", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setObjectName(_fromUtf8("label_4")) self.verticalLayout_3.addWidget(self.label_4) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.label = QtGui.QLabel(self.Transform_groupbox) self.label.setText(QtGui.QApplication.translate("MainWindow", "X:", None, QtGui.QApplication.UnicodeUTF8)) self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout_2.addWidget(self.label) self.rotationX = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.rotationX.setMinimumSize(QtCore.QSize(55, 0)) self.rotationX.setDecimals(0) self.rotationX.setMinimum(-360.0) self.rotationX.setMaximum(360.0) self.rotationX.setObjectName(_fromUtf8("rotationX")) self.horizontalLayout_2.addWidget(self.rotationX) self.label_2 = QtGui.QLabel(self.Transform_groupbox) self.label_2.setText(QtGui.QApplication.translate("MainWindow", "Y:", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setObjectName(_fromUtf8("label_2")) self.horizontalLayout_2.addWidget(self.label_2) self.rotationY = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.rotationY.setMinimumSize(QtCore.QSize(55, 0)) self.rotationY.setDecimals(0) self.rotationY.setMinimum(-360.0) self.rotationY.setMaximum(360.0) self.rotationY.setObjectName(_fromUtf8("rotationY")) self.horizontalLayout_2.addWidget(self.rotationY) self.label_3 = QtGui.QLabel(self.Transform_groupbox) self.label_3.setText(QtGui.QApplication.translate("MainWindow", "Z:", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setObjectName(_fromUtf8("label_3")) self.horizontalLayout_2.addWidget(self.label_3) self.rotationZ = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.rotationZ.setMinimumSize(QtCore.QSize(55, 0)) self.rotationZ.setDecimals(0) self.rotationZ.setMinimum(-360.0) self.rotationZ.setMaximum(360.0) self.rotationZ.setObjectName(_fromUtf8("rotationZ")) self.horizontalLayout_2.addWidget(self.rotationZ) self.verticalLayout_3.addLayout(self.horizontalLayout_2) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.label_8 = QtGui.QLabel(self.Transform_groupbox) self.label_8.setText(QtGui.QApplication.translate("MainWindow", "Scaling Factor:", None, QtGui.QApplication.UnicodeUTF8)) self.label_8.setObjectName(_fromUtf8("label_8")) self.horizontalLayout_3.addWidget(self.label_8) self.scale = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.scale.setMinimumSize(QtCore.QSize(55, 0)) self.scale.setMinimum(-99.99) self.scale.setObjectName(_fromUtf8("scale")) self.horizontalLayout_3.addWidget(self.scale) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem1) self.verticalLayout_3.addLayout(self.horizontalLayout_3) self.horizontalLayout_5.addLayout(self.verticalLayout_3) self.verticalLayout.addWidget(self.Transform_groupbox) self.verticalLayout_2.addLayout(self.verticalLayout) spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem2) self.horizontalLayout.addWidget(self.frame) self.ModelFrame = QtGui.QFrame(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.ModelFrame.sizePolicy().hasHeightForWidth()) self.ModelFrame.setSizePolicy(sizePolicy) self.ModelFrame.setMinimumSize(QtCore.QSize(1024, 0)) self.ModelFrame.setFrameShape(QtGui.QFrame.Box) self.ModelFrame.setFrameShadow(QtGui.QFrame.Plain) self.ModelFrame.setLineWidth(1) self.ModelFrame.setObjectName(_fromUtf8("ModelFrame")) self.horizontalLayout.addWidget(self.ModelFrame) MainWindow.setCentralWidget(self.centralwidget) self.toolBar = QtGui.QToolBar(MainWindow) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(133, 133, 133)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(133, 133, 133)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(133, 133, 133)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush) self.toolBar.setPalette(palette) self.toolBar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "toolBar", None, QtGui.QApplication.UnicodeUTF8)) self.toolBar.setAutoFillBackground(True) self.toolBar.setMovable(False) self.toolBar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.toolBar.setFloatable(False) self.toolBar.setObjectName(_fromUtf8("toolBar")) MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.actionQuit = QtGui.QAction(MainWindow) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/Icons/icons/delete2.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionQuit.setIcon(icon1) self.actionQuit.setText(QtGui.QApplication.translate("MainWindow", "Quit", None, QtGui.QApplication.UnicodeUTF8)) self.actionQuit.setObjectName(_fromUtf8("actionQuit")) self.actionOpen_Model = QtGui.QAction(MainWindow) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/Icons/icons/import1.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionOpen_Model.setIcon(icon2) self.actionOpen_Model.setText(QtGui.QApplication.translate("MainWindow", "Open Model", None, QtGui.QApplication.UnicodeUTF8)) self.actionOpen_Model.setObjectName(_fromUtf8("actionOpen_Model")) self.actionSet_Model_Opacity = QtGui.QAction(MainWindow) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/Icons/icons/replace.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSet_Model_Opacity.setIcon(icon3) self.actionSet_Model_Opacity.setText(QtGui.QApplication.translate("MainWindow", "Set Model Opacity", None, QtGui.QApplication.UnicodeUTF8)) self.actionSet_Model_Opacity.setObjectName(_fromUtf8("actionSet_Model_Opacity")) self.actionPreferences = QtGui.QAction(MainWindow) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(_fromUtf8(":/Icons/icons/gear.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionPreferences.setIcon(icon4) self.actionPreferences.setText(QtGui.QApplication.translate("MainWindow", "Slicing Preferences", None, QtGui.QApplication.UnicodeUTF8)) self.actionPreferences.setObjectName(_fromUtf8("actionPreferences")) self.actionSlice_Model = QtGui.QAction(MainWindow) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(_fromUtf8(":/Icons/icons/media_play_green.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSlice_Model.setIcon(icon5) self.actionSlice_Model.setText(QtGui.QApplication.translate("MainWindow", "Slice Model", None, QtGui.QApplication.UnicodeUTF8)) self.actionSlice_Model.setObjectName(_fromUtf8("actionSlice_Model")) self.toolBar.addAction(self.actionOpen_Model) self.toolBar.addAction(self.actionSlice_Model) self.toolBar.addAction(self.actionSet_Model_Opacity) self.toolBar.addAction(self.actionPreferences) self.toolBar.addSeparator() self.toolBar.addAction(self.actionQuit) self.retranslateUi(MainWindow) QtCore.QObject.connect(self.actionQuit, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.close) QtCore.QObject.connect(self.actionOpen_Model, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.AddModel) QtCore.QObject.connect(self.actionSlice_Model, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.SliceModel) QtCore.QObject.connect(self.actionSet_Model_Opacity, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.UpdateModelOpacity) QtCore.QObject.connect(self.actionPreferences, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.OpenSettingsDialog) QtCore.QObject.connect(self.positionX, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.Update_Position_X) QtCore.QObject.connect(self.positionY, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.Update_Position_Y) QtCore.QObject.connect(self.positionZ, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.Update_Position_Z) QtCore.QObject.connect(self.rotationX, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.Update_Rotation_X) QtCore.QObject.connect(self.rotationY, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.Update_Rotation_Y) QtCore.QObject.connect(self.rotationZ, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.Update_Rotation_Z) QtCore.QObject.connect(self.scale, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.Update_Scale) QtCore.QObject.connect(self.modelList, QtCore.SIGNAL(_fromUtf8("currentItemChanged(QListWidgetItem*,QListWidgetItem*)")), MainWindow.ModelIndexChanged) QtCore.QObject.connect(self.addModel, QtCore.SIGNAL(_fromUtf8("pressed()")), MainWindow.AddModel) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): pass import resource_rc
Python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'manual_control_gui.ui' # # Created: Mon May 06 20:43:40 2013 # by: PyQt4 UI code generator 4.8.5 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_Manual_Control(object): def setupUi(self, Manual_Control): Manual_Control.setObjectName(_fromUtf8("Manual_Control")) Manual_Control.resize(372, 403) Manual_Control.setWindowTitle(QtGui.QApplication.translate("Manual_Control", "3DLP Manual Printer Control", None, QtGui.QApplication.UnicodeUTF8)) self.horizontalLayout_8 = QtGui.QHBoxLayout(Manual_Control) self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8")) self.verticalLayout_5 = QtGui.QVBoxLayout() self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.label = QtGui.QLabel(Manual_Control) font = QtGui.QFont() font.setPointSize(16) self.label.setFont(font) self.label.setText(QtGui.QApplication.translate("Manual_Control", "Manual Printer Control", None, QtGui.QApplication.UnicodeUTF8)) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName(_fromUtf8("label")) self.verticalLayout_5.addWidget(self.label) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.groupBox = QtGui.QGroupBox(Manual_Control) self.groupBox.setTitle(QtGui.QApplication.translate("Manual_Control", "Z Axis", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.horizontalLayout_6 = QtGui.QHBoxLayout(self.groupBox) self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6")) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.Z_10 = QtGui.QRadioButton(self.groupBox) self.Z_10.setText(QtGui.QApplication.translate("Manual_Control", "10mm", None, QtGui.QApplication.UnicodeUTF8)) self.Z_10.setObjectName(_fromUtf8("Z_10")) self.verticalLayout.addWidget(self.Z_10) self.Z_1 = QtGui.QRadioButton(self.groupBox) self.Z_1.setText(QtGui.QApplication.translate("Manual_Control", "1mm", None, QtGui.QApplication.UnicodeUTF8)) self.Z_1.setObjectName(_fromUtf8("Z_1")) self.verticalLayout.addWidget(self.Z_1) self.Z_01 = QtGui.QRadioButton(self.groupBox) self.Z_01.setText(QtGui.QApplication.translate("Manual_Control", "0.1mm", None, QtGui.QApplication.UnicodeUTF8)) self.Z_01.setObjectName(_fromUtf8("Z_01")) self.verticalLayout.addWidget(self.Z_01) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) self.radioButton = QtGui.QRadioButton(self.groupBox) self.radioButton.setText(_fromUtf8("")) self.radioButton.setChecked(True) self.radioButton.setObjectName(_fromUtf8("radioButton")) self.horizontalLayout_5.addWidget(self.radioButton) self.lineEdit = QtGui.QLineEdit(self.groupBox) self.lineEdit.setMinimumSize(QtCore.QSize(0, 0)) self.lineEdit.setObjectName(_fromUtf8("lineEdit")) self.horizontalLayout_5.addWidget(self.lineEdit) self.label_6 = QtGui.QLabel(self.groupBox) self.label_6.setText(QtGui.QApplication.translate("Manual_Control", "steps", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setObjectName(_fromUtf8("label_6")) self.horizontalLayout_5.addWidget(self.label_6) self.verticalLayout.addLayout(self.horizontalLayout_5) self.horizontalLayout.addLayout(self.verticalLayout) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.toolButton = QtGui.QToolButton(self.groupBox) self.toolButton.setText(QtGui.QApplication.translate("Manual_Control", "...", None, QtGui.QApplication.UnicodeUTF8)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/Icons/icons/nav_up_blue.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton.setIcon(icon) self.toolButton.setIconSize(QtCore.QSize(48, 48)) self.toolButton.setObjectName(_fromUtf8("toolButton")) self.verticalLayout_2.addWidget(self.toolButton) self.toolButton_4 = QtGui.QToolButton(self.groupBox) self.toolButton_4.setText(QtGui.QApplication.translate("Manual_Control", "...", None, QtGui.QApplication.UnicodeUTF8)) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/Icons/icons/nav_down_blue.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_4.setIcon(icon1) self.toolButton_4.setIconSize(QtCore.QSize(48, 48)) self.toolButton_4.setObjectName(_fromUtf8("toolButton_4")) self.verticalLayout_2.addWidget(self.toolButton_4) self.horizontalLayout.addLayout(self.verticalLayout_2) self.verticalLayout_3.addLayout(self.horizontalLayout) self.line = QtGui.QFrame(self.groupBox) self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName(_fromUtf8("line")) self.verticalLayout_3.addWidget(self.line) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.label_2 = QtGui.QLabel(self.groupBox) self.label_2.setMaximumSize(QtCore.QSize(15, 30)) font = QtGui.QFont() font.setPointSize(16) self.label_2.setFont(font) self.label_2.setText(QtGui.QApplication.translate("Manual_Control", "Z", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setObjectName(_fromUtf8("label_2")) self.horizontalLayout_3.addWidget(self.label_2) self.DRO_Z = QtGui.QLCDNumber(self.groupBox) self.DRO_Z.setMinimumSize(QtCore.QSize(100, 20)) self.DRO_Z.setSmallDecimalPoint(False) self.DRO_Z.setNumDigits(8) self.DRO_Z.setSegmentStyle(QtGui.QLCDNumber.Flat) self.DRO_Z.setProperty("value", 0.0) self.DRO_Z.setObjectName(_fromUtf8("DRO_Z")) self.horizontalLayout_3.addWidget(self.DRO_Z) self.label_3 = QtGui.QLabel(self.groupBox) self.label_3.setText(QtGui.QApplication.translate("Manual_Control", "mm", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setObjectName(_fromUtf8("label_3")) self.horizontalLayout_3.addWidget(self.label_3) self.verticalLayout_3.addLayout(self.horizontalLayout_3) self.pushButton = QtGui.QPushButton(self.groupBox) self.pushButton.setText(QtGui.QApplication.translate("Manual_Control", "Zero Z Axis", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setAutoDefault(False) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.verticalLayout_3.addWidget(self.pushButton) self.line_3 = QtGui.QFrame(self.groupBox) self.line_3.setFrameShape(QtGui.QFrame.HLine) self.line_3.setFrameShadow(QtGui.QFrame.Sunken) self.line_3.setObjectName(_fromUtf8("line_3")) self.verticalLayout_3.addWidget(self.line_3) self.verticalLayout_7 = QtGui.QVBoxLayout() self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7")) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) self.pushButton_3 = QtGui.QPushButton(self.groupBox) self.pushButton_3.setText(QtGui.QApplication.translate("Manual_Control", "Fast Up", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_3.setAutoDefault(False) self.pushButton_3.setObjectName(_fromUtf8("pushButton_3")) self.horizontalLayout_9.addWidget(self.pushButton_3) self.pushButton_4 = QtGui.QPushButton(self.groupBox) self.pushButton_4.setText(QtGui.QApplication.translate("Manual_Control", "Fast Down", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_4.setAutoDefault(False) self.pushButton_4.setObjectName(_fromUtf8("pushButton_4")) self.horizontalLayout_9.addWidget(self.pushButton_4) self.verticalLayout_7.addLayout(self.horizontalLayout_9) self.pushButton_5 = QtGui.QPushButton(self.groupBox) self.pushButton_5.setText(QtGui.QApplication.translate("Manual_Control", "Home Z Axis", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_5.setAutoDefault(False) self.pushButton_5.setObjectName(_fromUtf8("pushButton_5")) self.verticalLayout_7.addWidget(self.pushButton_5) self.verticalLayout_3.addLayout(self.verticalLayout_7) self.horizontalLayout_6.addLayout(self.verticalLayout_3) self.horizontalLayout_4.addWidget(self.groupBox) self.verticalLayout_4 = QtGui.QVBoxLayout() self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.groupBox_2 = QtGui.QGroupBox(Manual_Control) self.groupBox_2.setTitle(QtGui.QApplication.translate("Manual_Control", "X Axis", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) self.horizontalLayout_2 = QtGui.QHBoxLayout(self.groupBox_2) self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.toolButton_2 = QtGui.QToolButton(self.groupBox_2) self.toolButton_2.setText(QtGui.QApplication.translate("Manual_Control", "Trigger X Axis", None, QtGui.QApplication.UnicodeUTF8)) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/Icons/icons/nav_right_blue.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_2.setIcon(icon2) self.toolButton_2.setIconSize(QtCore.QSize(48, 48)) self.toolButton_2.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.toolButton_2.setObjectName(_fromUtf8("toolButton_2")) self.horizontalLayout_2.addWidget(self.toolButton_2) self.verticalLayout_4.addWidget(self.groupBox_2) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_4.addItem(spacerItem1) self.horizontalLayout_4.addLayout(self.verticalLayout_4) self.verticalLayout_5.addLayout(self.horizontalLayout_4) self.line_4 = QtGui.QFrame(Manual_Control) self.line_4.setFrameShape(QtGui.QFrame.HLine) self.line_4.setFrameShadow(QtGui.QFrame.Sunken) self.line_4.setObjectName(_fromUtf8("line_4")) self.verticalLayout_5.addWidget(self.line_4) self.horizontalLayout_7 = QtGui.QHBoxLayout() self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7")) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_7.addItem(spacerItem2) self.toolButton_3 = QtGui.QToolButton(Manual_Control) self.toolButton_3.setText(QtGui.QApplication.translate("Manual_Control", "Stop Motion", None, QtGui.QApplication.UnicodeUTF8)) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/Icons/icons/stop.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_3.setIcon(icon3) self.toolButton_3.setIconSize(QtCore.QSize(32, 32)) self.toolButton_3.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.toolButton_3.setObjectName(_fromUtf8("toolButton_3")) self.horizontalLayout_7.addWidget(self.toolButton_3) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_7.addItem(spacerItem3) self.verticalLayout_5.addLayout(self.horizontalLayout_7) self.horizontalLayout_8.addLayout(self.verticalLayout_5) self.retranslateUi(Manual_Control) QtCore.QObject.connect(self.toolButton, QtCore.SIGNAL(_fromUtf8("clicked()")), Manual_Control.Z_up) QtCore.QObject.connect(self.toolButton_4, QtCore.SIGNAL(_fromUtf8("clicked()")), Manual_Control.Z_down) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), Manual_Control.Zero_Z) QtCore.QObject.connect(self.toolButton_2, QtCore.SIGNAL(_fromUtf8("clicked()")), Manual_Control.activateX) QtCore.QMetaObject.connectSlotsByName(Manual_Control) def retranslateUi(self, Manual_Control): pass import resource_rc
Python
#!/usr/bin/env python # # build_arduino.py - build, link and upload sketches script for Arduino # Copyright (c) 2010 Ben Sasson. All right reserved. # # 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 3 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, see <http://www.gnu.org/licenses/>. # import sys import os import optparse EXITCODE_OK = 0 EXITCODE_NO_UPLOAD_DEVICE = 1 EXITCODE_NO_WPROGRAM = 2 EXITCODE_INVALID_AVR_PATH = 3 CPU_CLOCK = 16000000 ARCH = 'atmega328p' ENV_VERSION = 18 BAUD = 57600 CORE = 'arduino' COMPILERS = { '.c': 'gcc', '.cpp': 'g++', } def _exec(cmdline, debug=True, valid_exitcode=0, simulate=False): if debug or simulate: print cmdline if not simulate: exitcode = os.system(cmdline) if exitcode != valid_exitcode: print '-'*20 + ' exitcode %d ' % exitcode + '-'*20 sys.exit(exitcode) def compile_source(source, avr_path='', target_dir=None, arch=ARCH, clock=CPU_CLOCK, include_dirs=[], verbose=False, simulate=False): """ compile a single source file, using compiler selected based on file extension and translating arguments to valid compiler flags. """ filename, ext = os.path.splitext(source) compiler = COMPILERS.get(ext, None) if compiler is None: print source, 'has no known compiler' return if target_dir is None: target_dir = os.path.dirname(source) target = os.path.join(target_dir, os.path.basename(source) + '.o') env = dict(source=source, target=target, arch=arch, clock=clock, env_version=ENV_VERSION, compiler=compiler, avr_path=avr_path) # create include list, don't use set() because order matters dirs = [os.path.dirname(source)] for d in include_dirs: if d not in dirs: dirs.append(d) env['include_dirs'] = ' '.join('-I%s' % d for d in dirs) if verbose: env['verbose'] = '-v' else: env['verbose'] = '' cmdline = '""%(avr_path)s%(compiler)s"" -c %(verbose)s -g -Os -w -ffunction-sections -fdata-sections -mmcu=%(arch)s -DF_CPU=%(clock)dL -DARDUINO=%(env_version)d %(include_dirs)s "%(source)s" -o"%(target)s"' % env _exec(cmdline, simulate=simulate) return target def compile_directory(directory, target_dir=None, include_dirs=[], avr_path='', arch=ARCH, clock=CPU_CLOCK, verbose=False, simulate=False): """ compile all source files in a given directory, return a list of all .obj files created """ obj_files = [] for fname in os.listdir(directory): if os.path.isfile(os.path.join(directory, fname)): obj_files.append(compile_source(os.path.join(directory, fname), include_dirs=include_dirs, avr_path=avr_path, target_dir=target_dir, arch=arch, clock=clock, verbose=verbose, simulate=simulate)) return filter(lambda o: o, obj_files) def append_to_archive(obj_file, archive, avr_path='', verbose=False, simulate=False): """ create an .a archive out of .obj files """ env = dict(obj_file=obj_file, archive=archive, avr_path=avr_path) if verbose: env['verbose'] = 'v' else: env['verbose'] = '' cmdline = '%(avr_path)savr-ar rcs%(verbose)s %(archive)s %(obj_file)s' % env _exec(cmdline, simulate=simulate) def link(target, files, arch=ARCH, avr_path='', verbose=False, simulate=False): """ link .obj files to a single .elf file """ env = dict(target=target, files=' '.join(files), link_dir=os.path.dirname(target), arch=arch, avr_path=avr_path) if verbose: env['verbose'] = '-v' else: env['verbose'] = '' cmdline = '%(avr_path)savr-gcc %(verbose)s -Os -Wl,--gc-sections -mmcu=%(arch)s -o %(target)s %(files)s -L%(link_dir)s -lm' % env _exec(cmdline, simulate=simulate) def make_hex(elf, avr_path='', verbose=False, simulate=False): """ slice elf to .hex (program) end .eep (EEProm) files """ eeprom_section = os.path.splitext(elf)[0] + '.epp' hex_section = os.path.splitext(elf)[0] + '.hex' env = dict(elf=elf, eeprom_section=eeprom_section, hex_section=hex_section, avr_path=avr_path) if verbose: env['verbose'] = '-v' else: env['verbose'] = '' cmdline_make_eeprom = '%(avr_path)savr-objcopy %(verbose)s -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 %(elf)s %(eeprom_section)s' % env _exec(cmdline_make_eeprom, simulate=simulate) cmdline_make_hex = '%(avr_path)savr-objcopy %(verbose)s -O ihex -R .eeprom %(elf)s %(hex_section)s' % env _exec(cmdline_make_hex, simulate=simulate) return hex_section, eeprom_section def upload(hex_section, dev, avr_path='', dude_conf=None, arch=ARCH, core=CORE, baud=BAUD, verbose=False, simulate=False): """ Upload .hex file to arduino board """ env = dict(hex_section=hex_section, dev=dev, arch=arch, core=core, baud=baud, avr_path=avr_path) if verbose: env['verbose'] = '-v' else: env['verbose'] = '' if dude_conf is not None: env['dude_conf'] = '-C' + dude_conf else: env['dude_conf'] = '' cmdline = '%(avr_path)savrdude %(verbose)s %(dude_conf)s -p%(arch)s -c%(core)s -P%(dev)s -b%(baud)d -D -Uflash:w:%(hex_section)s:i' % env _exec(cmdline, simulate=simulate) def main(argv): parser = optparse.OptionParser() parser.add_option('-d', '--directory', dest='directory', default='.', help='project directory') parser.add_option('-v', '--verbose', dest='verbose', default=False, action='store_true', help='be verbose') parser.add_option('--only-build', dest='only_build', default=False, action='store_true', help="only build, don't upload") parser.add_option('-u', '--upload-device', dest='upload_device', metavar='DEVICE', help='use DEVICE to upload code') parser.add_option('-i', '--include', dest='include_dirs', default=[], action='append', metavar='DIRECTORY', help='append DIRECTORY to include list') parser.add_option('-l', '--libraries', dest='libraries', default=[], action='append', metavar='DIRECTORY', help='append DIRECTORY to libraries search & build path') parser.add_option('-W', '--WProgram-dir', dest='wprogram_directory', metavar='DIRECTORY', help='DIRECTORY of WProgram.h and the rest of core files') parser.add_option('--avr-path', dest='avr_path', metavar='DIRECTORY', help='DIRECTORY where avr* programs located, if not specified - will assume found in default search path') parser.add_option('--dude-conf', dest='dude_conf', default=None, metavar='FILE', help='avrdude conf file, if not specified - will assume found in default location') parser.add_option('--simulate', dest='simulate', default=False, action='store_true', help='only simulate commands') parser.add_option('--core', dest='core', default=CORE, help='device core name [%s]' % CORE) parser.add_option('--arch', dest='arch', default=ARCH, help='device architecture name [%s]' % ARCH) parser.add_option('--baud', dest='baud', default=BAUD, type='int', help='upload baud rate [%d]' % BAUD) parser.add_option('--cpu-clock', dest='cpu_clock', default=CPU_CLOCK, metavar='Hz', action='store', type='int', help='target device CPU clock [%d]' % CPU_CLOCK) options, args = parser.parse_args(argv) if options.wprogram_directory is None or not os.path.exists(options.wprogram_directory) or not os.path.isdir(options.wprogram_directory): if options.verbose: print 'WProgram directory was not specified or does not exist [%s]' % options.wprogram_directory sys.exit(EXITCODE_NO_WPROGRAM) core_files = options.wprogram_directory if options.avr_path is not None: if not os.path.exists(options.avr_path) or not os.path.isdir(options.avr_path): if options.verbose: print 'avr-path was specified but does not exist or not a directory [%s]' % options.avr_path sys.exit(EXITCODE_INVALID_AVR_PATH) avr_path = os.path.join(options.avr_path, '') else: avr_path = '' # create build directory to store the compilation output files build_directory = os.path.join(options.directory, '_build') if not os.path.exists(build_directory): os.makedirs(build_directory) # compile arduino core files core_obj_files = compile_directory(core_files, build_directory, include_dirs=[core_files], avr_path=avr_path, arch=options.arch, clock=options.cpu_clock, verbose=options.verbose, simulate=options.simulate) # compile directories passed to program libraries_obj_files = [] for library in options.libraries: libraries_obj_files.extend(compile_directory(library, build_directory, include_dirs=options.libraries + [core_files], avr_path=avr_path, arch=options.arch, clock=options.cpu_clock, verbose=options.verbose, simulate=options.simulate)) # compile project project_obj_files = compile_directory(options.directory, build_directory, include_dirs=(options.include_dirs + options.libraries + [core_files]), avr_path=avr_path, arch=options.arch, clock=options.cpu_clock, verbose=options.verbose, simulate=options.simulate) # link project, libraries and core .obj files to a single .elf link_output = os.path.join(build_directory, os.path.basename(options.directory) + '.elf') link(link_output, project_obj_files + libraries_obj_files + core_obj_files, avr_path=avr_path, verbose=options.verbose, simulate=options.simulate) hex_section, eeprom_section = make_hex(link_output, avr_path=avr_path, verbose=options.verbose, simulate=options.simulate) # upload .hex file to arduino if needed if not options.only_build: if options.upload_device is None: if options.verbose: print 'no upload device selected' sys.exit(EXITCODE_NO_UPLOAD_DEVICE) upload(hex_section, dev=options.upload_device, dude_conf=options.dude_conf, avr_path=avr_path, arch=options.arch, core=options.core, baud=options.baud, verbose=options.verbose, simulate=options.simulate) if __name__ == '__main__': main(sys.argv)
Python
#!/usr/bin/env python # # build_arduino.py - build, link and upload sketches script for Arduino # Copyright (c) 2010 Ben Sasson. All right reserved. # # 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 3 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, see <http://www.gnu.org/licenses/>. # import sys import os import optparse EXITCODE_OK = 0 EXITCODE_NO_UPLOAD_DEVICE = 1 EXITCODE_NO_WPROGRAM = 2 EXITCODE_INVALID_AVR_PATH = 3 CPU_CLOCK = 16000000 ARCH = 'atmega328p' ENV_VERSION = 18 BAUD = 57600 CORE = 'arduino' COMPILERS = { '.c': 'gcc', '.cpp': 'g++', } def _exec(cmdline, debug=True, valid_exitcode=0, simulate=False): if debug or simulate: print cmdline if not simulate: exitcode = os.system(cmdline) if exitcode != valid_exitcode: print '-'*20 + ' exitcode %d ' % exitcode + '-'*20 sys.exit(exitcode) def compile_source(source, avr_path='', target_dir=None, arch=ARCH, clock=CPU_CLOCK, include_dirs=[], verbose=False, simulate=False): """ compile a single source file, using compiler selected based on file extension and translating arguments to valid compiler flags. """ filename, ext = os.path.splitext(source) compiler = COMPILERS.get(ext, None) if compiler is None: print source, 'has no known compiler' return if target_dir is None: target_dir = os.path.dirname(source) target = os.path.join(target_dir, os.path.basename(source) + '.o') env = dict(source=source, target=target, arch=arch, clock=clock, env_version=ENV_VERSION, compiler=compiler, avr_path=avr_path) # create include list, don't use set() because order matters dirs = [os.path.dirname(source)] for d in include_dirs: if d not in dirs: dirs.append(d) env['include_dirs'] = ' '.join('-I%s' % d for d in dirs) if verbose: env['verbose'] = '-v' else: env['verbose'] = '' cmdline = '""%(avr_path)s%(compiler)s"" -c %(verbose)s -g -Os -w -ffunction-sections -fdata-sections -mmcu=%(arch)s -DF_CPU=%(clock)dL -DARDUINO=%(env_version)d %(include_dirs)s "%(source)s" -o"%(target)s"' % env _exec(cmdline, simulate=simulate) return target def compile_directory(directory, target_dir=None, include_dirs=[], avr_path='', arch=ARCH, clock=CPU_CLOCK, verbose=False, simulate=False): """ compile all source files in a given directory, return a list of all .obj files created """ obj_files = [] for fname in os.listdir(directory): if os.path.isfile(os.path.join(directory, fname)): obj_files.append(compile_source(os.path.join(directory, fname), include_dirs=include_dirs, avr_path=avr_path, target_dir=target_dir, arch=arch, clock=clock, verbose=verbose, simulate=simulate)) return filter(lambda o: o, obj_files) def append_to_archive(obj_file, archive, avr_path='', verbose=False, simulate=False): """ create an .a archive out of .obj files """ env = dict(obj_file=obj_file, archive=archive, avr_path=avr_path) if verbose: env['verbose'] = 'v' else: env['verbose'] = '' cmdline = '%(avr_path)savr-ar rcs%(verbose)s %(archive)s %(obj_file)s' % env _exec(cmdline, simulate=simulate) def link(target, files, arch=ARCH, avr_path='', verbose=False, simulate=False): """ link .obj files to a single .elf file """ env = dict(target=target, files=' '.join(files), link_dir=os.path.dirname(target), arch=arch, avr_path=avr_path) if verbose: env['verbose'] = '-v' else: env['verbose'] = '' cmdline = '%(avr_path)savr-gcc %(verbose)s -Os -Wl,--gc-sections -mmcu=%(arch)s -o %(target)s %(files)s -L%(link_dir)s -lm' % env _exec(cmdline, simulate=simulate) def make_hex(elf, avr_path='', verbose=False, simulate=False): """ slice elf to .hex (program) end .eep (EEProm) files """ eeprom_section = os.path.splitext(elf)[0] + '.epp' hex_section = os.path.splitext(elf)[0] + '.hex' env = dict(elf=elf, eeprom_section=eeprom_section, hex_section=hex_section, avr_path=avr_path) if verbose: env['verbose'] = '-v' else: env['verbose'] = '' cmdline_make_eeprom = '%(avr_path)savr-objcopy %(verbose)s -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 %(elf)s %(eeprom_section)s' % env _exec(cmdline_make_eeprom, simulate=simulate) cmdline_make_hex = '%(avr_path)savr-objcopy %(verbose)s -O ihex -R .eeprom %(elf)s %(hex_section)s' % env _exec(cmdline_make_hex, simulate=simulate) return hex_section, eeprom_section def upload(hex_section, dev, avr_path='', dude_conf=None, arch=ARCH, core=CORE, baud=BAUD, verbose=False, simulate=False): """ Upload .hex file to arduino board """ env = dict(hex_section=hex_section, dev=dev, arch=arch, core=core, baud=baud, avr_path=avr_path) if verbose: env['verbose'] = '-v' else: env['verbose'] = '' if dude_conf is not None: env['dude_conf'] = '-C' + dude_conf else: env['dude_conf'] = '' cmdline = '%(avr_path)savrdude %(verbose)s %(dude_conf)s -p%(arch)s -c%(core)s -P%(dev)s -b%(baud)d -D -Uflash:w:%(hex_section)s:i' % env _exec(cmdline, simulate=simulate) def main(argv): parser = optparse.OptionParser() parser.add_option('-d', '--directory', dest='directory', default='.', help='project directory') parser.add_option('-v', '--verbose', dest='verbose', default=False, action='store_true', help='be verbose') parser.add_option('--only-build', dest='only_build', default=False, action='store_true', help="only build, don't upload") parser.add_option('-u', '--upload-device', dest='upload_device', metavar='DEVICE', help='use DEVICE to upload code') parser.add_option('-i', '--include', dest='include_dirs', default=[], action='append', metavar='DIRECTORY', help='append DIRECTORY to include list') parser.add_option('-l', '--libraries', dest='libraries', default=[], action='append', metavar='DIRECTORY', help='append DIRECTORY to libraries search & build path') parser.add_option('-W', '--WProgram-dir', dest='wprogram_directory', metavar='DIRECTORY', help='DIRECTORY of WProgram.h and the rest of core files') parser.add_option('--avr-path', dest='avr_path', metavar='DIRECTORY', help='DIRECTORY where avr* programs located, if not specified - will assume found in default search path') parser.add_option('--dude-conf', dest='dude_conf', default=None, metavar='FILE', help='avrdude conf file, if not specified - will assume found in default location') parser.add_option('--simulate', dest='simulate', default=False, action='store_true', help='only simulate commands') parser.add_option('--core', dest='core', default=CORE, help='device core name [%s]' % CORE) parser.add_option('--arch', dest='arch', default=ARCH, help='device architecture name [%s]' % ARCH) parser.add_option('--baud', dest='baud', default=BAUD, type='int', help='upload baud rate [%d]' % BAUD) parser.add_option('--cpu-clock', dest='cpu_clock', default=CPU_CLOCK, metavar='Hz', action='store', type='int', help='target device CPU clock [%d]' % CPU_CLOCK) options, args = parser.parse_args(argv) if options.wprogram_directory is None or not os.path.exists(options.wprogram_directory) or not os.path.isdir(options.wprogram_directory): if options.verbose: print 'WProgram directory was not specified or does not exist [%s]' % options.wprogram_directory sys.exit(EXITCODE_NO_WPROGRAM) core_files = options.wprogram_directory if options.avr_path is not None: if not os.path.exists(options.avr_path) or not os.path.isdir(options.avr_path): if options.verbose: print 'avr-path was specified but does not exist or not a directory [%s]' % options.avr_path sys.exit(EXITCODE_INVALID_AVR_PATH) avr_path = os.path.join(options.avr_path, '') else: avr_path = '' # create build directory to store the compilation output files build_directory = os.path.join(options.directory, '_build') if not os.path.exists(build_directory): os.makedirs(build_directory) # compile arduino core files core_obj_files = compile_directory(core_files, build_directory, include_dirs=[core_files], avr_path=avr_path, arch=options.arch, clock=options.cpu_clock, verbose=options.verbose, simulate=options.simulate) # compile directories passed to program libraries_obj_files = [] for library in options.libraries: libraries_obj_files.extend(compile_directory(library, build_directory, include_dirs=options.libraries + [core_files], avr_path=avr_path, arch=options.arch, clock=options.cpu_clock, verbose=options.verbose, simulate=options.simulate)) # compile project project_obj_files = compile_directory(options.directory, build_directory, include_dirs=(options.include_dirs + options.libraries + [core_files]), avr_path=avr_path, arch=options.arch, clock=options.cpu_clock, verbose=options.verbose, simulate=options.simulate) # link project, libraries and core .obj files to a single .elf link_output = os.path.join(build_directory, os.path.basename(options.directory) + '.elf') link(link_output, project_obj_files + libraries_obj_files + core_obj_files, avr_path=avr_path, verbose=options.verbose, simulate=options.simulate) hex_section, eeprom_section = make_hex(link_output, avr_path=avr_path, verbose=options.verbose, simulate=options.simulate) # upload .hex file to arduino if needed if not options.only_build: if options.upload_device is None: if options.verbose: print 'no upload device selected' sys.exit(EXITCODE_NO_UPLOAD_DEVICE) upload(hex_section, dev=options.upload_device, dude_conf=options.dude_conf, avr_path=avr_path, arch=options.arch, core=options.core, baud=options.baud, verbose=options.verbose, simulate=options.simulate) if __name__ == '__main__': main(sys.argv)
Python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'settingsdialog.ui' # # Created: Mon May 13 19:24:11 2013 # by: PyQt4 UI code generator 4.8.5 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_SettingsDialogBaseClass(object): def setupUi(self, SettingsDialogBaseClass): SettingsDialogBaseClass.setObjectName(_fromUtf8("SettingsDialogBaseClass")) SettingsDialogBaseClass.resize(742, 452) SettingsDialogBaseClass.setWindowTitle(QtGui.QApplication.translate("SettingsDialogBaseClass", "3DLP Settings", None, QtGui.QApplication.UnicodeUTF8)) self.horizontalLayout_21 = QtGui.QHBoxLayout(SettingsDialogBaseClass) self.horizontalLayout_21.setObjectName(_fromUtf8("horizontalLayout_21")) self.verticalLayout_11 = QtGui.QVBoxLayout() self.verticalLayout_11.setObjectName(_fromUtf8("verticalLayout_11")) self.horizontalLayout_19 = QtGui.QHBoxLayout() self.horizontalLayout_19.setObjectName(_fromUtf8("horizontalLayout_19")) self.verticalLayout_9 = QtGui.QVBoxLayout() self.verticalLayout_9.setObjectName(_fromUtf8("verticalLayout_9")) self.horizontalLayout_18 = QtGui.QHBoxLayout() self.horizontalLayout_18.setObjectName(_fromUtf8("horizontalLayout_18")) self.groupBox_2 = QtGui.QGroupBox(SettingsDialogBaseClass) self.groupBox_2.setTitle(QtGui.QApplication.translate("SettingsDialogBaseClass", "Printing Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) self.horizontalLayout_17 = QtGui.QHBoxLayout(self.groupBox_2) self.horizontalLayout_17.setObjectName(_fromUtf8("horizontalLayout_17")) self.horizontalLayout_16 = QtGui.QHBoxLayout() self.horizontalLayout_16.setObjectName(_fromUtf8("horizontalLayout_16")) self.verticalLayout_8 = QtGui.QVBoxLayout() self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) self.enableprintercontrol = QtGui.QCheckBox(self.groupBox_2) self.enableprintercontrol.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Enable Printer Control?", None, QtGui.QApplication.UnicodeUTF8)) self.enableprintercontrol.setChecked(False) self.enableprintercontrol.setObjectName(_fromUtf8("enableprintercontrol")) self.verticalLayout_8.addWidget(self.enableprintercontrol) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setContentsMargins(-1, -1, 0, -1) self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.radio_arduinoUno = QtGui.QRadioButton(self.groupBox_2) self.radio_arduinoUno.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Arduino Uno", None, QtGui.QApplication.UnicodeUTF8)) self.radio_arduinoUno.setChecked(True) self.radio_arduinoUno.setObjectName(_fromUtf8("radio_arduinoUno")) self.horizontalLayout_4.addWidget(self.radio_arduinoUno) self.radio_arduinoMega = QtGui.QRadioButton(self.groupBox_2) self.radio_arduinoMega.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Arduino Mega", None, QtGui.QApplication.UnicodeUTF8)) self.radio_arduinoMega.setObjectName(_fromUtf8("radio_arduinoMega")) self.horizontalLayout_4.addWidget(self.radio_arduinoMega) self.radio_pyMCU = QtGui.QRadioButton(self.groupBox_2) self.radio_pyMCU.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "PyMCU", None, QtGui.QApplication.UnicodeUTF8)) self.radio_pyMCU.setObjectName(_fromUtf8("radio_pyMCU")) self.horizontalLayout_4.addWidget(self.radio_pyMCU) self.radio_ramps = QtGui.QRadioButton(self.groupBox_2) self.radio_ramps.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "RAMPS", None, QtGui.QApplication.UnicodeUTF8)) self.radio_ramps.setObjectName(_fromUtf8("radio_ramps")) self.horizontalLayout_4.addWidget(self.radio_ramps) self.verticalLayout_8.addLayout(self.horizontalLayout_4) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.label_29 = QtGui.QLabel(self.groupBox_2) self.label_29.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Port:", None, QtGui.QApplication.UnicodeUTF8)) self.label_29.setObjectName(_fromUtf8("label_29")) self.horizontalLayout_3.addWidget(self.label_29) self.pickcom = QtGui.QComboBox(self.groupBox_2) self.pickcom.setObjectName(_fromUtf8("pickcom")) self.horizontalLayout_3.addWidget(self.pickcom) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.verticalLayout_8.addLayout(self.horizontalLayout_3) self.enableslideshow = QtGui.QCheckBox(self.groupBox_2) self.enableslideshow.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Enable Slideshow?", None, QtGui.QApplication.UnicodeUTF8)) self.enableslideshow.setObjectName(_fromUtf8("enableslideshow")) self.verticalLayout_8.addWidget(self.enableslideshow) self.horizontalLayout_10 = QtGui.QHBoxLayout() self.horizontalLayout_10.setObjectName(_fromUtf8("horizontalLayout_10")) self.label_25 = QtGui.QLabel(self.groupBox_2) self.label_25.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Choose monitor to print on:", None, QtGui.QApplication.UnicodeUTF8)) self.label_25.setObjectName(_fromUtf8("label_25")) self.horizontalLayout_10.addWidget(self.label_25) self.pickscreen = QtGui.QComboBox(self.groupBox_2) self.pickscreen.setObjectName(_fromUtf8("pickscreen")) self.horizontalLayout_10.addWidget(self.pickscreen) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_10.addItem(spacerItem1) self.verticalLayout_8.addLayout(self.horizontalLayout_10) spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_8.addItem(spacerItem2) self.horizontalLayout_16.addLayout(self.verticalLayout_8) self.horizontalLayout_17.addLayout(self.horizontalLayout_16) self.horizontalLayout_18.addWidget(self.groupBox_2) self.groupBox_4 = QtGui.QGroupBox(SettingsDialogBaseClass) self.groupBox_4.setTitle(QtGui.QApplication.translate("SettingsDialogBaseClass", "Stepping Mode", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_4.setObjectName(_fromUtf8("groupBox_4")) self.horizontalLayout_13 = QtGui.QHBoxLayout(self.groupBox_4) self.horizontalLayout_13.setObjectName(_fromUtf8("horizontalLayout_13")) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.radioButton = QtGui.QRadioButton(self.groupBox_4) self.radioButton.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Full Stepping", None, QtGui.QApplication.UnicodeUTF8)) self.radioButton.setChecked(True) self.radioButton.setObjectName(_fromUtf8("radioButton")) self.verticalLayout_3.addWidget(self.radioButton) self.radioButton_2 = QtGui.QRadioButton(self.groupBox_4) self.radioButton_2.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "1/2 Microstepping", None, QtGui.QApplication.UnicodeUTF8)) self.radioButton_2.setObjectName(_fromUtf8("radioButton_2")) self.verticalLayout_3.addWidget(self.radioButton_2) self.radioButton_3 = QtGui.QRadioButton(self.groupBox_4) self.radioButton_3.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "1/4 Microstepping", None, QtGui.QApplication.UnicodeUTF8)) self.radioButton_3.setObjectName(_fromUtf8("radioButton_3")) self.verticalLayout_3.addWidget(self.radioButton_3) self.radioButton_4 = QtGui.QRadioButton(self.groupBox_4) self.radioButton_4.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "1/8 Microstepping", None, QtGui.QApplication.UnicodeUTF8)) self.radioButton_4.setObjectName(_fromUtf8("radioButton_4")) self.verticalLayout_3.addWidget(self.radioButton_4) self.radioButton_5 = QtGui.QRadioButton(self.groupBox_4) self.radioButton_5.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "1/16 Microstepping", None, QtGui.QApplication.UnicodeUTF8)) self.radioButton_5.setObjectName(_fromUtf8("radioButton_5")) self.verticalLayout_3.addWidget(self.radioButton_5) self.horizontalLayout_13.addLayout(self.verticalLayout_3) self.horizontalLayout_18.addWidget(self.groupBox_4) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_18.addItem(spacerItem3) self.verticalLayout_9.addLayout(self.horizontalLayout_18) self.groupBox_5 = QtGui.QGroupBox(SettingsDialogBaseClass) self.groupBox_5.setTitle(QtGui.QApplication.translate("SettingsDialogBaseClass", "Layer Advance Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_5.setObjectName(_fromUtf8("groupBox_5")) self.horizontalLayout_15 = QtGui.QHBoxLayout(self.groupBox_5) self.horizontalLayout_15.setObjectName(_fromUtf8("horizontalLayout_15")) self.verticalLayout_7 = QtGui.QVBoxLayout() self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7")) self.horizontalLayout_14 = QtGui.QHBoxLayout() self.horizontalLayout_14.setObjectName(_fromUtf8("horizontalLayout_14")) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem4) self.horizontalLayout_8 = QtGui.QHBoxLayout() self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8")) self.label_26 = QtGui.QLabel(self.groupBox_5) self.label_26.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Number of starting layers", None, QtGui.QApplication.UnicodeUTF8)) self.label_26.setObjectName(_fromUtf8("label_26")) self.horizontalLayout_8.addWidget(self.label_26) self.starting_layers = QtGui.QLineEdit(self.groupBox_5) self.starting_layers.setText(_fromUtf8("")) self.starting_layers.setObjectName(_fromUtf8("starting_layers")) self.horizontalLayout_8.addWidget(self.starting_layers) self.horizontalLayout_14.addLayout(self.horizontalLayout_8) spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem5) self.verticalLayout_7.addLayout(self.horizontalLayout_14) self.line_2 = QtGui.QFrame(self.groupBox_5) self.line_2.setFrameShape(QtGui.QFrame.HLine) self.line_2.setFrameShadow(QtGui.QFrame.Sunken) self.line_2.setObjectName(_fromUtf8("line_2")) self.verticalLayout_7.addWidget(self.line_2) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.label = QtGui.QLabel(self.groupBox_5) font = QtGui.QFont() font.setPointSize(10) font.setBold(False) font.setWeight(50) self.label.setFont(font) self.label.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Starting Layers", None, QtGui.QApplication.UnicodeUTF8)) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName(_fromUtf8("label")) self.verticalLayout.addWidget(self.label) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) self.label_27 = QtGui.QLabel(self.groupBox_5) self.label_27.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Starting layer exposure ", None, QtGui.QApplication.UnicodeUTF8)) self.label_27.setObjectName(_fromUtf8("label_27")) self.horizontalLayout_9.addWidget(self.label_27) self.starting_layer_exposure = QtGui.QLineEdit(self.groupBox_5) self.starting_layer_exposure.setText(_fromUtf8("")) self.starting_layer_exposure.setObjectName(_fromUtf8("starting_layer_exposure")) self.horizontalLayout_9.addWidget(self.starting_layer_exposure) self.label_30 = QtGui.QLabel(self.groupBox_5) self.label_30.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "s", None, QtGui.QApplication.UnicodeUTF8)) self.label_30.setObjectName(_fromUtf8("label_30")) self.horizontalLayout_9.addWidget(self.label_30) self.verticalLayout.addLayout(self.horizontalLayout_9) self.groupBox_6 = QtGui.QGroupBox(self.groupBox_5) self.groupBox_6.setMinimumSize(QtCore.QSize(0, 80)) self.groupBox_6.setTitle(QtGui.QApplication.translate("SettingsDialogBaseClass", "Inter-layer scripting", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_6.setObjectName(_fromUtf8("groupBox_6")) self.horizontalLayout_12 = QtGui.QHBoxLayout(self.groupBox_6) self.horizontalLayout_12.setObjectName(_fromUtf8("horizontalLayout_12")) self.zscript_2 = QtGui.QPlainTextEdit(self.groupBox_6) self.zscript_2.setObjectName(_fromUtf8("zscript_2")) self.horizontalLayout_12.addWidget(self.zscript_2) self.verticalLayout.addWidget(self.groupBox_6) self.horizontalLayout_5.addLayout(self.verticalLayout) self.line = QtGui.QFrame(self.groupBox_5) self.line.setFrameShape(QtGui.QFrame.VLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName(_fromUtf8("line")) self.horizontalLayout_5.addWidget(self.line) self.verticalLayout_4 = QtGui.QVBoxLayout() self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.label_2 = QtGui.QLabel(self.groupBox_5) font = QtGui.QFont() font.setPointSize(10) font.setBold(False) font.setWeight(50) self.label_2.setFont(font) self.label_2.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Normal Layers", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName(_fromUtf8("label_2")) self.verticalLayout_4.addWidget(self.label_2) self.horizontalLayout_20 = QtGui.QHBoxLayout() self.horizontalLayout_20.setObjectName(_fromUtf8("horizontalLayout_20")) self.label_6 = QtGui.QLabel(self.groupBox_5) self.label_6.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Exposure Time", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setObjectName(_fromUtf8("label_6")) self.horizontalLayout_20.addWidget(self.label_6) self.horizontalLayout_6 = QtGui.QHBoxLayout() self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6")) self.exposure_time = QtGui.QLineEdit(self.groupBox_5) self.exposure_time.setText(_fromUtf8("")) self.exposure_time.setObjectName(_fromUtf8("exposure_time")) self.horizontalLayout_6.addWidget(self.exposure_time) self.label_28 = QtGui.QLabel(self.groupBox_5) self.label_28.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "s", None, QtGui.QApplication.UnicodeUTF8)) self.label_28.setObjectName(_fromUtf8("label_28")) self.horizontalLayout_6.addWidget(self.label_28) self.horizontalLayout_20.addLayout(self.horizontalLayout_6) self.verticalLayout_4.addLayout(self.horizontalLayout_20) self.groupBox = QtGui.QGroupBox(self.groupBox_5) self.groupBox.setMinimumSize(QtCore.QSize(0, 80)) self.groupBox.setTitle(QtGui.QApplication.translate("SettingsDialogBaseClass", "Inter-layer scripting", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.horizontalLayout_7 = QtGui.QHBoxLayout(self.groupBox) self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7")) self.zscript = QtGui.QPlainTextEdit(self.groupBox) self.zscript.setObjectName(_fromUtf8("zscript")) self.horizontalLayout_7.addWidget(self.zscript) self.verticalLayout_4.addWidget(self.groupBox) self.horizontalLayout_5.addLayout(self.verticalLayout_4) self.verticalLayout_7.addLayout(self.horizontalLayout_5) self.horizontalLayout_15.addLayout(self.verticalLayout_7) self.verticalLayout_9.addWidget(self.groupBox_5) self.horizontalLayout_19.addLayout(self.verticalLayout_9) self.verticalLayout_10 = QtGui.QVBoxLayout() self.verticalLayout_10.setObjectName(_fromUtf8("verticalLayout_10")) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.groupBox_3 = QtGui.QGroupBox(SettingsDialogBaseClass) self.groupBox_3.setTitle(QtGui.QApplication.translate("SettingsDialogBaseClass", "Projector Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_3.setObjectName(_fromUtf8("groupBox_3")) self.horizontalLayout = QtGui.QHBoxLayout(self.groupBox_3) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.verticalLayout_6 = QtGui.QVBoxLayout() self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.projectorcontrol = QtGui.QCheckBox(self.groupBox_3) self.projectorcontrol.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Enable Projector Control?", None, QtGui.QApplication.UnicodeUTF8)) self.projectorcontrol.setChecked(False) self.projectorcontrol.setObjectName(_fromUtf8("projectorcontrol")) self.verticalLayout_6.addWidget(self.projectorcontrol) self.horizontalLayout_11 = QtGui.QHBoxLayout() self.horizontalLayout_11.setObjectName(_fromUtf8("horizontalLayout_11")) self.verticalLayout_14 = QtGui.QVBoxLayout() self.verticalLayout_14.setObjectName(_fromUtf8("verticalLayout_14")) self.label_17 = QtGui.QLabel(self.groupBox_3) self.label_17.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Serial Baud rate:", None, QtGui.QApplication.UnicodeUTF8)) self.label_17.setObjectName(_fromUtf8("label_17")) self.verticalLayout_14.addWidget(self.label_17) self.projector_baud = QtGui.QComboBox(self.groupBox_3) self.projector_baud.setObjectName(_fromUtf8("projector_baud")) self.projector_baud.addItem(_fromUtf8("")) self.projector_baud.setItemText(0, QtGui.QApplication.translate("SettingsDialogBaseClass", "19200", None, QtGui.QApplication.UnicodeUTF8)) self.projector_baud.addItem(_fromUtf8("")) self.projector_baud.setItemText(1, QtGui.QApplication.translate("SettingsDialogBaseClass", "115200", None, QtGui.QApplication.UnicodeUTF8)) self.projector_baud.addItem(_fromUtf8("")) self.projector_baud.setItemText(2, QtGui.QApplication.translate("SettingsDialogBaseClass", "57600", None, QtGui.QApplication.UnicodeUTF8)) self.projector_baud.addItem(_fromUtf8("")) self.projector_baud.setItemText(3, QtGui.QApplication.translate("SettingsDialogBaseClass", "38400", None, QtGui.QApplication.UnicodeUTF8)) self.projector_baud.addItem(_fromUtf8("")) self.projector_baud.setItemText(4, QtGui.QApplication.translate("SettingsDialogBaseClass", "9600", None, QtGui.QApplication.UnicodeUTF8)) self.projector_baud.addItem(_fromUtf8("")) self.projector_baud.setItemText(5, QtGui.QApplication.translate("SettingsDialogBaseClass", "4800", None, QtGui.QApplication.UnicodeUTF8)) self.projector_baud.addItem(_fromUtf8("")) self.projector_baud.setItemText(6, QtGui.QApplication.translate("SettingsDialogBaseClass", "2400", None, QtGui.QApplication.UnicodeUTF8)) self.verticalLayout_14.addWidget(self.projector_baud) self.horizontalLayout_11.addLayout(self.verticalLayout_14) self.verticalLayout_6.addLayout(self.horizontalLayout_11) self.verticalLayout_18 = QtGui.QVBoxLayout() self.verticalLayout_18.setObjectName(_fromUtf8("verticalLayout_18")) self.label_21 = QtGui.QLabel(self.groupBox_3) self.label_21.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Power Off Command:", None, QtGui.QApplication.UnicodeUTF8)) self.label_21.setObjectName(_fromUtf8("label_21")) self.verticalLayout_18.addWidget(self.label_21) self.projector_poweroffcommand = QtGui.QLineEdit(self.groupBox_3) self.projector_poweroffcommand.setMinimumSize(QtCore.QSize(200, 0)) self.projector_poweroffcommand.setText(_fromUtf8("")) self.projector_poweroffcommand.setObjectName(_fromUtf8("projector_poweroffcommand")) self.verticalLayout_18.addWidget(self.projector_poweroffcommand) self.verticalLayout_6.addLayout(self.verticalLayout_18) self.horizontalLayout.addLayout(self.verticalLayout_6) self.verticalLayout_2.addWidget(self.groupBox_3) self.verticalLayout_10.addLayout(self.verticalLayout_2) self.groupBox_7 = QtGui.QGroupBox(SettingsDialogBaseClass) self.groupBox_7.setTitle(QtGui.QApplication.translate("SettingsDialogBaseClass", "Hardware Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_7.setObjectName(_fromUtf8("groupBox_7")) self.horizontalLayout_24 = QtGui.QHBoxLayout(self.groupBox_7) self.horizontalLayout_24.setObjectName(_fromUtf8("horizontalLayout_24")) self.verticalLayout_5 = QtGui.QVBoxLayout() self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.horizontalLayout_22 = QtGui.QHBoxLayout() self.horizontalLayout_22.setObjectName(_fromUtf8("horizontalLayout_22")) self.label_3 = QtGui.QLabel(self.groupBox_7) self.label_3.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Z Axis Leadscrew Pitch", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setObjectName(_fromUtf8("label_3")) self.horizontalLayout_22.addWidget(self.label_3) self.pitch = QtGui.QLineEdit(self.groupBox_7) self.pitch.setObjectName(_fromUtf8("pitch")) self.horizontalLayout_22.addWidget(self.pitch) self.label_5 = QtGui.QLabel(self.groupBox_7) self.label_5.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "mm/rev", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setObjectName(_fromUtf8("label_5")) self.horizontalLayout_22.addWidget(self.label_5) self.verticalLayout_5.addLayout(self.horizontalLayout_22) self.horizontalLayout_23 = QtGui.QHBoxLayout() self.horizontalLayout_23.setObjectName(_fromUtf8("horizontalLayout_23")) self.label_4 = QtGui.QLabel(self.groupBox_7) self.label_4.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Z Axis Steps/rev", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setObjectName(_fromUtf8("label_4")) self.horizontalLayout_23.addWidget(self.label_4) self.stepsPerRev = QtGui.QLineEdit(self.groupBox_7) self.stepsPerRev.setObjectName(_fromUtf8("stepsPerRev")) self.horizontalLayout_23.addWidget(self.stepsPerRev) self.label_7 = QtGui.QLabel(self.groupBox_7) self.label_7.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "steps", None, QtGui.QApplication.UnicodeUTF8)) self.label_7.setObjectName(_fromUtf8("label_7")) self.horizontalLayout_23.addWidget(self.label_7) self.verticalLayout_5.addLayout(self.horizontalLayout_23) self.horizontalLayout_24.addLayout(self.verticalLayout_5) self.verticalLayout_10.addWidget(self.groupBox_7) spacerItem6 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_10.addItem(spacerItem6) self.horizontalLayout_19.addLayout(self.verticalLayout_10) self.verticalLayout_11.addLayout(self.horizontalLayout_19) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem7) self.pushButton = QtGui.QPushButton(SettingsDialogBaseClass) self.pushButton.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Apply Settings", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.horizontalLayout_2.addWidget(self.pushButton) self.pushButton_2 = QtGui.QPushButton(SettingsDialogBaseClass) self.pushButton_2.setText(QtGui.QApplication.translate("SettingsDialogBaseClass", "Cancel", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) self.horizontalLayout_2.addWidget(self.pushButton_2) spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem8) self.verticalLayout_11.addLayout(self.horizontalLayout_2) self.horizontalLayout_21.addLayout(self.verticalLayout_11) self.retranslateUi(SettingsDialogBaseClass) QtCore.QObject.connect(self.pushButton_2, QtCore.SIGNAL(_fromUtf8("clicked()")), SettingsDialogBaseClass.reject) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), SettingsDialogBaseClass.ApplySettings) QtCore.QMetaObject.connectSlotsByName(SettingsDialogBaseClass) def retranslateUi(self, SettingsDialogBaseClass): pass
Python
# -*- coding: utf-8 -*- #!/usr/bin/env python ### BITPIM ### ### Copyright (C) 2003-2004 Roger Binns <rogerb@rogerbinns.com> ### ### This program is free software; you can redistribute it and/or modify ### it under the terms of the BitPim license as detailed in the LICENSE file. ### ### $Id$ """Detect and enumerate com(serial) ports You should close all com ports you have open before calling any functions in this module. If you don't they will be detected as in use. Call the comscan() function It returns a list with each entry being a dictionary of useful information. See the platform notes for what is in each one. For your convenience the entries in the list are also sorted into an order that would make sense to the user. Platform Notes: =============== w Windows9x W WindowsNT/2K/XP L Linux M Mac wWLM name string Serial device name wWLM available Bool True if it is possible to open this device wW active Bool Is the driver actually running? An example of when this is False is USB devices or Bluetooth etc that aren't currently plugged in. If you are presenting stuff for users, do not show entries where this is false w driverstatus dict status is some random number, problem is non-zero if there is some issue (eg device disabled) wW hardwareinstance string instance of the device in the registry as named by Windows wWLM description string a friendly name to show users wW driverdate tuple (year, month, day) W driverversion string version string wW driverprovider string the manufacturer of the device driver wW driverdescription string some generic description of the driver L device tuple (major, minor) device specification L driver string the driver name from /proc/devices (eg ttyS or ttyUSB) """ from __future__ import with_statement version="$Revision$" import sys import os import time import glob def _IsWindows(): return sys.platform=='win32' def _IsLinux(): return sys.platform.startswith('linux') def _IsMac(): return sys.platform.startswith('darwin') if _IsWindows(): import _winreg import win32file import win32con class RegistryAccess: """A class that is significantly easier to use to access the Registry""" def __init__(self, hive=_winreg.HKEY_LOCAL_MACHINE): self.rootkey=_winreg.ConnectRegistry(None, hive) def getchildren(self, key): """Returns a list of the child nodes of a key""" k=_winreg.OpenKey(self.rootkey, key) index=0 res=[] while 1: try: subkey=_winreg.EnumKey(k, index) res.append(subkey) index+=1 except: # ran out of keys break return res def safegetchildren(self, key): """Doesn't throw exception if doesn't exist @return: A list of zero or more items""" try: k=_winreg.OpenKey(self.rootkey, key) except: return [] index=0 res=[] while 1: try: subkey=_winreg.EnumKey(k, index) res.append(subkey) index+=1 except WindowsError,e: if e[0]==259: # No more data is available break elif e[0]==234: # more data is available index+=1 continue raise return res def getvalue(self, key, node): """Gets a value The result is returned as the correct type (string, int, etc)""" k=_winreg.OpenKey(self.rootkey, key) v,t=_winreg.QueryValueEx(k, node) if t==2: return int(v) if t==3: # lsb data res=0 mult=1 for i in v: res+=ord(i)*mult mult*=256 return res # un unicode if possible if isinstance(v, unicode): try: return str(v) except: pass return v def safegetvalue(self, key, node, default=None): """Gets a value and if nothing is found returns the default""" try: return self.getvalue(key, node) except: return default def findkey(self, start, lookfor, prependresult=""): """Searches for the named key""" res=[] for i in self.getchildren(start): if i==lookfor: res.append(prependresult+i) else: l=self.findkey(start+"\\"+i, lookfor, prependresult+i+"\\") res.extend(l) return res def getallchildren(self, start, prependresult=""): """Returns a list of all child nodes in the hierarchy""" res=[] for i in self.getchildren(start): res.append(prependresult+i) l=self.getallchildren(start+"\\"+i, prependresult+i+"\\") res.extend(l) return res def _comscanwindows(): """Get detail about all com ports on Windows This code functions on both win9x and nt/2k/xp""" # give results back results={} resultscount=0 # list of active drivers on win98 activedrivers={} reg=RegistryAccess(_winreg.HKEY_DYN_DATA) k=r"Config Manager\Enum" for device in reg.safegetchildren(k): hw=reg.safegetvalue(k+"\\"+device, "hardwarekey") if hw is None: continue status=reg.safegetvalue(k+"\\"+device, "status", -1) problem=reg.safegetvalue(k+"\\"+device, "problem", -1) activedrivers[hw.upper()]={ 'status': status, 'problem': problem } # list of active drivers on winXP. Apparently Win2k is different? reg=RegistryAccess(_winreg.HKEY_LOCAL_MACHINE) k=r"SYSTEM\CurrentControlSet\Services" for service in reg.safegetchildren(k): # we will just take largest number count=int(reg.safegetvalue(k+"\\"+service+"\\Enum", "Count", 0)) next=int(reg.safegetvalue(k+"\\"+service+"\\Enum", "NextInstance", 0)) for id in range(max(count,next)): hw=reg.safegetvalue(k+"\\"+service+"\\Enum", `id`) if hw is None: continue activedrivers[hw.upper()]=None # scan through everything listed in Enum. Enum is the key containing a list of all # running hardware reg=RegistryAccess(_winreg.HKEY_LOCAL_MACHINE) # The three keys are: # # - where to find hardware # This then has three layers of children. # Enum # +-- Category (something like BIOS, PCI etc) # +-- Driver (vendor/product ids etc) # +-- Instance (An actual device. You may have more than one instance) # # - where to find information about drivers. The driver name is looked up in the instance # (using the key "driver") and then looked for as a child key of driverlocation to find # out more about the driver # # - where to look for the portname key. Eg in Win98 it is directly in the instance whereas # in XP it is below "Device Parameters" subkey of the instance for enumstr, driverlocation, portnamelocation in ( (r"SYSTEM\CurrentControlSet\Enum", r"SYSTEM\CurrentControlSet\Control\Class", r"\Device Parameters"), # win2K/XP (r"Enum", r"System\CurrentControlSet\Services\Class", ""), # win98 ): for category in reg.safegetchildren(enumstr): catstr=enumstr+"\\"+category for driver in reg.safegetchildren(catstr): drvstr=catstr+"\\"+driver for instance in reg.safegetchildren(drvstr): inststr=drvstr+"\\"+instance # see if there is a portname name=reg.safegetvalue(inststr+portnamelocation, "PORTNAME", "") # We only want com ports if len(name)<4 or name.lower()[:3]!="com": continue # Get rid of phantom devices phantom=reg.safegetvalue(inststr, "Phantom", 0) if phantom: continue # Lookup the class klassguid=reg.safegetvalue(inststr, "ClassGUID") if klassguid is not None: # win2k uses ClassGuid klass=reg.safegetvalue(driverlocation+"\\"+klassguid, "Class") else: # Win9x and WinXP use Class klass=reg.safegetvalue(inststr, "Class") if klass is None: continue klass=klass.lower() if klass=='ports': klass='serial' elif klass=='modem': klass='modem' else: continue # verify COM is followed by digits only try: portnum=int(name[3:]) except: continue # we now have some sort of match res={} res['name']=name.upper() res['class']=klass # is the device active? kp=inststr[len(enumstr)+1:].upper() if kp in activedrivers: res['active']=True if activedrivers[kp] is not None: res['driverstatus']=activedrivers[kp] else: res['active']=False # available? if res['active']: try: usename=name if sys.platform=='win32' and name.lower().startswith("com"): usename="\\\\?\\"+name print "scanning available COM ports" #+usename ComPort = win32file.CreateFile(usename, win32con.GENERIC_READ | win32con.GENERIC_WRITE, 0, None, win32con.OPEN_EXISTING, win32con.FILE_ATTRIBUTE_NORMAL, None) win32file.CloseHandle(ComPort) res['available']=True except Exception,e: print usename,"is not available",e res['available']=False else: res['available']=False # hardwareinstance res['hardwareinstance']=kp # friendly name res['description']=reg.safegetvalue(inststr, "FriendlyName", "<No Description>") # driver information key drv=reg.safegetvalue(inststr, "Driver") if drv is not None: driverkey=driverlocation+"\\"+drv # get some useful driver information for subkey, reskey in \ ("driverdate", "driverdate"), \ ("providername", "driverprovider"), \ ("driverdesc", "driverdescription"), \ ("driverversion", "driverversion"): val=reg.safegetvalue(driverkey, subkey, None) if val is None: continue if reskey=="driverdate": try: val2=val.split('-') val=int(val2[2]), int(val2[0]), int(val2[1]) except: # ignroe wierd dates continue res[reskey]=val results[resultscount]=res resultscount+=1 return results # There follows a demonstration of how user friendly Linux is. # Users are expected by some form of magic to know exactly what # the names of their devices are. We can't even tell the difference # between a serial port not existing, and there not being sufficient # permission to open it def _comscanlinux(maxnum=9): """Get all the ports on Linux Note that Linux doesn't actually provide any way to enumerate actual ports. Consequently we just look for device nodes. It still isn't possible to establish if there are actual device drivers behind them. The availability testing is done however. @param maxnum: The highest numbered device to look for (eg maxnum of 17 will look for ttyS0 ... ttys17) """ # track of mapping majors to drivers drivers={} # get the list of char drivers from /proc/drivers with file('/proc/devices', 'r') as f: f.readline() # skip "Character devices:" header for line in f.readlines(): line=line.split() if len(line)!=2: break # next section major,driver=line drivers[int(major)]=driver # device nodes we have seen so we don't repeat them in listing devcache={} resultscount=0 results={} for prefix, description, klass in ( ("/dev/cua", "Standard serial port", "serial"), ("/dev/ttyUSB", "USB to serial convertor", "serial"), ("/dev/ttyACM", "USB modem", "modem"), ("/dev/rfcomm", "Bluetooth", "modem"), ("/dev/usb/ttyUSB", "USB to serial convertor", "serial"), ("/dev/usb/tts/", "USB to serial convertor", "serial"), ("/dev/usb/acm/", "USB modem", "modem"), ("/dev/input/ttyACM", "USB modem", "modem") ): for num in range(maxnum+1): name=prefix+`num` if not os.path.exists(name): continue res={} res['name']=name res['class']=klass res['description']=description+" ("+name+")" dev=os.stat(name).st_rdev try: with file(name, 'rw'): res['available']=True except: res['available']=False # linux specific, and i think they do funky stuff on kernel 2.6 # there is no way to get these 'normally' from the python library major=(dev>>8)&0xff minor=dev&0xff res['device']=(major, minor) if drivers.has_key(major): res['driver']=drivers[major] if res['available']: if dev not in devcache or not devcache[dev][0]['available']: results[resultscount]=res resultscount+=1 devcache[dev]=[res] continue # not available, so add try: devcache[dev].append(res) except: devcache[dev]=[res] # add in one failed device type per major/minor for dev in devcache: if devcache[dev][0]['available']: continue results[resultscount]=devcache[dev][0] resultscount+=1 return results def _comscanmac(): """Get all the ports on Mac Just look for /dev/cu.* entries, they all seem to populate here whether USB->Serial, builtin, bluetooth, etc... """ resultscount=0 results={} for name in glob.glob("/dev/cu.*"): res={} res['name']=name if name.upper().rfind("MODEM") >= 0: res['description']="Modem"+" ("+name+")" res['class']="modem" else: res['description']="Serial"+" ("+name+")" res['class']="serial" try: with file(name, 'rw'): res['available']=True except: res['available']=False results[resultscount]=res resultscount+=1 return results ##def availableports(): ## """Gets list of available ports ## It is verified that the ports can be opened. ## @note: You must close any ports you have open before calling this function, otherwise they ## will not be considered available. ## @return: List of tuples. Each tuple is (port name, port description) - the description is user ## friendly. The list is sorted. ## """ ## pass def _stringint(str): """Seperate a string and trailing number into a tuple For example "com10" returns ("com", 10) """ prefix=str suffix="" while len(prefix) and prefix[-1]>='0' and prefix[-1]<='9': suffix=prefix[-1]+suffix prefix=prefix[:-1] if len(suffix): return (prefix, int(suffix)) else: return (prefix, None) def _cmpfunc(a,b): """Comparison function for two port names In particular it looks for a number on the end, and sorts by the prefix (as a string operation) and then by the number. This function is needed because "com9" needs to come before "com10" """ aa=_stringint(a[0]) bb=_stringint(b[0]) if aa==bb: if a[1]==b[1]: return 0 if a[1]<b[1]: return -1 return 1 if aa<bb: return -1 return 1 def comscan(*args, **kwargs): """Call platform specific version of comscan function""" res={} if _IsWindows(): res=_comscanwindows(*args, **kwargs) elif _IsLinux(): res=_comscanlinux(*args, **kwargs) elif _IsMac(): res=_comscanmac(*args, **kwargs) else: raise Exception("unknown platform "+sys.platform) # sort by name keys=res.keys() declist=[ (res[k]['name'], k) for k in keys] declist.sort(_cmpfunc) return [res[k[1]] for k in declist] if __name__=="__main__": res=comscan() output="ComScan "+version+"\n\n" for r in res: rkeys=r.keys() rkeys.sort() output+=r['name']+":\n" offset=0 for rk in rkeys: if rk=='name': continue v=r[rk] if not isinstance(v, type("")): v=`v` op=' %s: %s ' % (rk, v) if offset+len(op)>78: output+="\n"+op offset=len(op)+1 else: output+=op offset+=len(op) if output[-1]!="\n": output+="\n" output+="\n" offset=0 print output
Python
# -*- coding: utf-8 -*- """ Created on Mon Dec 17 21:01:39 2012 @author: Chris Marion """ import serial import math import time from threading import Thread class Heartbeat(Thread): def __init__(self, parent): self.stopped = False self.parent = parent Thread.__init__(self) def run(self): while not self.stopped: time.sleep(1.0) self.ping() def ping(self): self.parent.board.write("?\n") response = str(self.parent.board.readline()) if response.strip() == ".": print "OK" else: pass class arduinoUno(): def __init__(self): print "initialized" class arduinoMega(): def __init__(self): print "initialized" class ramps(): def __init__(self, port): try: self.heartbeat = Heartbeat(self) #print "trying board" self.board = serial.Serial("%s"%port, 115200, timeout = 5) print "Initialized serial connection successfully" self.status = 0 self.board.readline() self.identify() #time.sleep(5) #self.heartbeat.start() except: print "Could not connect to RAMPS board." self.status = 1 def identify(self): self.board.write("IDN\n") print str(self.board.readline()).strip() def EnableZ(self): self.board.write("Z_ENABLE\n") if str(self.board.readline()).strip() == "OK": print "done" def HomePrinter(self): pass def Z_Up(self): self.board.write("Z_UP\n") print str(self.board.readline()).strip() def Z_Down(self): self.board.write("Z_DOWN\n") print str(self.board.readline()).strip() def IncrementZ(self, steps): #check to make sure the step value is a whole number # if steps % 1 == 0: # pass # else: # print "ERROR! Steps value must be an integer!" # return #check if it's negative and take appropriate action if steps < 0: self.Z_Down() elif steps > 0: self.Z_Up() #send command print "sending ZMOVE_%d" %math.fabs(steps) self.board.write('ZMOVE_%d\n'%math.fabs(steps)) if str(self.board.readline()).strip() == "OK": print "success" def HomeZ(self): pass def HomeX(self): pass def close(self): self.board.close() self.heartbeat.join() class pymcu(): def __init__(self): print "initialized"
Python
import slicer import vtk import sys from PyQt4 import QtCore,QtGui from PyQt4.Qt import * from PyQt4.QtGui import QFileDialog, QPixmap, QSplashScreen #from PyQt4.Qt import * from slicer_gui import Ui_MainWindow from slicer_settings_dialog_gui import Ui_Dialog from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor from ConfigParser import SafeConfigParser import os import shutil ###IDEA TO SPEED UP SLICER: slice in one thread, send data through queue to another thread which saves data to hard drive at its leisure class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): #defines all the mouse interactions for the render views def __init__(self,parent=None): self.AddObserver("MiddleButtonPressEvent",self.middleButtonPressEvent) self.AddObserver("MiddleButtonReleaseEvent",self.middleButtonReleaseEvent) def middleButtonPressEvent(self,obj,event): self.OnMiddleButtonDown() return def middleButtonReleaseEvent(self,obj,event): self.OnMiddleButtonUp() return class StartSettingsDialog(QtGui.QDialog, Ui_Dialog, Ui_MainWindow): def __init__(self,parent=None): QtGui.QDialog.__init__(self,parent) self.setupUi(self) def accept(self): self.emit(QtCore.SIGNAL('ApplySettings()')) self.reject() def quit(self): self.reject() class model(): def __init__(self, parent, filename): self.parent = parent self.filename = filename self.transform = vtk.vtkTransform() self.CurrentXPosition = 0.0 self.CurrentYPosition = 0.0 self.CurrentZPosition = 0.0 self.CurrentXRotation = 0.0 self.CurrentYRotation = 0.0 self.CurrentZRotation = 0.0 self.CurrentScale = 0.0 self.PreviousScale = 0.0 self.load() def load(self): self.reader = vtk.vtkSTLReader() self.reader.SetFileName(str(self.filename)) self.mapper = vtk.vtkPolyDataMapper() self.mapper.SetInputConnection(self.reader.GetOutputPort()) #create model actor self.actor = vtk.vtkActor() self.actor.GetProperty().SetColor(1,1,1) self.actor.GetProperty().SetOpacity(1) self.actor.SetMapper(self.mapper) #create outline mapper self.outline = vtk.vtkOutlineFilter() self.outline.SetInputConnection(self.reader.GetOutputPort()) self.outlineMapper = vtk.vtkPolyDataMapper() self.outlineMapper.SetInputConnection(self.outline.GetOutputPort()) #create outline actor self.outlineActor = vtk.vtkActor() self.outlineActor.SetMapper(self.outlineMapper) #add actors to parent render window self.parent.ren.AddActor(self.actor) self.parent.ren.AddActor(self.outlineActor) # Create a class for our main window class Main(QtGui.QMainWindow): def resizeEvent(self,Event): pass #self.ModelView.resize(self.ui.ModelFrame.geometry().width()-15,self.ui.ModelFrame.geometry().height()-39) def __init__(self): QtGui.QMainWindow.__init__(self) self.ui=Ui_MainWindow() self.ui.setupUi(self) self.setWindowTitle(QtGui.QApplication.translate("MainWindow", "3DLP Slicer", None, QtGui.QApplication.UnicodeUTF8)) #load previous settings from config file here: self.parser = SafeConfigParser() filename = 'sliceconfig.ini' if hasattr(sys, '_MEIPASS'): # PyInstaller >= 1.6 os.chdir(sys._MEIPASS) filename = os.path.join(sys._MEIPASS, filename) APPNAME = '3DLP' APPDATA = os.path.join(os.environ['APPDATA'], APPNAME) if not os.path.isdir(os.path.join(APPDATA)): os.mkdir(os.path.join(APPDATA)) shutil.copy(filename, os.path.join(APPDATA, '')) self.parser.read(os.path.join(APPDATA, 'sliceconfig.ini')) self.LoadSettingsFromConfigFile() else: if not os.path.isfile(os.path.join(APPDATA, 'sliceconfig.ini')): shutil.copy(filename, os.path.join(APPDATA)) else: self.parser.read(os.path.join(APPDATA, 'sliceconfig.ini')) self.LoadSettingsFromConfigFile() else: #otherwise it's running in pydev environment: use the dev config file os.chdir(os.path.dirname(sys.argv[0])) filename = os.path.join(os.path.dirname(sys.argv[0]), filename) self.parser.read('sliceconfig.ini') self.LoadSettingsFromConfigFile() self.ren = vtk.vtkRenderer() self.ren.SetBackground(.4,.4,.4) # create the modelview widget self.ModelView = QVTKRenderWindowInteractor(self.ui.ModelFrame) self.ModelView.SetInteractorStyle(MyInteractorStyle()) self.ModelView.Initialize() self.ModelView.Start() self.renWin=self.ModelView.GetRenderWindow() self.renWin.AddRenderer(self.ren) self.ModelView.show() self.ModelView.resize(1006-17,716-39) #self.ModelView.resize(self.ui.ModelFrame.geometry().width()-1,self.ui.ModelFrame.geometry().height()-1) self.modelList = [] def AddModel(self): filename = QtGui.QFileDialog.getOpenFileName(self, 'Open 3D Model', '.', '*.stl') if filename == '': #user hit cancel return modelObject = model(self, filename) self.modelList.append(modelObject) self.ui.modelList.addItem(os.path.basename(str(filename))) if len(self.modelList) == 1: self.FirstOpen() self.ren.ResetCamera() self.ModelView.Render() #update model view def FirstOpen(self): #create annotated cube anchor actor self.axesActor = vtk.vtkAnnotatedCubeActor(); self.axesActor.SetXPlusFaceText('Right') self.axesActor.SetXMinusFaceText('Left') self.axesActor.SetYMinusFaceText('Front') self.axesActor.SetYPlusFaceText('Back') self.axesActor.SetZMinusFaceText('Bot') self.axesActor.SetZPlusFaceText('Top') self.axesActor.GetTextEdgesProperty().SetColor(.8,.8,.8) self.axesActor.GetZPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetZMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetXPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetXMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetYPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetYMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetTextEdgesProperty().SetLineWidth(2) self.axesActor.GetCubeProperty().SetColor(.2,.2,.2) self.axesActor.SetFaceTextScale(0.25) self.axesActor.SetZFaceTextRotation(90) #create orientation markers self.axes = vtk.vtkOrientationMarkerWidget() self.axes.SetOrientationMarker(self.axesActor) self.axes.SetInteractor(self.ModelView) self.axes.EnabledOn() self.axes.InteractiveOff() self.ui.Transform_groupbox.setEnabled(True) def SliceModel(self): try: if self.modelActor: #check to see if a model is loaded, if not it will throw an exception pass except: #self.modelActor doesn't exist (hasn't been instantiated with a model yet) QtGui.QMessageBox.critical(self, 'Error slicing model',"You must first load a model to slice it!", QtGui.QMessageBox.Ok) return self.outputFile = str(QFileDialog.getSaveFileName(self, "Save file", "", ".3dlp")) self.slicer = slicer.slicer(self) self.slicer.imageheight = int(self.imageHeight) self.slicer.imagewidth = int(self.imageWidth) # check to see if starting depth is less than ending depth!! this assumption is crucial self.slicer.startingdepth = float(self.startingDepth) self.slicer.endingdepth = float(self.endingDepth) self.slicer.layerincrement = float(self.slicingIncrement) self.slicer.OpenModel(self.filename) self.slicer.slice() def UpdateModelOpacity(self): try: if self.modelActor: #check to see if a model is loaded, if not it will throw an exception opacity, ok = QtGui.QInputDialog.getText(self, 'Model Opacity', 'Enter the desired opacity (0-100):') if not ok: #the user hit the "cancel" button return self.modelActor.GetProperty().SetOpacity(float(opacity)/100) self.ren.Render() self.ModelView.Render() except: #self.modelActor doesn't exist (hasn't been instantiated with a model yet) QtGui.QMessageBox.critical(self, 'Error setting opacity',"You must first load a model to change its opacity!", QtGui.QMessageBox.Ok) def ModelIndexChanged(self, new, previous): modelObject = self.modelList[self.ui.modelList.currentRow()] self.ui.positionX.setValue(modelObject.CurrentXPosition) self.ui.positionY.setValue(modelObject.CurrentYPosition) self.ui.positionZ.setValue(modelObject.CurrentZPosition) self.ui.rotationX.setValue(modelObject.CurrentXRotation) self.ui.rotationY.setValue(modelObject.CurrentYRotation) self.ui.rotationZ.setValue(modelObject.CurrentZRotation) self.ui.scale.setValue(modelObject.CurrentScale) def Update_Position_X(self, position): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.Translate((float(position)-modelObject.CurrentXPosition), 0.0, 0.0) modelObject.CurrentXPosition = modelObject.CurrentXPosition + (float(position)-modelObject.CurrentXPosition) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.ren.Render() self.ModelView.Render() def Update_Position_Y(self, position): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.Translate(0.0, (float(position)-modelObject.CurrentYPosition), 0.0) modelObject.CurrentYPosition = modelObject.CurrentYPosition + (float(position)-modelObject.CurrentYPosition) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.ren.Render() self.ModelView.Render() def Update_Position_Z(self, position): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.Translate(0.0, 0.0, (float(position)-modelObject.CurrentZPosition)) modelObject.CurrentZPosition = modelObject.CurrentZPosition + (float(position)-modelObject.CurrentZPosition) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.ren.Render() self.ModelView.Render() def Update_Rotation_X(self, rotation): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.RotateX((float(rotation)-modelObject.CurrentXRotation)) modelObject.CurrentXRotation = modelObject.CurrentXRotation + (float(rotation)-modelObject.CurrentXRotation) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.ren.Render() self.ModelView.Render() def Update_Rotation_Y(self, rotation): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.RotateY((float(rotation)-modelObject.CurrentYRotation)) modelObject.CurrentYRotation = modelObject.CurrentYRotation + (float(rotation)-modelObject.CurrentYRotation) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.ren.Render() self.ModelView.Render() def Update_Rotation_Z(self, rotation): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.RotateZ((float(rotation)-modelObject.CurrentZRotation)) modelObject.CurrentZRotation = modelObject.CurrentZRotation + (float(rotation)-modelObject.CurrentZRotation) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.ren.Render() self.ModelView.Render() def Update_Scale(self, scale): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform self.reader = vtk.vtkSTLReader() self.reader.SetFileName(str(self.filename)) self.mapper = vtk.vtkPolyDataMapper() self.mapper.SetInputConnection(self.reader.GetOutputPort()) #create model actor self.actor = vtk.vtkActor() self.actor.GetProperty().SetColor(1,1,1) self.actor.GetProperty().SetOpacity(1) self.actor.SetMapper(self.mapper) #create outline mapper self.outline = vtk.vtkOutlineFilter() self.outline.SetInputConnection(self.reader.GetOutputPort()) self.outlineMapper = vtk.vtkPolyDataMapper() self.outlineMapper.SetInputConnection(self.outline.GetOutputPort()) #create outline actor self.outlineActor = vtk.vtkActor() self.outlineActor.SetMapper(self.outlineMapper) #add actors to parent render window self.parent.ren.AddActor(self.actor) self.parent.ren.AddActor(self.outlineActor) delta = modelObject.PreviousScale - modelObject.CurrentScale modelObject.transform #transform.Scale((float(scale)-modelObject.CurrentScale)/100.0, (float(scale)-modelObject.CurrentScale)/100.0, (float(scale)-modelObject.CurrentScale)/100.0) transform.Scale modelObject.CurrentScale = modelObject.CurrentScale + (float(scale)-modelObject.CurrentScale) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(modelObject.transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.ren.Render() self.ModelView.Render() def LoadSettingsFromConfigFile(self): self.imageHeight = int(self.parser.get('slicing_settings', 'Image_Height')) self.imageWidth = int(self.parser.get('slicing_settings', 'Image_Width')) self.startingDepth = int(self.parser.get('slicing_settings', 'Starting_Depth')) self.endingDepth = int(self.parser.get('slicing_settings', 'Ending_Depth')) self.slicingIncrement = int(self.parser.get('slicing_settings', 'Slicing_Increment')) self.slicingplane = self.parser.get('slicing_settings', 'Slicing_Plane') def OpenSettingsDialog(self): self.SettingsDialog = StartSettingsDialog(self) self.connect(self.SettingsDialog, QtCore.SIGNAL('ApplySettings()'), self.getSettingsDialogValues) self.SettingsDialog.imageHeight.setText(str(self.imageHeight)) self.SettingsDialog.imageWidth.setText(str(self.imageWidth)) self.SettingsDialog.startingDepth.setText(str(self.startingDepth)) self.SettingsDialog.endingDepth.setText(str(self.endingDepth)) self.SettingsDialog.slicingIncrement.setText(str(self.slicingIncrement)) self.slicingplaneDict = {"XZ":0, "XY":1, "YZ":2} try: self.SettingsDialog.slicingPlane.setCurrentIndex(self.slicingplaneDict[self.slicingplane]) except: #anything other than a valid entry will default to XZ (index 0) self.SettingsDialog.slicingPlane.setCurrentIndex(0) self.SettingsDialog.exec_() def getSettingsDialogValues(self): self.imageHeight = int(self.SettingsDialog.imageHeight.text()) self.parser.set('slicing_settings', 'Image_Height', "%s"%self.imageHeight) self.imageWidth = int(self.SettingsDialog.imageWidth.text()) self.parser.set('slicing_settings', 'Image_Width', "%s"%self.imageWidth) self.startingDepth = int(self.SettingsDialog.startingDepth.text()) self.parser.set('slicing_settings', 'Starting_Depth', "%s"%self.startingDepth) self.endingDepth = int(self.SettingsDialog.endingDepth.text()) self.parser.set('slicing_settings', 'Ending_Depth', "%s"%self.endingDepth) self.slicingIncrement = int(self.SettingsDialog.slicingIncrement.text()) self.parser.set('slicing_settings', 'Slicing_Increment', "%s"%self.slicingIncrement) self.slicingplane = self.SettingsDialog.slicingPlane.currentText() self.parser.set('slicing_settings', 'Slicing_Plane', "%s"%self.slicingplane) filename = 'sliceconfig.ini' if hasattr(sys, '_MEIPASS'): # PyInstaller >= 1.6 APPNAME = '3DLP' APPDATA = os.path.join(os.environ['APPDATA'], APPNAME) filename = os.path.join(APPDATA, filename) outputini = open(filename, 'w') #open a file pointer for the config file parser to write changes to self.parser.write(outputini) outputini.close() #done writing config file changes else: #otherwise it's running in pydev environment: use the dev config file os.chdir(os.path.dirname(sys.argv[0])) filename = os.path.join(os.path.dirname(sys.argv[0]), filename) outputini = open(filename, 'w') #open a file pointer for the config file parser to write changes to self.parser.write(outputini) outputini.close() #done writing config file changes ## def main(): app = QtGui.QApplication(sys.argv) splash_pix = QPixmap(':/splash/3dlp_slicer_splash.png') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() app.processEvents() window=Main() window.show() splash.finish(window) # It's exec_ because exec is a reserved word in Python sys.exit(app.exec_()) if __name__ == "__main__": main()
Python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'slicer_settings_dialog.ui' # # Created: Sun Mar 31 19:34:46 2013 # by: PyQt4 UI code generator 4.8.5 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(219, 258) Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "3DLP Slicer Settings", None, QtGui.QApplication.UnicodeUTF8)) self.horizontalLayout_2 = QtGui.QHBoxLayout(Dialog) self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.label = QtGui.QLabel(Dialog) font = QtGui.QFont() font.setPointSize(16) self.label.setFont(font) self.label.setText(QtGui.QApplication.translate("Dialog", "Slicing Settings", None, QtGui.QApplication.UnicodeUTF8)) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName(_fromUtf8("label")) self.verticalLayout.addWidget(self.label) self.horizontalLayout_12 = QtGui.QHBoxLayout() self.horizontalLayout_12.setObjectName(_fromUtf8("horizontalLayout_12")) self.verticalLayout_8 = QtGui.QVBoxLayout() self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) self.label_7 = QtGui.QLabel(Dialog) self.label_7.setText(QtGui.QApplication.translate("Dialog", "Image Height", None, QtGui.QApplication.UnicodeUTF8)) self.label_7.setObjectName(_fromUtf8("label_7")) self.verticalLayout_8.addWidget(self.label_7) self.imageHeight = QtGui.QLineEdit(Dialog) self.imageHeight.setText(_fromUtf8("")) self.imageHeight.setObjectName(_fromUtf8("imageHeight")) self.verticalLayout_8.addWidget(self.imageHeight) self.horizontalLayout_12.addLayout(self.verticalLayout_8) self.verticalLayout_9 = QtGui.QVBoxLayout() self.verticalLayout_9.setObjectName(_fromUtf8("verticalLayout_9")) self.label_8 = QtGui.QLabel(Dialog) self.label_8.setText(QtGui.QApplication.translate("Dialog", "Image Width", None, QtGui.QApplication.UnicodeUTF8)) self.label_8.setObjectName(_fromUtf8("label_8")) self.verticalLayout_9.addWidget(self.label_8) self.imageWidth = QtGui.QLineEdit(Dialog) self.imageWidth.setText(_fromUtf8("")) self.imageWidth.setObjectName(_fromUtf8("imageWidth")) self.verticalLayout_9.addWidget(self.imageWidth) self.horizontalLayout_12.addLayout(self.verticalLayout_9) self.verticalLayout.addLayout(self.horizontalLayout_12) self.horizontalLayout_13 = QtGui.QHBoxLayout() self.horizontalLayout_13.setObjectName(_fromUtf8("horizontalLayout_13")) self.verticalLayout_10 = QtGui.QVBoxLayout() self.verticalLayout_10.setObjectName(_fromUtf8("verticalLayout_10")) self.label_9 = QtGui.QLabel(Dialog) self.label_9.setText(QtGui.QApplication.translate("Dialog", "Layer Thickness", None, QtGui.QApplication.UnicodeUTF8)) self.label_9.setObjectName(_fromUtf8("label_9")) self.verticalLayout_10.addWidget(self.label_9) self.layerThickness = QtGui.QLineEdit(Dialog) self.layerThickness.setEnabled(False) self.layerThickness.setText(_fromUtf8("")) self.layerThickness.setObjectName(_fromUtf8("layerThickness")) self.verticalLayout_10.addWidget(self.layerThickness) self.horizontalLayout_13.addLayout(self.verticalLayout_10) self.verticalLayout_11 = QtGui.QVBoxLayout() self.verticalLayout_11.setObjectName(_fromUtf8("verticalLayout_11")) self.label_10 = QtGui.QLabel(Dialog) self.label_10.setText(QtGui.QApplication.translate("Dialog", "Slicing Plane", None, QtGui.QApplication.UnicodeUTF8)) self.label_10.setObjectName(_fromUtf8("label_10")) self.verticalLayout_11.addWidget(self.label_10) self.slicingPlane = QtGui.QComboBox(Dialog) self.slicingPlane.setObjectName(_fromUtf8("slicingPlane")) self.slicingPlane.addItem(_fromUtf8("")) self.slicingPlane.setItemText(0, QtGui.QApplication.translate("Dialog", "XZ", None, QtGui.QApplication.UnicodeUTF8)) self.slicingPlane.addItem(_fromUtf8("")) self.slicingPlane.setItemText(1, QtGui.QApplication.translate("Dialog", "XY", None, QtGui.QApplication.UnicodeUTF8)) self.slicingPlane.addItem(_fromUtf8("")) self.slicingPlane.setItemText(2, QtGui.QApplication.translate("Dialog", "YZ", None, QtGui.QApplication.UnicodeUTF8)) self.verticalLayout_11.addWidget(self.slicingPlane) self.horizontalLayout_13.addLayout(self.verticalLayout_11) self.verticalLayout.addLayout(self.horizontalLayout_13) self.horizontalLayout_14 = QtGui.QHBoxLayout() self.horizontalLayout_14.setObjectName(_fromUtf8("horizontalLayout_14")) self.label_13 = QtGui.QLabel(Dialog) self.label_13.setText(QtGui.QApplication.translate("Dialog", "Starting Depth:", None, QtGui.QApplication.UnicodeUTF8)) self.label_13.setObjectName(_fromUtf8("label_13")) self.horizontalLayout_14.addWidget(self.label_13) self.startingDepth = QtGui.QLineEdit(Dialog) self.startingDepth.setText(_fromUtf8("")) self.startingDepth.setObjectName(_fromUtf8("startingDepth")) self.horizontalLayout_14.addWidget(self.startingDepth) self.verticalLayout.addLayout(self.horizontalLayout_14) self.horizontalLayout_15 = QtGui.QHBoxLayout() self.horizontalLayout_15.setObjectName(_fromUtf8("horizontalLayout_15")) self.label_22 = QtGui.QLabel(Dialog) self.label_22.setText(QtGui.QApplication.translate("Dialog", "Ending Depth:", None, QtGui.QApplication.UnicodeUTF8)) self.label_22.setObjectName(_fromUtf8("label_22")) self.horizontalLayout_15.addWidget(self.label_22) self.endingDepth = QtGui.QLineEdit(Dialog) self.endingDepth.setText(_fromUtf8("")) self.endingDepth.setObjectName(_fromUtf8("endingDepth")) self.horizontalLayout_15.addWidget(self.endingDepth) self.verticalLayout.addLayout(self.horizontalLayout_15) self.horizontalLayout_16 = QtGui.QHBoxLayout() self.horizontalLayout_16.setObjectName(_fromUtf8("horizontalLayout_16")) self.label_23 = QtGui.QLabel(Dialog) self.label_23.setText(QtGui.QApplication.translate("Dialog", "Z slicing increment:", None, QtGui.QApplication.UnicodeUTF8)) self.label_23.setObjectName(_fromUtf8("label_23")) self.horizontalLayout_16.addWidget(self.label_23) self.slicingIncrement = QtGui.QLineEdit(Dialog) self.slicingIncrement.setMinimumSize(QtCore.QSize(100, 0)) self.slicingIncrement.setText(_fromUtf8("")) self.slicingIncrement.setObjectName(_fromUtf8("slicingIncrement")) self.horizontalLayout_16.addWidget(self.slicingIncrement) self.verticalLayout.addLayout(self.horizontalLayout_16) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setText(QtGui.QApplication.translate("Dialog", "Apply Settings", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.horizontalLayout.addWidget(self.pushButton) self.pushButton_2 = QtGui.QPushButton(Dialog) self.pushButton_2.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) self.horizontalLayout.addWidget(self.pushButton_2) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_2.addLayout(self.verticalLayout) self.retranslateUi(Dialog) QtCore.QObject.connect(self.pushButton_2, QtCore.SIGNAL(_fromUtf8("clicked()")), Dialog.reject) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), Dialog.accept) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): pass
Python
import vtk import time import os import ConfigParser import cPickle as pickle import zipfile import StringIO import numpy import Image from vtk.util.numpy_support import vtk_to_numpy class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): #defines all the mouse interactions for the render views def __init__(self,parent=None): self.AddObserver("MiddleButtonPressEvent",self.middleButtonPressEvent) self.AddObserver("MiddleButtonReleaseEvent",self.middleButtonReleaseEvent) def middleButtonPressEvent(self,obj,event): self.OnMiddleButtonDown() return def middleButtonReleaseEvent(self,obj,event): self.OnMiddleButtonUp() return class slicer(): def __init__(self, parent): self.parent = parent self.outputFile = self.parent.outputFile os.chdir(os.path.split(str(self.outputFile))[0]) #change to base dir of the selected filename self.zfile = zipfile.ZipFile(os.path.split(str(self.outputFile))[1], 'w') def close_window(self, iren): render_window = iren.GetRenderWindow() render_window.Finalize() #iren.TerminateApp() def slice(self): #create a plane to cut,here it cuts in the XY direction (xz normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0) self.slicingplane=vtk.vtkPlane() self.slicingplane.SetOrigin(0,0,0) self.slicingplane.SetNormal(0,0,1) self.cutter=vtk.vtkCutter() #create cutter self.cutter.SetCutFunction(self.slicingplane) self.cutter.SetInputConnection(self.clean.GetOutputPort()) self.cutter.Update() self.cutStrips = vtk.vtkStripper() #Forms loops (closed polylines) from cutter self.cutStrips.SetInputConnection(self.cutter.GetOutputPort()) self.cutStrips.Update() self.cutPoly = vtk.vtkPolyData() #This trick defines polygons as polyline loop self.cutPoly.SetPoints((self.cutStrips.GetOutput()).GetPoints()) self.cutPoly.SetPolys((self.cutStrips.GetOutput()).GetLines()) self.cutPoly.Update() self.cutTriangles = vtk.vtkTriangleFilter() # Triangle filter self.cutTriangles.SetInput(self.cutPoly) self.cutTriangles.Update() self.cutterMapper=vtk.vtkPolyDataMapper() #cutter mapper self.cutterMapper.SetInput(self.cutPoly) self.cutterMapper.SetInputConnection(self.cutTriangles.GetOutputPort()) self.slicingplaneActor=vtk.vtkActor() #create plane actor self.slicingplaneActor.GetProperty().SetColor(1.0,1.0,1.0) self.slicingplaneActor.GetProperty().SetLineWidth(4) self.slicingplaneActor.SetMapper(self.cutterMapper) self.sliceren = vtk.vtkRenderer() self.sliceren.AddActor(self.slicingplaneActor) self.sliceren.ResetCamera() self.sliceren.ResetCameraClippingRange(-100.0,100.0,-100.0,100.0,-100.0,100.0) self.sliceren.InteractiveOff() #why doesnt this work?! #Add renderer to renderwindow and render self.renWin = vtk.vtkRenderWindow() self.renWin.AddRenderer(self.sliceren) self.renWin.SetSize(self.imageheight, self.imagewidth) self.renWin.SetWindowName("3DLP STL SLicer") self.renWin.Render() self.sliceCorrelations = [] x = self.startingdepth layercount = 0 starttime = time.time() while x < self.endingdepth: x += self.layerincrement layercount = layercount + 1 self.UpdateSlicingPlane(x) self.WindowToImage("slice%s.png"%(str(layercount).zfill(4))) self.sliceCorrelations.append([layercount,x]) #store correlations between slice plane and layer number for later visualization in 3DLP Host self.close_window(self.sliceren) del self.sliceren elapsedtime = time.time() - starttime print elapsedtime print layercount self.GenerateConfigFile() def UpdateSlicingPlane(self, value): #self.previousPlaneZVal = self.slicingplane.GetOrigin()[2] #pull Z coordinate off plane origin self.slicingplane.SetOrigin(0,0,value) self.cutter.Update() self.cutStrips.Update() self.cutPoly.SetPoints((self.cutStrips.GetOutput()).GetPoints()) self.cutPoly.SetPolys((self.cutStrips.GetOutput()).GetLines()) self.cutPoly.Update() self.cutTriangles.Update() self.sliceren.Render() self.sliceren.Render() self.renWin.Render() def WindowToImage(self, filename): self.w2i = vtk.vtkWindowToImageFilter() self.writer = vtk.vtkPNGWriter() self.w2i.SetInput(self.renWin) self.w2i.Update() vtk_image = self.w2i.GetOutput() height, width, _ = vtk_image.GetDimensions() vtk_array = vtk_image.GetPointData().GetScalars() components = vtk_array.GetNumberOfComponents() array = vtk_to_numpy(vtk_array).reshape(height, width, components) stringio3 = StringIO.StringIO() im = Image.fromarray(numpy.uint8(array)) im.save(stringio3, "PNG") self.zfile.writestr("\\slices\\" + filename, stringio3.getvalue()) def GenerateConfigFile(self): Config = ConfigParser.ConfigParser() Config.add_section('print_settings') Config.set('print_settings', 'layer_thickness', self.layerincrement) Config.add_section('preview_settings') base, file = os.path.split(str(self.filename)) #can't be QString Config.set('preview_settings', 'STL_name', file) stringio = StringIO.StringIO() Config.write(stringio) self.zfile.writestr("printconfiguration.ini", stringio.getvalue())#arcname = "printconfiguration.ini") stringio2 = StringIO.StringIO() pickle.dump(self.sliceCorrelations, stringio2) self.zfile.writestr("slices.p", stringio2.getvalue()) #pickle and save the layer-plane correlations self.zfile.write(str(self.filename), arcname = file) self.zfile.close() #slicer = slicer() #slicer.imagewidth = 640 #slicer.imageheight = 480 #slicer.startingdepth = -2 #slicer.endingdepth = 4 #slicer.layerincrement = .1 #Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing #filename = askopenfilename() # show an "Open" dialog box and return the path to the selected file #slicer.OpenModel(filename) #slicer.slice()
Python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'aboutdialog.ui' # # Created: Sun Mar 03 18:00:57 2013 # by: PyQt4 UI code generator 4.8.5 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(242, 130) Dialog.setMinimumSize(QtCore.QSize(242, 130)) Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "About", None, QtGui.QApplication.UnicodeUTF8)) self.verticalLayout_2 = QtGui.QVBoxLayout(Dialog) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.label = QtGui.QLabel(Dialog) font = QtGui.QFont() font.setPointSize(14) self.label.setFont(font) self.label.setText(QtGui.QApplication.translate("Dialog", "3DLP Host Software", None, QtGui.QApplication.UnicodeUTF8)) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName(_fromUtf8("label")) self.verticalLayout.addWidget(self.label) self.textBrowser = QtGui.QTextBrowser(Dialog) self.textBrowser.setMinimumSize(QtCore.QSize(222, 69)) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) self.textBrowser.setPalette(palette) self.textBrowser.setAcceptDrops(True) self.textBrowser.setFrameShape(QtGui.QFrame.NoFrame) self.textBrowser.setFrameShadow(QtGui.QFrame.Sunken) self.textBrowser.setHtml(QtGui.QApplication.translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:8pt;\">Version 2.0</span></p>\n" "<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\"></p>\n" "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:8pt;\">Copyright © 2012-2013 Chris Marion</span></p>\n" "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"http://www.chrismarion.net\"><span style=\" font-size:8pt; text-decoration: underline; color:#0000ff;\">www.chrismarion.net</span></a></p>\n" "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"mailto:chris@chrismarion.net\"><span style=\" font-size:8pt; text-decoration: underline; color:#0000ff;\">chris@chrismarion.net</span></a></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) self.textBrowser.setOpenExternalLinks(True) self.textBrowser.setObjectName(_fromUtf8("textBrowser")) self.verticalLayout.addWidget(self.textBrowser) self.verticalLayout_2.addLayout(self.verticalLayout) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): pass
Python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '3dlp_v2.ui' # # Created: Sun Jun 30 18:26:15 2013 # by: PyQt4 UI code generator 4.8.5 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(1281, 835) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) MainWindow.setPalette(palette) font = QtGui.QFont() font.setFamily(_fromUtf8("Calibri")) font.setPointSize(10) MainWindow.setFont(font) MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "3dlp", None, QtGui.QApplication.UnicodeUTF8)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/3d printing.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) MainWindow.setAutoFillBackground(False) MainWindow.setStyleSheet(_fromUtf8("#MainWindow {background-image: url(:/backgrounds/backgrounds/generic_abstract_wallpaper_4_by_zoken-d3087ac.png);}")) MainWindow.setTabShape(QtGui.QTabWidget.Rounded) MainWindow.setDockOptions(QtGui.QMainWindow.AllowNestedDocks|QtGui.QMainWindow.AllowTabbedDocks|QtGui.QMainWindow.AnimatedDocks) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setLayoutDirection(QtCore.Qt.LeftToRight) self.centralwidget.setStyleSheet(_fromUtf8("")) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.horizontalLayout_22 = QtGui.QHBoxLayout(self.centralwidget) self.horizontalLayout_22.setObjectName(_fromUtf8("horizontalLayout_22")) self.frame = QtGui.QFrame(self.centralwidget) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) self.frame.setFrameShadow(QtGui.QFrame.Raised) self.frame.setObjectName(_fromUtf8("frame")) self.horizontalLayout_21 = QtGui.QHBoxLayout(self.frame) self.horizontalLayout_21.setSpacing(0) self.horizontalLayout_21.setMargin(0) self.horizontalLayout_21.setObjectName(_fromUtf8("horizontalLayout_21")) self.horizontalLayout_20 = QtGui.QHBoxLayout() self.horizontalLayout_20.setSpacing(0) self.horizontalLayout_20.setObjectName(_fromUtf8("horizontalLayout_20")) self.workspacePre = QtGui.QWidget(self.frame) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.workspacePre.sizePolicy().hasHeightForWidth()) self.workspacePre.setSizePolicy(sizePolicy) self.workspacePre.setObjectName(_fromUtf8("workspacePre")) self.horizontalLayout_19 = QtGui.QHBoxLayout(self.workspacePre) self.horizontalLayout_19.setSpacing(0) self.horizontalLayout_19.setMargin(0) self.horizontalLayout_19.setMargin(0) self.horizontalLayout_19.setObjectName(_fromUtf8("horizontalLayout_19")) self.modelFramePre = QtGui.QFrame(self.workspacePre) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.modelFramePre.sizePolicy().hasHeightForWidth()) self.modelFramePre.setSizePolicy(sizePolicy) self.modelFramePre.setFrameShape(QtGui.QFrame.Box) self.modelFramePre.setFrameShadow(QtGui.QFrame.Raised) self.modelFramePre.setObjectName(_fromUtf8("modelFramePre")) self.horizontalLayout_19.addWidget(self.modelFramePre) self.horizontalLayout_20.addWidget(self.workspacePre) self.workspacePost = QtGui.QWidget(self.frame) self.workspacePost.setObjectName(_fromUtf8("workspacePost")) self.horizontalLayout_18 = QtGui.QHBoxLayout(self.workspacePost) self.horizontalLayout_18.setMargin(0) self.horizontalLayout_18.setObjectName(_fromUtf8("horizontalLayout_18")) self.verticalLayout_13 = QtGui.QVBoxLayout() self.verticalLayout_13.setObjectName(_fromUtf8("verticalLayout_13")) self.horizontalLayout_17 = QtGui.QHBoxLayout() self.horizontalLayout_17.setObjectName(_fromUtf8("horizontalLayout_17")) self.modelFramePost = QtGui.QFrame(self.workspacePost) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.modelFramePost.sizePolicy().hasHeightForWidth()) self.modelFramePost.setSizePolicy(sizePolicy) self.modelFramePost.setFrameShape(QtGui.QFrame.Box) self.modelFramePost.setFrameShadow(QtGui.QFrame.Raised) self.modelFramePost.setObjectName(_fromUtf8("modelFramePost")) self.horizontalLayout_17.addWidget(self.modelFramePost) self.sliceFramePost = QtGui.QFrame(self.workspacePost) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sliceFramePost.sizePolicy().hasHeightForWidth()) self.sliceFramePost.setSizePolicy(sizePolicy) self.sliceFramePost.setFrameShape(QtGui.QFrame.Box) self.sliceFramePost.setFrameShadow(QtGui.QFrame.Raised) self.sliceFramePost.setObjectName(_fromUtf8("sliceFramePost")) self.horizontalLayout_17.addWidget(self.sliceFramePost) self.verticalLayout_13.addLayout(self.horizontalLayout_17) self.verticalLayout_10 = QtGui.QVBoxLayout() self.verticalLayout_10.setSpacing(0) self.verticalLayout_10.setObjectName(_fromUtf8("verticalLayout_10")) self.horizontalLayout_25 = QtGui.QHBoxLayout() self.horizontalLayout_25.setObjectName(_fromUtf8("horizontalLayout_25")) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_25.addItem(spacerItem) self.toolButton_4 = QtGui.QToolButton(self.workspacePost) self.toolButton_4.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/media_beginning.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_4.setIcon(icon1) self.toolButton_4.setIconSize(QtCore.QSize(24, 24)) self.toolButton_4.setObjectName(_fromUtf8("toolButton_4")) self.horizontalLayout_25.addWidget(self.toolButton_4) self.toolButton_3 = QtGui.QToolButton(self.workspacePost) self.toolButton_3.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/media_step_back.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_3.setIcon(icon2) self.toolButton_3.setIconSize(QtCore.QSize(24, 24)) self.toolButton_3.setObjectName(_fromUtf8("toolButton_3")) self.horizontalLayout_25.addWidget(self.toolButton_3) self.toolButton = QtGui.QToolButton(self.workspacePost) self.toolButton.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/media_step_forward.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton.setIcon(icon3) self.toolButton.setIconSize(QtCore.QSize(24, 24)) self.toolButton.setObjectName(_fromUtf8("toolButton")) self.horizontalLayout_25.addWidget(self.toolButton) self.toolButton_6 = QtGui.QToolButton(self.workspacePost) self.toolButton_6.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/media_end.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_6.setIcon(icon4) self.toolButton_6.setIconSize(QtCore.QSize(24, 24)) self.toolButton_6.setObjectName(_fromUtf8("toolButton_6")) self.horizontalLayout_25.addWidget(self.toolButton_6) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_25.addItem(spacerItem1) self.verticalLayout_10.addLayout(self.horizontalLayout_25) self.verticalLayout_13.addLayout(self.verticalLayout_10) self.horizontalLayout_18.addLayout(self.verticalLayout_13) self.horizontalLayout_20.addWidget(self.workspacePost) self.horizontalLayout_21.addLayout(self.horizontalLayout_20) self.horizontalLayout_22.addWidget(self.frame) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1281, 21)) self.menubar.setObjectName(_fromUtf8("menubar")) self.menuAbout = QtGui.QMenu(self.menubar) self.menuAbout.setTitle(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8)) self.menuAbout.setObjectName(_fromUtf8("menuAbout")) self.menuTools = QtGui.QMenu(self.menubar) self.menuTools.setTitle(QtGui.QApplication.translate("MainWindow", "Tools", None, QtGui.QApplication.UnicodeUTF8)) self.menuTools.setObjectName(_fromUtf8("menuTools")) self.menuFile = QtGui.QMenu(self.menubar) self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "File", None, QtGui.QApplication.UnicodeUTF8)) self.menuFile.setObjectName(_fromUtf8("menuFile")) self.menuWindow = QtGui.QMenu(self.menubar) self.menuWindow.setTitle(QtGui.QApplication.translate("MainWindow", "View", None, QtGui.QApplication.UnicodeUTF8)) self.menuWindow.setObjectName(_fromUtf8("menuWindow")) self.menuEdit = QtGui.QMenu(self.menubar) self.menuEdit.setTitle(QtGui.QApplication.translate("MainWindow", "Edit", None, QtGui.QApplication.UnicodeUTF8)) self.menuEdit.setObjectName(_fromUtf8("menuEdit")) self.menuWindow_2 = QtGui.QMenu(self.menubar) self.menuWindow_2.setTitle(QtGui.QApplication.translate("MainWindow", "Window", None, QtGui.QApplication.UnicodeUTF8)) self.menuWindow_2.setObjectName(_fromUtf8("menuWindow_2")) self.menuShow_Workspace = QtGui.QMenu(self.menuWindow_2) self.menuShow_Workspace.setTitle(QtGui.QApplication.translate("MainWindow", "Show Workspace", None, QtGui.QApplication.UnicodeUTF8)) self.menuShow_Workspace.setObjectName(_fromUtf8("menuShow_Workspace")) MainWindow.setMenuBar(self.menubar) self.toolBar = QtGui.QToolBar(MainWindow) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(133, 133, 133)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(133, 133, 133)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(133, 133, 133)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush) self.toolBar.setPalette(palette) self.toolBar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Main Toolbar", None, QtGui.QApplication.UnicodeUTF8)) self.toolBar.setAutoFillBackground(True) self.toolBar.setMovable(False) self.toolBar.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) self.toolBar.setObjectName(_fromUtf8("toolBar")) MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.toolBar_3 = QtGui.QToolBar(MainWindow) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(133, 133, 133)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(133, 133, 133)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(227, 227, 227)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(133, 133, 133)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(100, 100, 100)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(200, 200, 200)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush) self.toolBar_3.setPalette(palette) self.toolBar_3.setWindowTitle(QtGui.QApplication.translate("MainWindow", "toolBar_3", None, QtGui.QApplication.UnicodeUTF8)) self.toolBar_3.setAutoFillBackground(True) self.toolBar_3.setMovable(False) self.toolBar_3.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.toolBar_3.setFloatable(True) self.toolBar_3.setObjectName(_fromUtf8("toolBar_3")) MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar_3) self.toolbar = QtGui.QDockWidget(MainWindow) self.toolbar.setAutoFillBackground(False) self.toolbar.setFloating(False) self.toolbar.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures) self.toolbar.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea|QtCore.Qt.RightDockWidgetArea) self.toolbar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Tools", None, QtGui.QApplication.UnicodeUTF8)) self.toolbar.setObjectName(_fromUtf8("toolbar")) self.dockWidgetContents = QtGui.QWidget() self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents")) self.verticalLayout_5 = QtGui.QVBoxLayout(self.dockWidgetContents) self.verticalLayout_5.setSpacing(0) self.verticalLayout_5.setMargin(0) self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.toolbarFrame = QtGui.QFrame(self.dockWidgetContents) self.toolbarFrame.setAutoFillBackground(True) self.toolbarFrame.setFrameShape(QtGui.QFrame.Box) self.toolbarFrame.setFrameShadow(QtGui.QFrame.Plain) self.toolbarFrame.setObjectName(_fromUtf8("toolbarFrame")) self.verticalLayout_4 = QtGui.QVBoxLayout(self.toolbarFrame) self.verticalLayout_4.setSpacing(0) self.verticalLayout_4.setMargin(0) self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.toolButton_9 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_9.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Clone.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_9.setIcon(icon5) self.toolButton_9.setIconSize(QtCore.QSize(32, 32)) self.toolButton_9.setObjectName(_fromUtf8("toolButton_9")) self.verticalLayout_3.addWidget(self.toolButton_9) self.toolButton_8 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_8.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Color palette.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_8.setIcon(icon6) self.toolButton_8.setIconSize(QtCore.QSize(32, 32)) self.toolButton_8.setObjectName(_fromUtf8("toolButton_8")) self.verticalLayout_3.addWidget(self.toolButton_8) self.toolButton_7 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_7.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/3d rotation.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_7.setIcon(icon7) self.toolButton_7.setIconSize(QtCore.QSize(32, 32)) self.toolButton_7.setObjectName(_fromUtf8("toolButton_7")) self.verticalLayout_3.addWidget(self.toolButton_7) self.toolButton_5 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_5.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon8 = QtGui.QIcon() icon8.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Clipping.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_5.setIcon(icon8) self.toolButton_5.setIconSize(QtCore.QSize(32, 32)) self.toolButton_5.setObjectName(_fromUtf8("toolButton_5")) self.verticalLayout_3.addWidget(self.toolButton_5) self.toolButton_2 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_2.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon9 = QtGui.QIcon() icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Frame cube.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_2.setIcon(icon9) self.toolButton_2.setIconSize(QtCore.QSize(32, 32)) self.toolButton_2.setObjectName(_fromUtf8("toolButton_2")) self.verticalLayout_3.addWidget(self.toolButton_2) self.toolButton_17 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_17.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon10 = QtGui.QIcon() icon10.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Predefined views.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_17.setIcon(icon10) self.toolButton_17.setIconSize(QtCore.QSize(32, 32)) self.toolButton_17.setObjectName(_fromUtf8("toolButton_17")) self.verticalLayout_3.addWidget(self.toolButton_17) self.toolButton_19 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_19.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon11 = QtGui.QIcon() icon11.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Ungroup.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_19.setIcon(icon11) self.toolButton_19.setIconSize(QtCore.QSize(32, 32)) self.toolButton_19.setObjectName(_fromUtf8("toolButton_19")) self.verticalLayout_3.addWidget(self.toolButton_19) self.toolButton_20 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_20.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon12 = QtGui.QIcon() icon12.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Group.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_20.setIcon(icon12) self.toolButton_20.setIconSize(QtCore.QSize(32, 32)) self.toolButton_20.setObjectName(_fromUtf8("toolButton_20")) self.verticalLayout_3.addWidget(self.toolButton_20) self.toolButton_13 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_13.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon13 = QtGui.QIcon() icon13.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Object tree.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_13.setIcon(icon13) self.toolButton_13.setIconSize(QtCore.QSize(32, 32)) self.toolButton_13.setObjectName(_fromUtf8("toolButton_13")) self.verticalLayout_3.addWidget(self.toolButton_13) self.toolButton_34 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_34.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon14 = QtGui.QIcon() icon14.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Edit.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_34.setIcon(icon14) self.toolButton_34.setIconSize(QtCore.QSize(32, 32)) self.toolButton_34.setObjectName(_fromUtf8("toolButton_34")) self.verticalLayout_3.addWidget(self.toolButton_34) self.toolButton_25 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_25.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon15 = QtGui.QIcon() icon15.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Scale.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_25.setIcon(icon15) self.toolButton_25.setIconSize(QtCore.QSize(32, 32)) self.toolButton_25.setObjectName(_fromUtf8("toolButton_25")) self.verticalLayout_3.addWidget(self.toolButton_25) self.toolButton_11 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_11.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon16 = QtGui.QIcon() icon16.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Cube.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_11.setIcon(icon16) self.toolButton_11.setIconSize(QtCore.QSize(32, 32)) self.toolButton_11.setObjectName(_fromUtf8("toolButton_11")) self.verticalLayout_3.addWidget(self.toolButton_11) self.toolButton_27 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_27.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon17 = QtGui.QIcon() icon17.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Units.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_27.setIcon(icon17) self.toolButton_27.setIconSize(QtCore.QSize(32, 32)) self.toolButton_27.setObjectName(_fromUtf8("toolButton_27")) self.verticalLayout_3.addWidget(self.toolButton_27) self.toolButton_21 = QtGui.QToolButton(self.toolbarFrame) self.toolButton_21.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8)) icon18 = QtGui.QIcon() icon18.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Size.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_21.setIcon(icon18) self.toolButton_21.setIconSize(QtCore.QSize(32, 32)) self.toolButton_21.setObjectName(_fromUtf8("toolButton_21")) self.verticalLayout_3.addWidget(self.toolButton_21) self.verticalLayout_4.addLayout(self.verticalLayout_3) self.verticalLayout_5.addWidget(self.toolbarFrame) spacerItem2 = QtGui.QSpacerItem(20, 97, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_5.addItem(spacerItem2) self.toolbar.setWidget(self.dockWidgetContents) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.toolbar) self.logBar = QtGui.QDockWidget(MainWindow) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.logBar.sizePolicy().hasHeightForWidth()) self.logBar.setSizePolicy(sizePolicy) self.logBar.setMinimumSize(QtCore.QSize(89, 115)) self.logBar.setAutoFillBackground(False) self.logBar.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures) self.logBar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Log Console", None, QtGui.QApplication.UnicodeUTF8)) self.logBar.setObjectName(_fromUtf8("logBar")) self.dockWidgetContents_2 = QtGui.QWidget() self.dockWidgetContents_2.setObjectName(_fromUtf8("dockWidgetContents_2")) self.verticalLayout_2 = QtGui.QVBoxLayout(self.dockWidgetContents_2) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.consoletext = QtGui.QTextEdit(self.dockWidgetContents_2) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.consoletext.sizePolicy().hasHeightForWidth()) self.consoletext.setSizePolicy(sizePolicy) self.consoletext.setMaximumSize(QtCore.QSize(16777215, 75)) self.consoletext.setBaseSize(QtCore.QSize(0, 75)) self.consoletext.setReadOnly(True) self.consoletext.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse) self.consoletext.setObjectName(_fromUtf8("consoletext")) self.verticalLayout_2.addWidget(self.consoletext) self.logBar.setWidget(self.dockWidgetContents_2) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.logBar) self.sliceListBar = QtGui.QDockWidget(MainWindow) self.sliceListBar.setMinimumSize(QtCore.QSize(228, 148)) self.sliceListBar.setObjectName(_fromUtf8("sliceListBar")) self.dockWidgetContents_6 = QtGui.QWidget() self.dockWidgetContents_6.setObjectName(_fromUtf8("dockWidgetContents_6")) self.horizontalLayout_6 = QtGui.QHBoxLayout(self.dockWidgetContents_6) self.horizontalLayout_6.setSpacing(0) self.horizontalLayout_6.setMargin(0) self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.tabWidget = QtGui.QTabWidget(self.dockWidgetContents_6) self.tabWidget.setStyleSheet(_fromUtf8("selection-background-color: rgb(239, 239, 239);")) self.tabWidget.setObjectName(_fromUtf8("tabWidget")) self.tab = QtGui.QWidget() self.tab.setObjectName(_fromUtf8("tab")) self.horizontalLayout_2 = QtGui.QHBoxLayout(self.tab) self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.label = QtGui.QLabel(self.tab) self.label.setText(QtGui.QApplication.translate("MainWindow", "No slices to show!", None, QtGui.QApplication.UnicodeUTF8)) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout_2.addWidget(self.label) self.tabWidget.addTab(self.tab, _fromUtf8("")) self.tab_2 = QtGui.QWidget() self.tab_2.setObjectName(_fromUtf8("tab_2")) self.tabWidget.addTab(self.tab_2, _fromUtf8("")) self.verticalLayout.addWidget(self.tabWidget) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) self.pushButton_5 = QtGui.QPushButton(self.dockWidgetContents_6) self.pushButton_5.setMinimumSize(QtCore.QSize(100, 0)) self.pushButton_5.setText(QtGui.QApplication.translate("MainWindow", "Print", None, QtGui.QApplication.UnicodeUTF8)) icon19 = QtGui.QIcon() icon19.addPixmap(QtGui.QPixmap(_fromUtf8(":/printer icons/icons/printer/Start 3d-printing.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton_5.setIcon(icon19) self.pushButton_5.setIconSize(QtCore.QSize(24, 24)) self.pushButton_5.setObjectName(_fromUtf8("pushButton_5")) self.horizontalLayout_5.addWidget(self.pushButton_5) self.verticalLayout.addLayout(self.horizontalLayout_5) self.horizontalLayout_6.addLayout(self.verticalLayout) self.sliceListBar.setWidget(self.dockWidgetContents_6) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.sliceListBar) self.printJobInfoBar = QtGui.QDockWidget(MainWindow) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.printJobInfoBar.sizePolicy().hasHeightForWidth()) self.printJobInfoBar.setSizePolicy(sizePolicy) self.printJobInfoBar.setMaximumSize(QtCore.QSize(524287, 120)) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(160, 160, 160)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(160, 160, 160)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(160, 160, 160)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush) self.printJobInfoBar.setPalette(palette) self.printJobInfoBar.setAutoFillBackground(False) self.printJobInfoBar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Print Job Information", None, QtGui.QApplication.UnicodeUTF8)) self.printJobInfoBar.setObjectName(_fromUtf8("printJobInfoBar")) self.dockWidgetContents_3 = QtGui.QWidget() self.dockWidgetContents_3.setObjectName(_fromUtf8("dockWidgetContents_3")) self.horizontalLayout_7 = QtGui.QHBoxLayout(self.dockWidgetContents_3) self.horizontalLayout_7.setSpacing(0) self.horizontalLayout_7.setMargin(0) self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7")) self.frame_4 = QtGui.QFrame(self.dockWidgetContents_3) self.frame_4.setAutoFillBackground(True) self.frame_4.setFrameShape(QtGui.QFrame.Box) self.frame_4.setFrameShadow(QtGui.QFrame.Plain) self.frame_4.setObjectName(_fromUtf8("frame_4")) self.horizontalLayout_8 = QtGui.QHBoxLayout(self.frame_4) self.horizontalLayout_8.setSpacing(0) self.horizontalLayout_8.setMargin(0) self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8")) self.verticalLayout_6 = QtGui.QVBoxLayout() self.verticalLayout_6.setSpacing(0) self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.label_4 = QtGui.QLabel(self.frame_4) font = QtGui.QFont() font.setPointSize(8) self.label_4.setFont(font) self.label_4.setText(QtGui.QApplication.translate("MainWindow", " Time to print: ", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setObjectName(_fromUtf8("label_4")) self.horizontalLayout_3.addWidget(self.label_4) self.label_5 = QtGui.QLabel(self.frame_4) font = QtGui.QFont() font.setPointSize(16) self.label_5.setFont(font) self.label_5.setText(QtGui.QApplication.translate("MainWindow", "0:00:00", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setObjectName(_fromUtf8("label_5")) self.horizontalLayout_3.addWidget(self.label_5) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem3) self.verticalLayout_6.addLayout(self.horizontalLayout_3) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.label_2 = QtGui.QLabel(self.frame_4) font = QtGui.QFont() font.setPointSize(8) self.label_2.setFont(font) self.label_2.setText(QtGui.QApplication.translate("MainWindow", " Volume of resin needed to print: ", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setObjectName(_fromUtf8("label_2")) self.horizontalLayout.addWidget(self.label_2) self.label_7 = QtGui.QLabel(self.frame_4) font = QtGui.QFont() font.setPointSize(16) self.label_7.setFont(font) self.label_7.setText(QtGui.QApplication.translate("MainWindow", "0", None, QtGui.QApplication.UnicodeUTF8)) self.label_7.setObjectName(_fromUtf8("label_7")) self.horizontalLayout.addWidget(self.label_7) self.label_6 = QtGui.QLabel(self.frame_4) font = QtGui.QFont() font.setPointSize(10) self.label_6.setFont(font) self.label_6.setText(QtGui.QApplication.translate("MainWindow", " cm^3", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setObjectName(_fromUtf8("label_6")) self.horizontalLayout.addWidget(self.label_6) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem4) self.verticalLayout_6.addLayout(self.horizontalLayout) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.label_3 = QtGui.QLabel(self.frame_4) font = QtGui.QFont() font.setPointSize(8) self.label_3.setFont(font) self.label_3.setText(QtGui.QApplication.translate("MainWindow", " Total cost to print: ", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setObjectName(_fromUtf8("label_3")) self.horizontalLayout_4.addWidget(self.label_3) self.label_8 = QtGui.QLabel(self.frame_4) font = QtGui.QFont() font.setPointSize(12) self.label_8.setFont(font) self.label_8.setText(QtGui.QApplication.translate("MainWindow", "$ ", None, QtGui.QApplication.UnicodeUTF8)) self.label_8.setObjectName(_fromUtf8("label_8")) self.horizontalLayout_4.addWidget(self.label_8) self.label_9 = QtGui.QLabel(self.frame_4) font = QtGui.QFont() font.setPointSize(16) self.label_9.setFont(font) self.label_9.setText(QtGui.QApplication.translate("MainWindow", "0.00", None, QtGui.QApplication.UnicodeUTF8)) self.label_9.setObjectName(_fromUtf8("label_9")) self.horizontalLayout_4.addWidget(self.label_9) spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem5) self.verticalLayout_6.addLayout(self.horizontalLayout_4) self.horizontalLayout_8.addLayout(self.verticalLayout_6) self.horizontalLayout_7.addWidget(self.frame_4) self.printJobInfoBar.setWidget(self.dockWidgetContents_3) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.printJobInfoBar) self.preSliceBar = QtGui.QDockWidget(MainWindow) self.preSliceBar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Model Tools", None, QtGui.QApplication.UnicodeUTF8)) self.preSliceBar.setObjectName(_fromUtf8("preSliceBar")) self.dockWidgetContents_4 = QtGui.QWidget() self.dockWidgetContents_4.setObjectName(_fromUtf8("dockWidgetContents_4")) self.horizontalLayout_16 = QtGui.QHBoxLayout(self.dockWidgetContents_4) self.horizontalLayout_16.setSpacing(0) self.horizontalLayout_16.setMargin(0) self.horizontalLayout_16.setObjectName(_fromUtf8("horizontalLayout_16")) self.frame_2 = QtGui.QFrame(self.dockWidgetContents_4) self.frame_2.setAutoFillBackground(True) self.frame_2.setFrameShape(QtGui.QFrame.StyledPanel) self.frame_2.setFrameShadow(QtGui.QFrame.Raised) self.frame_2.setObjectName(_fromUtf8("frame_2")) self.horizontalLayout_15 = QtGui.QHBoxLayout(self.frame_2) self.horizontalLayout_15.setSpacing(0) self.horizontalLayout_15.setMargin(0) self.horizontalLayout_15.setObjectName(_fromUtf8("horizontalLayout_15")) self.verticalLayout_9 = QtGui.QVBoxLayout() self.verticalLayout_9.setSpacing(0) self.verticalLayout_9.setObjectName(_fromUtf8("verticalLayout_9")) self.toolButton_10 = QtGui.QToolButton(self.frame_2) self.toolButton_10.setText(QtGui.QApplication.translate("MainWindow", "Slice", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton_10.setIcon(icon8) self.toolButton_10.setIconSize(QtCore.QSize(24, 24)) self.toolButton_10.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.toolButton_10.setObjectName(_fromUtf8("toolButton_10")) self.verticalLayout_9.addWidget(self.toolButton_10) self.groupBox_2 = QtGui.QGroupBox(self.frame_2) self.groupBox_2.setMinimumSize(QtCore.QSize(0, 100)) self.groupBox_2.setMaximumSize(QtCore.QSize(254, 16777215)) self.groupBox_2.setTitle(QtGui.QApplication.translate("MainWindow", "Model List", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) self.horizontalLayout_9 = QtGui.QHBoxLayout(self.groupBox_2) self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) self.verticalLayout_7 = QtGui.QVBoxLayout() self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7")) self.horizontalLayout_10 = QtGui.QHBoxLayout() self.horizontalLayout_10.setObjectName(_fromUtf8("horizontalLayout_10")) self.addModel = QtGui.QPushButton(self.groupBox_2) self.addModel.setText(QtGui.QApplication.translate("MainWindow", "Add", None, QtGui.QApplication.UnicodeUTF8)) self.addModel.setObjectName(_fromUtf8("addModel")) self.horizontalLayout_10.addWidget(self.addModel) spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_10.addItem(spacerItem6) self.removeModel = QtGui.QPushButton(self.groupBox_2) self.removeModel.setText(QtGui.QApplication.translate("MainWindow", "Remove", None, QtGui.QApplication.UnicodeUTF8)) self.removeModel.setObjectName(_fromUtf8("removeModel")) self.horizontalLayout_10.addWidget(self.removeModel) self.verticalLayout_7.addLayout(self.horizontalLayout_10) self.modelList = QtGui.QListWidget(self.groupBox_2) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.modelList.sizePolicy().hasHeightForWidth()) self.modelList.setSizePolicy(sizePolicy) self.modelList.setFrameShadow(QtGui.QFrame.Plain) self.modelList.setAlternatingRowColors(False) self.modelList.setSpacing(1) self.modelList.setModelColumn(0) self.modelList.setObjectName(_fromUtf8("modelList")) self.verticalLayout_7.addWidget(self.modelList) self.horizontalLayout_9.addLayout(self.verticalLayout_7) self.verticalLayout_9.addWidget(self.groupBox_2) self.Transform_groupbox = QtGui.QGroupBox(self.frame_2) self.Transform_groupbox.setEnabled(False) self.Transform_groupbox.setMaximumSize(QtCore.QSize(254, 16777215)) self.Transform_groupbox.setTitle(QtGui.QApplication.translate("MainWindow", "Transform Model", None, QtGui.QApplication.UnicodeUTF8)) self.Transform_groupbox.setObjectName(_fromUtf8("Transform_groupbox")) self.horizontalLayout_11 = QtGui.QHBoxLayout(self.Transform_groupbox) self.horizontalLayout_11.setObjectName(_fromUtf8("horizontalLayout_11")) self.verticalLayout_8 = QtGui.QVBoxLayout() self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) self.label_12 = QtGui.QLabel(self.Transform_groupbox) self.label_12.setText(QtGui.QApplication.translate("MainWindow", "Position:", None, QtGui.QApplication.UnicodeUTF8)) self.label_12.setObjectName(_fromUtf8("label_12")) self.verticalLayout_8.addWidget(self.label_12) self.horizontalLayout_12 = QtGui.QHBoxLayout() self.horizontalLayout_12.setObjectName(_fromUtf8("horizontalLayout_12")) self.label_10 = QtGui.QLabel(self.Transform_groupbox) self.label_10.setText(QtGui.QApplication.translate("MainWindow", "X:", None, QtGui.QApplication.UnicodeUTF8)) self.label_10.setObjectName(_fromUtf8("label_10")) self.horizontalLayout_12.addWidget(self.label_10) self.positionX = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.positionX.setMinimumSize(QtCore.QSize(55, 0)) self.positionX.setMinimum(-99.99) self.positionX.setObjectName(_fromUtf8("positionX")) self.horizontalLayout_12.addWidget(self.positionX) self.label_11 = QtGui.QLabel(self.Transform_groupbox) self.label_11.setText(QtGui.QApplication.translate("MainWindow", "Y:", None, QtGui.QApplication.UnicodeUTF8)) self.label_11.setObjectName(_fromUtf8("label_11")) self.horizontalLayout_12.addWidget(self.label_11) self.positionY = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.positionY.setMinimumSize(QtCore.QSize(55, 0)) self.positionY.setMinimum(-99.99) self.positionY.setObjectName(_fromUtf8("positionY")) self.horizontalLayout_12.addWidget(self.positionY) self.label_13 = QtGui.QLabel(self.Transform_groupbox) self.label_13.setText(QtGui.QApplication.translate("MainWindow", "Z:", None, QtGui.QApplication.UnicodeUTF8)) self.label_13.setObjectName(_fromUtf8("label_13")) self.horizontalLayout_12.addWidget(self.label_13) self.positionZ = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.positionZ.setMinimumSize(QtCore.QSize(55, 0)) self.positionZ.setMinimum(-99.99) self.positionZ.setObjectName(_fromUtf8("positionZ")) self.horizontalLayout_12.addWidget(self.positionZ) self.verticalLayout_8.addLayout(self.horizontalLayout_12) self.label_14 = QtGui.QLabel(self.Transform_groupbox) self.label_14.setText(QtGui.QApplication.translate("MainWindow", "Rotation:", None, QtGui.QApplication.UnicodeUTF8)) self.label_14.setObjectName(_fromUtf8("label_14")) self.verticalLayout_8.addWidget(self.label_14) self.horizontalLayout_13 = QtGui.QHBoxLayout() self.horizontalLayout_13.setObjectName(_fromUtf8("horizontalLayout_13")) self.label_15 = QtGui.QLabel(self.Transform_groupbox) self.label_15.setText(QtGui.QApplication.translate("MainWindow", "X:", None, QtGui.QApplication.UnicodeUTF8)) self.label_15.setObjectName(_fromUtf8("label_15")) self.horizontalLayout_13.addWidget(self.label_15) self.rotationX = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.rotationX.setMinimumSize(QtCore.QSize(55, 0)) self.rotationX.setDecimals(0) self.rotationX.setMinimum(-360.0) self.rotationX.setMaximum(360.0) self.rotationX.setObjectName(_fromUtf8("rotationX")) self.horizontalLayout_13.addWidget(self.rotationX) self.label_16 = QtGui.QLabel(self.Transform_groupbox) self.label_16.setText(QtGui.QApplication.translate("MainWindow", "Y:", None, QtGui.QApplication.UnicodeUTF8)) self.label_16.setObjectName(_fromUtf8("label_16")) self.horizontalLayout_13.addWidget(self.label_16) self.rotationY = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.rotationY.setMinimumSize(QtCore.QSize(55, 0)) self.rotationY.setDecimals(0) self.rotationY.setMinimum(-360.0) self.rotationY.setMaximum(360.0) self.rotationY.setObjectName(_fromUtf8("rotationY")) self.horizontalLayout_13.addWidget(self.rotationY) self.label_17 = QtGui.QLabel(self.Transform_groupbox) self.label_17.setText(QtGui.QApplication.translate("MainWindow", "Z:", None, QtGui.QApplication.UnicodeUTF8)) self.label_17.setObjectName(_fromUtf8("label_17")) self.horizontalLayout_13.addWidget(self.label_17) self.rotationZ = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.rotationZ.setMinimumSize(QtCore.QSize(55, 0)) self.rotationZ.setDecimals(0) self.rotationZ.setMinimum(-360.0) self.rotationZ.setMaximum(360.0) self.rotationZ.setObjectName(_fromUtf8("rotationZ")) self.horizontalLayout_13.addWidget(self.rotationZ) self.verticalLayout_8.addLayout(self.horizontalLayout_13) self.horizontalLayout_14 = QtGui.QHBoxLayout() self.horizontalLayout_14.setObjectName(_fromUtf8("horizontalLayout_14")) self.label_18 = QtGui.QLabel(self.Transform_groupbox) self.label_18.setText(QtGui.QApplication.translate("MainWindow", "Scaling Factor:", None, QtGui.QApplication.UnicodeUTF8)) self.label_18.setObjectName(_fromUtf8("label_18")) self.horizontalLayout_14.addWidget(self.label_18) self.scale = QtGui.QDoubleSpinBox(self.Transform_groupbox) self.scale.setMinimumSize(QtCore.QSize(55, 0)) self.scale.setDecimals(0) self.scale.setMinimum(0.0) self.scale.setMaximum(500.0) self.scale.setSingleStep(1.0) self.scale.setProperty("value", 100.0) self.scale.setObjectName(_fromUtf8("scale")) self.horizontalLayout_14.addWidget(self.scale) self.label_19 = QtGui.QLabel(self.Transform_groupbox) self.label_19.setText(QtGui.QApplication.translate("MainWindow", "%", None, QtGui.QApplication.UnicodeUTF8)) self.label_19.setObjectName(_fromUtf8("label_19")) self.horizontalLayout_14.addWidget(self.label_19) spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem7) self.verticalLayout_8.addLayout(self.horizontalLayout_14) self.horizontalLayout_11.addLayout(self.verticalLayout_8) self.verticalLayout_9.addWidget(self.Transform_groupbox) self.groupBox = QtGui.QGroupBox(self.frame_2) self.groupBox.setMinimumSize(QtCore.QSize(0, 50)) self.groupBox.setMaximumSize(QtCore.QSize(254, 16777215)) self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Model Information", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.verticalLayout_12 = QtGui.QVBoxLayout(self.groupBox) self.verticalLayout_12.setObjectName(_fromUtf8("verticalLayout_12")) self.verticalLayout_11 = QtGui.QVBoxLayout() self.verticalLayout_11.setObjectName(_fromUtf8("verticalLayout_11")) self.horizontalLayout_23 = QtGui.QHBoxLayout() self.horizontalLayout_23.setObjectName(_fromUtf8("horizontalLayout_23")) self.verticalLayout_11.addLayout(self.horizontalLayout_23) self.horizontalLayout_24 = QtGui.QHBoxLayout() self.horizontalLayout_24.setObjectName(_fromUtf8("horizontalLayout_24")) self.label_22 = QtGui.QLabel(self.groupBox) self.label_22.setText(QtGui.QApplication.translate("MainWindow", "Model Volume:", None, QtGui.QApplication.UnicodeUTF8)) self.label_22.setObjectName(_fromUtf8("label_22")) self.horizontalLayout_24.addWidget(self.label_22) self.label_23 = QtGui.QLabel(self.groupBox) self.label_23.setText(QtGui.QApplication.translate("MainWindow", "cm^3", None, QtGui.QApplication.UnicodeUTF8)) self.label_23.setObjectName(_fromUtf8("label_23")) self.horizontalLayout_24.addWidget(self.label_23) self.verticalLayout_11.addLayout(self.horizontalLayout_24) spacerItem8 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_11.addItem(spacerItem8) self.verticalLayout_12.addLayout(self.verticalLayout_11) self.verticalLayout_9.addWidget(self.groupBox) self.horizontalLayout_15.addLayout(self.verticalLayout_9) self.horizontalLayout_16.addWidget(self.frame_2) self.preSliceBar.setWidget(self.dockWidgetContents_4) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.preSliceBar) self.actionQuit = QtGui.QAction(MainWindow) icon20 = QtGui.QIcon() icon20.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Close.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionQuit.setIcon(icon20) self.actionQuit.setText(QtGui.QApplication.translate("MainWindow", "Quit", None, QtGui.QApplication.UnicodeUTF8)) self.actionQuit.setObjectName(_fromUtf8("actionQuit")) self.actionOpen = QtGui.QAction(MainWindow) icon21 = QtGui.QIcon() icon21.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Open.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionOpen.setIcon(icon21) self.actionOpen.setText(QtGui.QApplication.translate("MainWindow", "Open Existing Print Job", None, QtGui.QApplication.UnicodeUTF8)) self.actionOpen.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8)) self.actionOpen.setObjectName(_fromUtf8("actionOpen")) self.actionAbout = QtGui.QAction(MainWindow) icon22 = QtGui.QIcon() icon22.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/about.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionAbout.setIcon(icon22) self.actionAbout.setText(QtGui.QApplication.translate("MainWindow", "About", None, QtGui.QApplication.UnicodeUTF8)) self.actionAbout.setObjectName(_fromUtf8("actionAbout")) self.actionHelp = QtGui.QAction(MainWindow) icon23 = QtGui.QIcon() icon23.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/question_and_answer.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionHelp.setIcon(icon23) self.actionHelp.setText(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8)) self.actionHelp.setObjectName(_fromUtf8("actionHelp")) self.actionSave_current_settings_as_default = QtGui.QAction(MainWindow) self.actionSave_current_settings_as_default.setCheckable(True) icon24 = QtGui.QIcon() icon24.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/notebook_preferences.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSave_current_settings_as_default.setIcon(icon24) self.actionSave_current_settings_as_default.setText(QtGui.QApplication.translate("MainWindow", "Save current settings as default", None, QtGui.QApplication.UnicodeUTF8)) self.actionSave_current_settings_as_default.setObjectName(_fromUtf8("actionSave_current_settings_as_default")) self.actionOpen_manual_printer_control = QtGui.QAction(MainWindow) icon25 = QtGui.QIcon() icon25.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Hammer.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionOpen_manual_printer_control.setIcon(icon25) self.actionOpen_manual_printer_control.setText(QtGui.QApplication.translate("MainWindow", "Open Manual Printer Control", None, QtGui.QApplication.UnicodeUTF8)) self.actionOpen_manual_printer_control.setObjectName(_fromUtf8("actionOpen_manual_printer_control")) self.actionPreferences = QtGui.QAction(MainWindow) icon26 = QtGui.QIcon() icon26.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Settings.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionPreferences.setIcon(icon26) self.actionPreferences.setText(QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8)) self.actionPreferences.setToolTip(QtGui.QApplication.translate("MainWindow", "Manage Preferences", None, QtGui.QApplication.UnicodeUTF8)) self.actionPreferences.setObjectName(_fromUtf8("actionPreferences")) self.actionNext_Slice = QtGui.QAction(MainWindow) self.actionNext_Slice.setIcon(icon3) self.actionNext_Slice.setText(QtGui.QApplication.translate("MainWindow", "Next Slice", None, QtGui.QApplication.UnicodeUTF8)) self.actionNext_Slice.setToolTip(QtGui.QApplication.translate("MainWindow", "Preview Next Slice", None, QtGui.QApplication.UnicodeUTF8)) self.actionNext_Slice.setObjectName(_fromUtf8("actionNext_Slice")) self.actionPrevious_Slice = QtGui.QAction(MainWindow) self.actionPrevious_Slice.setIcon(icon2) self.actionPrevious_Slice.setText(QtGui.QApplication.translate("MainWindow", "Previous Slice", None, QtGui.QApplication.UnicodeUTF8)) self.actionPrevious_Slice.setToolTip(QtGui.QApplication.translate("MainWindow", "Preview Previous Slice", None, QtGui.QApplication.UnicodeUTF8)) self.actionPrevious_Slice.setObjectName(_fromUtf8("actionPrevious_Slice")) self.actionFirst_Slice = QtGui.QAction(MainWindow) self.actionFirst_Slice.setIcon(icon1) self.actionFirst_Slice.setText(QtGui.QApplication.translate("MainWindow", "First Slice", None, QtGui.QApplication.UnicodeUTF8)) self.actionFirst_Slice.setToolTip(QtGui.QApplication.translate("MainWindow", "Preview First Slice", None, QtGui.QApplication.UnicodeUTF8)) self.actionFirst_Slice.setObjectName(_fromUtf8("actionFirst_Slice")) self.actionLast_Slice = QtGui.QAction(MainWindow) self.actionLast_Slice.setIcon(icon4) self.actionLast_Slice.setText(QtGui.QApplication.translate("MainWindow", "Last Slice", None, QtGui.QApplication.UnicodeUTF8)) self.actionLast_Slice.setToolTip(QtGui.QApplication.translate("MainWindow", "Preview Last Slice", None, QtGui.QApplication.UnicodeUTF8)) self.actionLast_Slice.setObjectName(_fromUtf8("actionLast_Slice")) self.actionSet_Model_Opacity = QtGui.QAction(MainWindow) icon27 = QtGui.QIcon() icon27.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/replace.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSet_Model_Opacity.setIcon(icon27) self.actionSet_Model_Opacity.setText(QtGui.QApplication.translate("MainWindow", "Set Model Opacity", None, QtGui.QApplication.UnicodeUTF8)) self.actionSet_Model_Opacity.setToolTip(QtGui.QApplication.translate("MainWindow", "Set Model Opacity", None, QtGui.QApplication.UnicodeUTF8)) self.actionSet_Model_Opacity.setObjectName(_fromUtf8("actionSet_Model_Opacity")) self.actionGo_To_Layer = QtGui.QAction(MainWindow) icon28 = QtGui.QIcon() icon28.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Search.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionGo_To_Layer.setIcon(icon28) self.actionGo_To_Layer.setText(QtGui.QApplication.translate("MainWindow", "Go To Layer", None, QtGui.QApplication.UnicodeUTF8)) self.actionGo_To_Layer.setObjectName(_fromUtf8("actionGo_To_Layer")) self.actionFirmware_Configurator = QtGui.QAction(MainWindow) icon29 = QtGui.QIcon() icon29.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Configuration.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionFirmware_Configurator.setIcon(icon29) self.actionFirmware_Configurator.setText(QtGui.QApplication.translate("MainWindow", "Firmware Configurator", None, QtGui.QApplication.UnicodeUTF8)) self.actionFirmware_Configurator.setObjectName(_fromUtf8("actionFirmware_Configurator")) self.actionConnect_To_Printer_2 = QtGui.QAction(MainWindow) icon30 = QtGui.QIcon() icon30.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Start 3d-printing.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionConnect_To_Printer_2.setIcon(icon30) self.actionConnect_To_Printer_2.setText(QtGui.QApplication.translate("MainWindow", "Connect", None, QtGui.QApplication.UnicodeUTF8)) self.actionConnect_To_Printer_2.setToolTip(QtGui.QApplication.translate("MainWindow", "Connect to Printer", None, QtGui.QApplication.UnicodeUTF8)) self.actionConnect_To_Printer_2.setObjectName(_fromUtf8("actionConnect_To_Printer_2")) self.actionSave = QtGui.QAction(MainWindow) icon31 = QtGui.QIcon() icon31.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Save.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSave.setIcon(icon31) self.actionSave.setText(QtGui.QApplication.translate("MainWindow", "Save", None, QtGui.QApplication.UnicodeUTF8)) self.actionSave.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+S", None, QtGui.QApplication.UnicodeUTF8)) self.actionSave.setObjectName(_fromUtf8("actionSave")) self.actionNew = QtGui.QAction(MainWindow) icon32 = QtGui.QIcon() icon32.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Project.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionNew.setIcon(icon32) self.actionNew.setText(QtGui.QApplication.translate("MainWindow", "New Print Job", None, QtGui.QApplication.UnicodeUTF8)) self.actionNew.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+N", None, QtGui.QApplication.UnicodeUTF8)) self.actionNew.setObjectName(_fromUtf8("actionNew")) self.actionSave_As = QtGui.QAction(MainWindow) self.actionSave_As.setIcon(icon31) self.actionSave_As.setText(QtGui.QApplication.translate("MainWindow", "Save As...", None, QtGui.QApplication.UnicodeUTF8)) self.actionSave_As.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+Shift+S", None, QtGui.QApplication.UnicodeUTF8)) self.actionSave_As.setObjectName(_fromUtf8("actionSave_As")) self.actionPrint = QtGui.QAction(MainWindow) self.actionPrint.setIcon(icon) self.actionPrint.setText(QtGui.QApplication.translate("MainWindow", "Print", None, QtGui.QApplication.UnicodeUTF8)) self.actionPrint.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+P", None, QtGui.QApplication.UnicodeUTF8)) self.actionPrint.setObjectName(_fromUtf8("actionPrint")) self.actionModel_View = QtGui.QAction(MainWindow) self.actionModel_View.setCheckable(True) icon33 = QtGui.QIcon() icon33.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/3D object.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionModel_View.setIcon(icon33) self.actionModel_View.setText(QtGui.QApplication.translate("MainWindow", "Model View", None, QtGui.QApplication.UnicodeUTF8)) self.actionModel_View.setObjectName(_fromUtf8("actionModel_View")) self.actionToolbar = QtGui.QAction(MainWindow) self.actionToolbar.setCheckable(True) icon34 = QtGui.QIcon() icon34.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Tools.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionToolbar.setIcon(icon34) self.actionToolbar.setText(QtGui.QApplication.translate("MainWindow", "Toolbar", None, QtGui.QApplication.UnicodeUTF8)) self.actionToolbar.setObjectName(_fromUtf8("actionToolbar")) self.actionSlice_Inspector = QtGui.QAction(MainWindow) self.actionSlice_Inspector.setCheckable(True) icon35 = QtGui.QIcon() icon35.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Layers.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSlice_Inspector.setIcon(icon35) self.actionSlice_Inspector.setText(QtGui.QApplication.translate("MainWindow", "Slice Inspector", None, QtGui.QApplication.UnicodeUTF8)) self.actionSlice_Inspector.setObjectName(_fromUtf8("actionSlice_Inspector")) self.actionModel_Edit = QtGui.QAction(MainWindow) self.actionModel_Edit.setCheckable(True) icon36 = QtGui.QIcon() icon36.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Cartesian.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionModel_Edit.setIcon(icon36) self.actionModel_Edit.setText(QtGui.QApplication.translate("MainWindow", "Model Edit", None, QtGui.QApplication.UnicodeUTF8)) self.actionModel_Edit.setObjectName(_fromUtf8("actionModel_Edit")) self.actionPreferences_2 = QtGui.QAction(MainWindow) self.actionPreferences_2.setIcon(icon26) self.actionPreferences_2.setText(QtGui.QApplication.translate("MainWindow", "Print Job Settings", None, QtGui.QApplication.UnicodeUTF8)) self.actionPreferences_2.setObjectName(_fromUtf8("actionPreferences_2")) self.actionPreSlice = QtGui.QAction(MainWindow) self.actionPreSlice.setCheckable(True) icon37 = QtGui.QIcon() icon37.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Objects.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionPreSlice.setIcon(icon37) self.actionPreSlice.setText(QtGui.QApplication.translate("MainWindow", "Pre-slicing", None, QtGui.QApplication.UnicodeUTF8)) self.actionPreSlice.setObjectName(_fromUtf8("actionPreSlice")) self.actionPostSlice = QtGui.QAction(MainWindow) self.actionPostSlice.setCheckable(True) self.actionPostSlice.setIcon(icon35) self.actionPostSlice.setText(QtGui.QApplication.translate("MainWindow", "Post-slicing", None, QtGui.QApplication.UnicodeUTF8)) self.actionPostSlice.setObjectName(_fromUtf8("actionPostSlice")) self.actionSlice = QtGui.QAction(MainWindow) self.actionSlice.setIcon(icon8) self.actionSlice.setText(QtGui.QApplication.translate("MainWindow", "Slice", None, QtGui.QApplication.UnicodeUTF8)) self.actionSlice.setToolTip(QtGui.QApplication.translate("MainWindow", "Slice Model", None, QtGui.QApplication.UnicodeUTF8)) self.actionSlice.setObjectName(_fromUtf8("actionSlice")) self.actionAdd_Model = QtGui.QAction(MainWindow) self.actionAdd_Model.setIcon(icon33) self.actionAdd_Model.setText(QtGui.QApplication.translate("MainWindow", "Add Model", None, QtGui.QApplication.UnicodeUTF8)) self.actionAdd_Model.setObjectName(_fromUtf8("actionAdd_Model")) self.actionRemove_Model = QtGui.QAction(MainWindow) icon38 = QtGui.QIcon() icon38.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Delete.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionRemove_Model.setIcon(icon38) self.actionRemove_Model.setText(QtGui.QApplication.translate("MainWindow", "Remove Model", None, QtGui.QApplication.UnicodeUTF8)) self.actionRemove_Model.setObjectName(_fromUtf8("actionRemove_Model")) self.actionConcatenate_STL_Files = QtGui.QAction(MainWindow) icon39 = QtGui.QIcon() icon39.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Constructor.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionConcatenate_STL_Files.setIcon(icon39) self.actionConcatenate_STL_Files.setText(QtGui.QApplication.translate("MainWindow", "Concatenate STL Files", None, QtGui.QApplication.UnicodeUTF8)) self.actionConcatenate_STL_Files.setObjectName(_fromUtf8("actionConcatenate_STL_Files")) self.actionCreate_New_Hardware_Profile = QtGui.QAction(MainWindow) icon40 = QtGui.QIcon() icon40.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/3d-printer settings.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionCreate_New_Hardware_Profile.setIcon(icon40) self.actionCreate_New_Hardware_Profile.setText(QtGui.QApplication.translate("MainWindow", "Create New Hardware Profile", None, QtGui.QApplication.UnicodeUTF8)) self.actionCreate_New_Hardware_Profile.setObjectName(_fromUtf8("actionCreate_New_Hardware_Profile")) self.action3DLP_Host_Settings = QtGui.QAction(MainWindow) self.action3DLP_Host_Settings.setIcon(icon34) self.action3DLP_Host_Settings.setText(QtGui.QApplication.translate("MainWindow", "3DLP Host Settings", None, QtGui.QApplication.UnicodeUTF8)) self.action3DLP_Host_Settings.setObjectName(_fromUtf8("action3DLP_Host_Settings")) self.actionPrint_Job_Settings = QtGui.QAction(MainWindow) self.actionPrint_Job_Settings.setIcon(icon29) self.actionPrint_Job_Settings.setText(QtGui.QApplication.translate("MainWindow", "Print Job Settings", None, QtGui.QApplication.UnicodeUTF8)) self.actionPrint_Job_Settings.setObjectName(_fromUtf8("actionPrint_Job_Settings")) self.actionCreate_New_Resin_Profile = QtGui.QAction(MainWindow) icon41 = QtGui.QIcon() icon41.addPixmap(QtGui.QPixmap(_fromUtf8(":/_icons/icons/printer/Flask.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionCreate_New_Resin_Profile.setIcon(icon41) self.actionCreate_New_Resin_Profile.setText(QtGui.QApplication.translate("MainWindow", "Create New Resin Profile", None, QtGui.QApplication.UnicodeUTF8)) self.actionCreate_New_Resin_Profile.setObjectName(_fromUtf8("actionCreate_New_Resin_Profile")) self.menuAbout.addAction(self.actionAbout) self.menuAbout.addAction(self.actionHelp) self.menuTools.addAction(self.actionConnect_To_Printer_2) self.menuTools.addAction(self.actionOpen_manual_printer_control) self.menuTools.addAction(self.actionSlice) self.menuTools.addAction(self.actionConcatenate_STL_Files) self.menuTools.addAction(self.actionFirmware_Configurator) self.menuTools.addAction(self.actionSave_current_settings_as_default) self.menuTools.addAction(self.actionCreate_New_Hardware_Profile) self.menuTools.addAction(self.actionCreate_New_Resin_Profile) self.menuFile.addAction(self.actionNew) self.menuFile.addAction(self.actionOpen) self.menuFile.addAction(self.actionSave) self.menuFile.addAction(self.actionSave_As) self.menuFile.addSeparator() self.menuFile.addAction(self.actionPrint) self.menuFile.addSeparator() self.menuFile.addAction(self.actionQuit) self.menuWindow.addAction(self.actionToolbar) self.menuWindow.addAction(self.actionModel_View) self.menuWindow.addAction(self.actionModel_Edit) self.menuWindow.addAction(self.actionSlice_Inspector) self.menuEdit.addSeparator() self.menuEdit.addAction(self.actionAdd_Model) self.menuEdit.addAction(self.actionRemove_Model) self.menuEdit.addAction(self.actionPrint_Job_Settings) self.menuShow_Workspace.addAction(self.actionPreSlice) self.menuShow_Workspace.addAction(self.actionPostSlice) self.menuWindow_2.addAction(self.menuShow_Workspace.menuAction()) self.menuWindow_2.addAction(self.action3DLP_Host_Settings) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuEdit.menuAction()) self.menubar.addAction(self.menuTools.menuAction()) self.menubar.addAction(self.menuWindow.menuAction()) self.menubar.addAction(self.menuWindow_2.menuAction()) self.menubar.addAction(self.menuAbout.menuAction()) self.toolBar.addAction(self.actionOpen) self.toolBar.addAction(self.actionConnect_To_Printer_2) self.toolBar.addAction(self.actionOpen_manual_printer_control) self.toolBar.addAction(self.actionSet_Model_Opacity) self.toolBar.addAction(self.actionPreferences) self.toolBar_3.addAction(self.actionPreSlice) self.toolBar_3.addAction(self.actionPostSlice) self.toolBar_3.addSeparator() self.toolBar_3.addAction(self.actionSlice) self.toolBar_3.addAction(self.actionConcatenate_STL_Files) self.toolBar_3.addSeparator() self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QtCore.QObject.connect(self.actionQuit, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.close) QtCore.QObject.connect(self.actionOpen, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.OpenPrintJob) QtCore.QObject.connect(self.actionAbout, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.openaboutdialog) QtCore.QObject.connect(self.actionHelp, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.openhelp) QtCore.QObject.connect(self.actionNext_Slice, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.IncrementSlicingPlanePositive) QtCore.QObject.connect(self.actionPrevious_Slice, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.IncrementSlicingPlaneNegative) QtCore.QObject.connect(self.actionSet_Model_Opacity, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.UpdateModelOpacityPre) QtCore.QObject.connect(self.actionPreferences, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.OpenSettingsDialog) QtCore.QObject.connect(self.actionGo_To_Layer, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.GoToLayer) QtCore.QObject.connect(self.actionOpen_manual_printer_control, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.openmanualcontrol) QtCore.QObject.connect(self.actionConnect_To_Printer_2, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.ConnectToPrinter) QtCore.QObject.connect(self.actionFirst_Slice, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.GoToFirstLayer) QtCore.QObject.connect(self.actionLast_Slice, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.GoToLastLayer) QtCore.QObject.connect(self.actionPostSlice, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.ChangeWorkspacePostSlice) QtCore.QObject.connect(self.actionPreSlice, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.ChangeWorkspacePreSlice) QtCore.QObject.connect(self.addModel, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.AddModel) QtCore.QObject.connect(self.modelList, QtCore.SIGNAL(_fromUtf8("currentItemChanged(QListWidgetItem*,QListWidgetItem*)")), MainWindow.ModelIndexChanged) QtCore.QObject.connect(self.scale, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.UpdateScale) QtCore.QObject.connect(self.rotationZ, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.UpdateRotationZ) QtCore.QObject.connect(self.rotationY, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.UpdateRotationY) QtCore.QObject.connect(self.rotationX, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.UpdateRotationX) QtCore.QObject.connect(self.positionX, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.UpdatePositionX) QtCore.QObject.connect(self.positionY, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.UpdatePositionY) QtCore.QObject.connect(self.positionZ, QtCore.SIGNAL(_fromUtf8("valueChanged(QString)")), MainWindow.UpdatePositionZ) QtCore.QObject.connect(self.actionSlice, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.SliceModel) QtCore.QObject.connect(self.toolButton_4, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.GoToFirstLayer) QtCore.QObject.connect(self.toolButton_6, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.GoToLastLayer) QtCore.QObject.connect(self.toolButton_3, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.IncrementSlicingPlaneNegative) QtCore.QObject.connect(self.toolButton, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.IncrementSlicingPlanePositive) QtCore.QObject.connect(self.actionSave_As, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.SavePrintJobAs) QtCore.QObject.connect(self.actionSave, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.SavePrintJob) QtCore.QObject.connect(self.actionConcatenate_STL_Files, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.ConcatenateSTLs) QtCore.QObject.connect(self.actionNew, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.NewPrintJob) QtCore.QObject.connect(self.actionCreate_New_Hardware_Profile, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.CreateNewHardwareProfile) QtCore.QObject.connect(self.actionPrint_Job_Settings, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.OpenPrintJobSettings) QtCore.QObject.connect(self.actionCreate_New_Resin_Profile, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.CreateNewResinProfile) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "Slice List", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("MainWindow", "Current Slice", None, QtGui.QApplication.UnicodeUTF8)) import resource_rc
Python
# -*- coding: utf-8 -*- """ Created on Wed Apr 11 13:35:14 2012 @author: Chris Marion - www.chrismarion.net """ from PyQt4 import QtCore, QtGui from PyQt4.Qt import * #class for slideshow window class SlideShowWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) def setupUi(self, QMainWindow): layout = QHBoxLayout() self.label = QLabel() self.label.setText("Image Preview") self.label.setAlignment(QtCore.Qt.AlignCenter) layout.addWidget(self.label) self.widget = QWidget() self.widget.setLayout(layout) self.setCentralWidget(self.widget) self.setWindowTitle("3DLP Slideshow") palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) self.setPalette(palette)
Python
# -*- coding: utf-8 -*- """ Created on Thu Apr 05 22:20:39 2012 @author: Chris Marion Copyright 2012-2013 www.chrismarion.net Still to add/known issues: -projector control functionality is not finished. -still looking for a good method of calibrating for X and Y (image size) -raise the bed to a final position after build is complete -Trapezoidal motion profiling of Z movement -custom firmware configurator and uploader -scripting commands for motor speed, GPIO (solenoids, etc), PWM control of gearmotors with encoder feedback, and pause -custom scripting for different sections of layers -ability to save custom hardware profiles for different printers """ import sys import comscan import webbrowser from ConfigParser import * import printmodel import vtk from settingsdialog import Ui_SettingsDialogBaseClass from manual_control_gui import Ui_Manual_Control from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor import hardware import cPickle as pickle from time import sleep import zipfile import StringIO import tempfile import shutil import slicer from newHardware import Ui_dialogHardware from newResin import Ui_dialogResin #********************************** import os from qtgui import Ui_MainWindow #import generated class from ui file from designer from aboutdialoggui import Ui_Dialog from PyQt4 import QtCore,QtGui from PyQt4.Qt import * try: from PyQt4.QtCore import QString except ImportError: QString = str try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): #defines all the mouse interactions for the render views def __init__(self,parent=None): self.AddObserver("MiddleButtonPressEvent",self.middleButtonPressEvent) self.AddObserver("MiddleButtonReleaseEvent",self.middleButtonReleaseEvent) def middleButtonPressEvent(self,obj,event): self.OnMiddleButtonDown() return def middleButtonReleaseEvent(self,obj,event): self.OnMiddleButtonUp() return class EmittingStream(QtCore.QObject): textWritten = QtCore.pyqtSignal(str) def write(self, text): self.textWritten.emit(str(text)) class StartSettingsDialog(QtGui.QDialog, Ui_SettingsDialogBaseClass): def __init__(self,parent=None): QtGui.QDialog.__init__(self,parent) self.setupUi(self) def ApplySettings(self): print "Applying Settings" self.emit(QtCore.SIGNAL('ApplySettings()')) self.reject() class StartManualControl(QtGui.QDialog, Ui_Manual_Control): def __init__(self, parent): QtGui.QDialog.__init__(self, None) self.printer = parent.printer self.setupUi(self) self.mm_per_step = float(parent.pitch)/float(parent.stepsPerRev) self.microstepping = 0.0625 #1/16th microstepping print self.microstepping self.mm_per_step = self.mm_per_step#/self.microstepping self.Zpos = 0.0 self.Xpos = 0.0 self.printer.EnableZ() def Z_up(self): if self.Z_01.isChecked(): #Z 0.1mm is checked self.Zpos = self.Zpos+.1 self.DRO_Z.display(float(self.DRO_Z.value())+.1) self.printer.IncrementZ(200) #print "incrementing %r steps"%(.1/self.mm_per_step) elif self.Z_1.isChecked(): #Z 1mm is checked self.Zpos = self.Zpos+1 self.DRO_Z.display(float(self.DRO_Z.value())+1) self.printer.IncrementZ(1/self.mm_per_step) #print "incrementing %r steps"%(1/self.mm_per_step) elif self.Z_10.isChecked(): #Z 10mm is checked self.Zpos = self.Zpos+10 self.DRO_Z.display(float(self.DRO_Z.value())+10) self.printer.IncrementZ((10/self.mm_per_step)) #print "incrementing %r steps"%(10/self.mm_per_step) def Z_down(self): if self.Z_01.isChecked(): #Z 0.1mm is checked self.Zpos = self.Zpos-.1 self.DRO_Z.display(float(self.DRO_Z.value())-.1) self.printer.IncrementZ(-.1/self.mm_per_step) #print "incrementing %r steps"%(-.1/self.mm_per_step) elif self.Z_1.isChecked(): #Z 1mm is checked self.Zpos = self.Zpos-1 self.DRO_Z.display(float(self.DRO_Z.value())-1) self.printer.IncrementZ(-1/self.mm_per_step) #print "incrementing %r steps"%(-1/self.mm_per_step) elif self.Z_10.isChecked(): #Z 10mm is checked self.Zpos = self.Zpos-10 self.DRO_Z.display(float(self.DRO_Z.value())-10) self.printer.IncrementZ(-10/self.mm_per_step) #print "incrementing %r steps"%(10/self.mm_per_step) def Zero_Z(self): self.Zpos = 0 self.DRO_Z.display(0) def activateX(self): pass class hardwareProfile(): def __init__(self): self.name = "" self.description = "" self.notes = "" self.controller = "" self.port = "" self.leadscrewPitchZ = 0.0 self.stepsPerRevZ = 0 self.steppingMode = "" self.layerThickness = "" self.projectorResolution = (0,0) self.buildAreaSize = (0,0) self.pixelSize = (0,0) class resinProfile(): def __init__(self): self.name = "" self.density = 0.0 self.cost = 0.0 self.curingEnergy = 0.0 class layerProfile(): def __init__(self): self.name = "" self.description = "" self.notes = "" self.numStartLayers = 0 self.exposureStart = 0.0 self.scriptStart = "" self.exposureNormal = 0.0 self.scriptNormal = "" class _3dlpfile(): def __init__(self): self.name = "" self.description = "" self.notes = "" self.hardwareProfile = None class model(): def __init__(self, parent, filename): self.parent = parent self.filename = filename self.transform = vtk.vtkTransform() self.CurrentXPosition = 0.0 self.CurrentYPosition = 0.0 self.CurrentZPosition = 0.0 self.CurrentXRotation = 0.0 self.CurrentYRotation = 0.0 self.CurrentZRotation = 0.0 self.CurrentScale = 0.0 self.load() def load(self): self.reader = vtk.vtkSTLReader() self.reader.SetFileName(str(self.filename)) self.mapper = vtk.vtkPolyDataMapper() self.mapper.SetInputConnection(self.reader.GetOutputPort()) #create model actor self.actor = vtk.vtkActor() self.actor.GetProperty().SetColor(1,1,1) self.actor.GetProperty().SetOpacity(1) self.actor.SetMapper(self.mapper) #create outline mapper self.outline = vtk.vtkOutlineFilter() self.outline.SetInputConnection(self.reader.GetOutputPort()) self.outlineMapper = vtk.vtkPolyDataMapper() self.outlineMapper.SetInputConnection(self.outline.GetOutputPort()) #create outline actor self.outlineActor = vtk.vtkActor() self.outlineActor.SetMapper(self.outlineMapper) #add actors to parent render window self.parent.renPre.AddActor(self.actor) self.parent.renPre.AddActor(self.outlineActor) class PrintJobSettingsDialog(QtGui.QDialog): def __init__(self, parent): super(PrintJobSettingsDialog, self).__init__(parent) self.parent = parent self.setWindowTitle("Print Job Configuration") self.verticalLayout_12 = QtGui.QVBoxLayout(self) self.verticalLayout_12.setObjectName(_fromUtf8("verticalLayout_12")) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_5.addItem(spacerItem) self.label_28 = QtGui.QLabel(self) font = QtGui.QFont() font.setPointSize(14) self.label_28.setFont(font) self.label_28.setText(QtGui.QApplication.translate("Dialog", "Print Job Settings", None, QtGui.QApplication.UnicodeUTF8)) self.label_28.setObjectName(_fromUtf8("label_28")) self.horizontalLayout_5.addWidget(self.label_28) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_5.addItem(spacerItem1) self.verticalLayout_12.addLayout(self.horizontalLayout_5) self.verticalLayout_11 = QtGui.QVBoxLayout() self.verticalLayout_11.setObjectName(_fromUtf8("verticalLayout_11")) self.tabWidget = QtGui.QTabWidget(self) self.tabWidget.setObjectName(_fromUtf8("tabWidget")) self.tab = QtGui.QWidget() self.tab.setObjectName(_fromUtf8("tab")) self.verticalLayout_15 = QtGui.QVBoxLayout(self.tab) self.verticalLayout_15.setObjectName(_fromUtf8("verticalLayout_15")) self.horizontalLayout_15 = QtGui.QHBoxLayout() self.horizontalLayout_15.setObjectName(_fromUtf8("horizontalLayout_15")) self.groupBox_2 = QtGui.QGroupBox(self.tab) self.groupBox_2.setTitle(QtGui.QApplication.translate("Dialog", "General Information", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) self.verticalLayout_6 = QtGui.QVBoxLayout(self.groupBox_2) self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.verticalLayout_4 = QtGui.QVBoxLayout() self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.label = QtGui.QLabel(self.groupBox_2) self.label.setText(QtGui.QApplication.translate("Dialog", "Job Name:", None, QtGui.QApplication.UnicodeUTF8)) self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout.addWidget(self.label) self.jobName = QtGui.QLineEdit(self.groupBox_2) self.jobName.setMinimumSize(QtCore.QSize(300, 0)) self.jobName.setObjectName(_fromUtf8("jobName")) self.horizontalLayout.addWidget(self.jobName) self.verticalLayout_4.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.label_2 = QtGui.QLabel(self.groupBox_2) self.label_2.setText(QtGui.QApplication.translate("Dialog", "Description:", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setObjectName(_fromUtf8("label_2")) self.horizontalLayout_2.addWidget(self.label_2) self.jobDescription = QtGui.QLineEdit(self.groupBox_2) self.jobDescription.setObjectName(_fromUtf8("jobDescription")) self.horizontalLayout_2.addWidget(self.jobDescription) self.verticalLayout_4.addLayout(self.horizontalLayout_2) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.label_4 = QtGui.QLabel(self.groupBox_2) self.label_4.setText(QtGui.QApplication.translate("Dialog", "Notes:", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setObjectName(_fromUtf8("label_4")) self.horizontalLayout_4.addWidget(self.label_4) self.jobNotes = QtGui.QTextEdit(self.groupBox_2) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.jobNotes.sizePolicy().hasHeightForWidth()) self.jobNotes.setSizePolicy(sizePolicy) self.jobNotes.setObjectName(_fromUtf8("jobNotes")) self.horizontalLayout_4.addWidget(self.jobNotes) self.verticalLayout_4.addLayout(self.horizontalLayout_4) self.verticalLayout_6.addLayout(self.verticalLayout_4) self.horizontalLayout_15.addWidget(self.groupBox_2) self.verticalLayout_13 = QtGui.QVBoxLayout() self.verticalLayout_13.setObjectName(_fromUtf8("verticalLayout_13")) self.groupBox_4 = QtGui.QGroupBox(self.tab) self.groupBox_4.setTitle(QtGui.QApplication.translate("Dialog", "Resin Profile", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_4.setObjectName(_fromUtf8("groupBox_4")) self.verticalLayout_10 = QtGui.QVBoxLayout(self.groupBox_4) self.verticalLayout_10.setObjectName(_fromUtf8("verticalLayout_10")) self.verticalLayout_9 = QtGui.QVBoxLayout() self.verticalLayout_9.setObjectName(_fromUtf8("verticalLayout_9")) self.horizontalLayout_14 = QtGui.QHBoxLayout() self.horizontalLayout_14.setObjectName(_fromUtf8("horizontalLayout_14")) self.label_24 = QtGui.QLabel(self.groupBox_4) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_24.sizePolicy().hasHeightForWidth()) self.label_24.setSizePolicy(sizePolicy) self.label_24.setText(QtGui.QApplication.translate("Dialog", "Load an existing resin profile:", None, QtGui.QApplication.UnicodeUTF8)) self.label_24.setObjectName(_fromUtf8("label_24")) self.horizontalLayout_14.addWidget(self.label_24) self.pickresin = QtGui.QComboBox(self.groupBox_4) self.pickresin.setObjectName(_fromUtf8("pickresin")) self.horizontalLayout_14.addWidget(self.pickresin) self.toolButton_2 = QtGui.QToolButton(self.groupBox_4) self.toolButton_2.setText(QtGui.QApplication.translate("Dialog", "Create New Profile", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton_2.setObjectName(_fromUtf8("toolButton_2")) self.horizontalLayout_14.addWidget(self.toolButton_2) self.verticalLayout_9.addLayout(self.horizontalLayout_14) self.line_3 = QtGui.QFrame(self.groupBox_4) self.line_3.setFrameShape(QtGui.QFrame.HLine) self.line_3.setFrameShadow(QtGui.QFrame.Sunken) self.line_3.setObjectName(_fromUtf8("line_3")) self.verticalLayout_9.addWidget(self.line_3) self.groupBox_5 = QtGui.QGroupBox(self.groupBox_4) self.groupBox_5.setTitle(QtGui.QApplication.translate("Dialog", "Selected Resin Profile", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_5.setObjectName(_fromUtf8("groupBox_5")) self.verticalLayout_8 = QtGui.QVBoxLayout(self.groupBox_5) self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) self.verticalLayout_7 = QtGui.QVBoxLayout() self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7")) self.horizontalLayout_7 = QtGui.QHBoxLayout() self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7")) self.label_18 = QtGui.QLabel(self.groupBox_5) self.label_18.setText(QtGui.QApplication.translate("Dialog", "Name:", None, QtGui.QApplication.UnicodeUTF8)) self.label_18.setObjectName(_fromUtf8("label_18")) self.horizontalLayout_7.addWidget(self.label_18) self.resinName = QtGui.QLabel(self.groupBox_5) self.resinName.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.resinName.setObjectName(_fromUtf8("resinName")) self.horizontalLayout_7.addWidget(self.resinName) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_7.addItem(spacerItem2) self.verticalLayout_7.addLayout(self.horizontalLayout_7) self.horizontalLayout_8 = QtGui.QHBoxLayout() self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8")) self.label_19 = QtGui.QLabel(self.groupBox_5) self.label_19.setText(QtGui.QApplication.translate("Dialog", "Density:", None, QtGui.QApplication.UnicodeUTF8)) self.label_19.setObjectName(_fromUtf8("label_19")) self.horizontalLayout_8.addWidget(self.label_19) self.density = QtGui.QLabel(self.groupBox_5) self.density.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.density.setObjectName(_fromUtf8("density")) self.horizontalLayout_8.addWidget(self.density) self.label_21 = QtGui.QLabel(self.groupBox_5) self.label_21.setText(QtGui.QApplication.translate("Dialog", "g/mL", None, QtGui.QApplication.UnicodeUTF8)) self.label_21.setObjectName(_fromUtf8("label_21")) self.horizontalLayout_8.addWidget(self.label_21) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem3) self.verticalLayout_7.addLayout(self.horizontalLayout_8) self.horizontalLayout_13 = QtGui.QHBoxLayout() self.horizontalLayout_13.setObjectName(_fromUtf8("horizontalLayout_13")) self.label_20 = QtGui.QLabel(self.groupBox_5) self.label_20.setText(QtGui.QApplication.translate("Dialog", "Cost:", None, QtGui.QApplication.UnicodeUTF8)) self.label_20.setObjectName(_fromUtf8("label_20")) self.horizontalLayout_13.addWidget(self.label_20) self.cost = QtGui.QLabel(self.groupBox_5) self.cost.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.cost.setObjectName(_fromUtf8("cost")) self.horizontalLayout_13.addWidget(self.cost) self.label_22 = QtGui.QLabel(self.groupBox_5) self.label_22.setText(QtGui.QApplication.translate("Dialog", "$/L", None, QtGui.QApplication.UnicodeUTF8)) self.label_22.setObjectName(_fromUtf8("label_22")) self.horizontalLayout_13.addWidget(self.label_22) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_13.addItem(spacerItem4) self.verticalLayout_7.addLayout(self.horizontalLayout_13) self.horizontalLayout_29 = QtGui.QHBoxLayout() self.horizontalLayout_29.setObjectName(_fromUtf8("horizontalLayout_29")) self.label_23 = QtGui.QLabel(self.groupBox_5) self.label_23.setText(QtGui.QApplication.translate("Dialog", "Curing Energy:", None, QtGui.QApplication.UnicodeUTF8)) self.label_23.setObjectName(_fromUtf8("label_23")) self.horizontalLayout_29.addWidget(self.label_23) self.curingEnergy = QtGui.QLabel(self.groupBox_5) self.curingEnergy.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.curingEnergy.setObjectName(_fromUtf8("curingEnergy")) self.horizontalLayout_29.addWidget(self.curingEnergy) self.label_36 = QtGui.QLabel(self.groupBox_5) self.label_36.setText(QtGui.QApplication.translate("Dialog", "W/cm^2", None, QtGui.QApplication.UnicodeUTF8)) self.label_36.setObjectName(_fromUtf8("label_36")) self.horizontalLayout_29.addWidget(self.label_36) spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_29.addItem(spacerItem5) self.verticalLayout_7.addLayout(self.horizontalLayout_29) self.verticalLayout_8.addLayout(self.verticalLayout_7) self.verticalLayout_9.addWidget(self.groupBox_5) self.verticalLayout_10.addLayout(self.verticalLayout_9) self.verticalLayout_13.addWidget(self.groupBox_4) spacerItem6 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_13.addItem(spacerItem6) self.horizontalLayout_15.addLayout(self.verticalLayout_13) self.verticalLayout_15.addLayout(self.horizontalLayout_15) spacerItem7 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_15.addItem(spacerItem7) self.tabWidget.addTab(self.tab, _fromUtf8("")) self.tab_2 = QtGui.QWidget() self.tab_2.setObjectName(_fromUtf8("tab_2")) self.verticalLayout_3 = QtGui.QVBoxLayout(self.tab_2) self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.horizontalLayout_6 = QtGui.QHBoxLayout() self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6")) self.label_5 = QtGui.QLabel(self.tab_2) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) self.label_5.setSizePolicy(sizePolicy) self.label_5.setText(QtGui.QApplication.translate("Dialog", "Load an existing hardware profile:", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setObjectName(_fromUtf8("label_5")) self.horizontalLayout_6.addWidget(self.label_5) self.pickhardwareprofile = QtGui.QComboBox(self.tab_2) self.pickhardwareprofile.setObjectName(_fromUtf8("pickhardwareprofile")) self.horizontalLayout_6.addWidget(self.pickhardwareprofile) self.toolButton = QtGui.QToolButton(self.tab_2) self.toolButton.setText(QtGui.QApplication.translate("Dialog", "Create New Profile", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton.setObjectName(_fromUtf8("toolButton")) self.horizontalLayout_6.addWidget(self.toolButton) self.verticalLayout.addLayout(self.horizontalLayout_6) self.line = QtGui.QFrame(self.tab_2) self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName(_fromUtf8("line")) self.verticalLayout.addWidget(self.line) self.groupBox_3 = QtGui.QGroupBox(self.tab_2) self.groupBox_3.setTitle(QtGui.QApplication.translate("Dialog", "Selected Hardware Profile", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_3.setObjectName(_fromUtf8("groupBox_3")) self.verticalLayout_17 = QtGui.QVBoxLayout(self.groupBox_3) self.verticalLayout_17.setObjectName(_fromUtf8("verticalLayout_17")) self.horizontalLayout_25 = QtGui.QHBoxLayout() self.horizontalLayout_25.setObjectName(_fromUtf8("horizontalLayout_25")) self.label_47 = QtGui.QLabel(self.groupBox_3) self.label_47.setText(QtGui.QApplication.translate("Dialog", "Profile Name:", None, QtGui.QApplication.UnicodeUTF8)) self.label_47.setObjectName(_fromUtf8("label_47")) self.horizontalLayout_25.addWidget(self.label_47) self.name = QtGui.QLabel(self.groupBox_3) self.name.setText(QtGui.QApplication.translate("Dialog", "Name", None, QtGui.QApplication.UnicodeUTF8)) self.name.setObjectName(_fromUtf8("name")) self.horizontalLayout_25.addWidget(self.name) spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_25.addItem(spacerItem8) self.verticalLayout_17.addLayout(self.horizontalLayout_25) self.horizontalLayout_26 = QtGui.QHBoxLayout() self.horizontalLayout_26.setObjectName(_fromUtf8("horizontalLayout_26")) self.label_49 = QtGui.QLabel(self.groupBox_3) self.label_49.setText(QtGui.QApplication.translate("Dialog", "Profile Description:", None, QtGui.QApplication.UnicodeUTF8)) self.label_49.setObjectName(_fromUtf8("label_49")) self.horizontalLayout_26.addWidget(self.label_49) self.description = QtGui.QLabel(self.groupBox_3) self.description.setText(QtGui.QApplication.translate("Dialog", "Description", None, QtGui.QApplication.UnicodeUTF8)) self.description.setObjectName(_fromUtf8("description")) self.horizontalLayout_26.addWidget(self.description) spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_26.addItem(spacerItem9) self.verticalLayout_17.addLayout(self.horizontalLayout_26) self.horizontalLayout_27 = QtGui.QHBoxLayout() self.horizontalLayout_27.setObjectName(_fromUtf8("horizontalLayout_27")) self.label_50 = QtGui.QLabel(self.groupBox_3) self.label_50.setText(QtGui.QApplication.translate("Dialog", "Profile Notes:", None, QtGui.QApplication.UnicodeUTF8)) self.label_50.setObjectName(_fromUtf8("label_50")) self.horizontalLayout_27.addWidget(self.label_50) self.notes = QtGui.QLabel(self.groupBox_3) self.notes.setText(QtGui.QApplication.translate("Dialog", "Notes", None, QtGui.QApplication.UnicodeUTF8)) self.notes.setWordWrap(True) self.notes.setObjectName(_fromUtf8("notes")) self.horizontalLayout_27.addWidget(self.notes) spacerItem10 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_27.addItem(spacerItem10) self.verticalLayout_17.addLayout(self.horizontalLayout_27) self.line_2 = QtGui.QFrame(self.groupBox_3) self.line_2.setFrameShape(QtGui.QFrame.HLine) self.line_2.setFrameShadow(QtGui.QFrame.Sunken) self.line_2.setObjectName(_fromUtf8("line_2")) self.verticalLayout_17.addWidget(self.line_2) self.verticalLayout_16 = QtGui.QVBoxLayout() self.verticalLayout_16.setObjectName(_fromUtf8("verticalLayout_16")) self.horizontalLayout_31 = QtGui.QHBoxLayout() self.horizontalLayout_31.setObjectName(_fromUtf8("horizontalLayout_31")) self.groupBox_10 = QtGui.QGroupBox(self.groupBox_3) self.groupBox_10.setTitle(QtGui.QApplication.translate("Dialog", "Controller Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_10.setObjectName(_fromUtf8("groupBox_10")) self.verticalLayout_14 = QtGui.QVBoxLayout(self.groupBox_10) self.verticalLayout_14.setObjectName(_fromUtf8("verticalLayout_14")) self.verticalLayout_5 = QtGui.QVBoxLayout() self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.horizontalLayout_24 = QtGui.QHBoxLayout() self.horizontalLayout_24.setObjectName(_fromUtf8("horizontalLayout_24")) self.label_46 = QtGui.QLabel(self.groupBox_10) self.label_46.setText(QtGui.QApplication.translate("Dialog", "Controller Type:", None, QtGui.QApplication.UnicodeUTF8)) self.label_46.setObjectName(_fromUtf8("label_46")) self.horizontalLayout_24.addWidget(self.label_46) self.controller = QtGui.QLabel(self.groupBox_10) self.controller.setText(QtGui.QApplication.translate("Dialog", "RAMPS", None, QtGui.QApplication.UnicodeUTF8)) self.controller.setObjectName(_fromUtf8("controller")) self.horizontalLayout_24.addWidget(self.controller) self.verticalLayout_5.addLayout(self.horizontalLayout_24) self.horizontalLayout_30 = QtGui.QHBoxLayout() self.horizontalLayout_30.setObjectName(_fromUtf8("horizontalLayout_30")) self.label_48 = QtGui.QLabel(self.groupBox_10) self.label_48.setText(QtGui.QApplication.translate("Dialog", "COM Port:", None, QtGui.QApplication.UnicodeUTF8)) self.label_48.setObjectName(_fromUtf8("label_48")) self.horizontalLayout_30.addWidget(self.label_48) self.port = QtGui.QLabel(self.groupBox_10) self.port.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.port.setObjectName(_fromUtf8("port")) self.horizontalLayout_30.addWidget(self.port) self.verticalLayout_5.addLayout(self.horizontalLayout_30) self.verticalLayout_14.addLayout(self.verticalLayout_5) self.horizontalLayout_31.addWidget(self.groupBox_10) spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_31.addItem(spacerItem11) self.verticalLayout_16.addLayout(self.horizontalLayout_31) self.groupBox_7 = QtGui.QGroupBox(self.groupBox_3) self.groupBox_7.setTitle(QtGui.QApplication.translate("Dialog", "Hardware Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_7.setObjectName(_fromUtf8("groupBox_7")) self.horizontalLayout_3 = QtGui.QHBoxLayout(self.groupBox_7) self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.horizontalLayout_22 = QtGui.QHBoxLayout() self.horizontalLayout_22.setObjectName(_fromUtf8("horizontalLayout_22")) self.label_6 = QtGui.QLabel(self.groupBox_7) self.label_6.setText(QtGui.QApplication.translate("Dialog", "Z Axis Leadscrew Pitch:", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setObjectName(_fromUtf8("label_6")) self.horizontalLayout_22.addWidget(self.label_6) self.pitchZ = QtGui.QLabel(self.groupBox_7) self.pitchZ.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.pitchZ.setObjectName(_fromUtf8("pitchZ")) self.horizontalLayout_22.addWidget(self.pitchZ) self.label_7 = QtGui.QLabel(self.groupBox_7) self.label_7.setText(QtGui.QApplication.translate("Dialog", "mm/rev", None, QtGui.QApplication.UnicodeUTF8)) self.label_7.setObjectName(_fromUtf8("label_7")) self.horizontalLayout_22.addWidget(self.label_7) spacerItem12 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_22.addItem(spacerItem12) self.verticalLayout_2.addLayout(self.horizontalLayout_22) self.horizontalLayout_23 = QtGui.QHBoxLayout() self.horizontalLayout_23.setObjectName(_fromUtf8("horizontalLayout_23")) self.label_8 = QtGui.QLabel(self.groupBox_7) self.label_8.setText(QtGui.QApplication.translate("Dialog", "Z Axis Steps/rev:", None, QtGui.QApplication.UnicodeUTF8)) self.label_8.setObjectName(_fromUtf8("label_8")) self.horizontalLayout_23.addWidget(self.label_8) self.stepsPerRevZ = QtGui.QLabel(self.groupBox_7) self.stepsPerRevZ.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.stepsPerRevZ.setObjectName(_fromUtf8("stepsPerRevZ")) self.horizontalLayout_23.addWidget(self.stepsPerRevZ) self.label_9 = QtGui.QLabel(self.groupBox_7) self.label_9.setText(QtGui.QApplication.translate("Dialog", "steps", None, QtGui.QApplication.UnicodeUTF8)) self.label_9.setObjectName(_fromUtf8("label_9")) self.horizontalLayout_23.addWidget(self.label_9) spacerItem13 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_23.addItem(spacerItem13) self.verticalLayout_2.addLayout(self.horizontalLayout_23) self.horizontalLayout_34 = QtGui.QHBoxLayout() self.horizontalLayout_34.setObjectName(_fromUtf8("horizontalLayout_34")) self.label_53 = QtGui.QLabel(self.groupBox_7) self.label_53.setText(QtGui.QApplication.translate("Dialog", "Stepping Mode:", None, QtGui.QApplication.UnicodeUTF8)) self.label_53.setObjectName(_fromUtf8("label_53")) self.horizontalLayout_34.addWidget(self.label_53) self.steppingMode = QtGui.QLabel(self.groupBox_7) self.steppingMode.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.steppingMode.setObjectName(_fromUtf8("steppingMode")) self.horizontalLayout_34.addWidget(self.steppingMode) spacerItem14 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_34.addItem(spacerItem14) self.verticalLayout_2.addLayout(self.horizontalLayout_34) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) self.label_10 = QtGui.QLabel(self.groupBox_7) self.label_10.setText(QtGui.QApplication.translate("Dialog", "Layer Thickness:", None, QtGui.QApplication.UnicodeUTF8)) self.label_10.setObjectName(_fromUtf8("label_10")) self.horizontalLayout_9.addWidget(self.label_10) self.layerThickness = QtGui.QLabel(self.groupBox_7) self.layerThickness.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.layerThickness.setObjectName(_fromUtf8("layerThickness")) self.horizontalLayout_9.addWidget(self.layerThickness) self.label_13 = QtGui.QLabel(self.groupBox_7) self.label_13.setText(QtGui.QApplication.translate("Dialog", "um", None, QtGui.QApplication.UnicodeUTF8)) self.label_13.setObjectName(_fromUtf8("label_13")) self.horizontalLayout_9.addWidget(self.label_13) spacerItem15 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem15) self.verticalLayout_2.addLayout(self.horizontalLayout_9) self.horizontalLayout_10 = QtGui.QHBoxLayout() self.horizontalLayout_10.setObjectName(_fromUtf8("horizontalLayout_10")) self.label_11 = QtGui.QLabel(self.groupBox_7) self.label_11.setText(QtGui.QApplication.translate("Dialog", "Projector Resolution (pixels):", None, QtGui.QApplication.UnicodeUTF8)) self.label_11.setObjectName(_fromUtf8("label_11")) self.horizontalLayout_10.addWidget(self.label_11) self.resolutionX = QtGui.QLabel(self.groupBox_7) self.resolutionX.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.resolutionX.setObjectName(_fromUtf8("resolutionX")) self.horizontalLayout_10.addWidget(self.resolutionX) self.label_12 = QtGui.QLabel(self.groupBox_7) self.label_12.setText(QtGui.QApplication.translate("Dialog", "x", None, QtGui.QApplication.UnicodeUTF8)) self.label_12.setObjectName(_fromUtf8("label_12")) self.horizontalLayout_10.addWidget(self.label_12) self.resolutionY = QtGui.QLabel(self.groupBox_7) self.resolutionY.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.resolutionY.setObjectName(_fromUtf8("resolutionY")) self.horizontalLayout_10.addWidget(self.resolutionY) spacerItem16 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_10.addItem(spacerItem16) self.verticalLayout_2.addLayout(self.horizontalLayout_10) self.horizontalLayout_11 = QtGui.QHBoxLayout() self.horizontalLayout_11.setObjectName(_fromUtf8("horizontalLayout_11")) self.label_14 = QtGui.QLabel(self.groupBox_7) self.label_14.setText(QtGui.QApplication.translate("Dialog", "Build Area Size (mm):", None, QtGui.QApplication.UnicodeUTF8)) self.label_14.setObjectName(_fromUtf8("label_14")) self.horizontalLayout_11.addWidget(self.label_14) self.buildAreaX = QtGui.QLabel(self.groupBox_7) self.buildAreaX.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.buildAreaX.setObjectName(_fromUtf8("buildAreaX")) self.horizontalLayout_11.addWidget(self.buildAreaX) self.label_15 = QtGui.QLabel(self.groupBox_7) self.label_15.setText(QtGui.QApplication.translate("Dialog", "x", None, QtGui.QApplication.UnicodeUTF8)) self.label_15.setObjectName(_fromUtf8("label_15")) self.horizontalLayout_11.addWidget(self.label_15) self.buildAreaY = QtGui.QLabel(self.groupBox_7) self.buildAreaY.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.buildAreaY.setObjectName(_fromUtf8("buildAreaY")) self.horizontalLayout_11.addWidget(self.buildAreaY) spacerItem17 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_11.addItem(spacerItem17) self.verticalLayout_2.addLayout(self.horizontalLayout_11) self.horizontalLayout_12 = QtGui.QHBoxLayout() self.horizontalLayout_12.setObjectName(_fromUtf8("horizontalLayout_12")) self.label_16 = QtGui.QLabel(self.groupBox_7) self.label_16.setText(QtGui.QApplication.translate("Dialog", "Pixel Size (um):", None, QtGui.QApplication.UnicodeUTF8)) self.label_16.setObjectName(_fromUtf8("label_16")) self.horizontalLayout_12.addWidget(self.label_16) self.pixelSizeX = QtGui.QLabel(self.groupBox_7) self.pixelSizeX.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.pixelSizeX.setObjectName(_fromUtf8("pixelSizeX")) self.horizontalLayout_12.addWidget(self.pixelSizeX) self.label_17 = QtGui.QLabel(self.groupBox_7) self.label_17.setText(QtGui.QApplication.translate("Dialog", "x", None, QtGui.QApplication.UnicodeUTF8)) self.label_17.setObjectName(_fromUtf8("label_17")) self.horizontalLayout_12.addWidget(self.label_17) self.pixelSizeY = QtGui.QLabel(self.groupBox_7) self.pixelSizeY.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.pixelSizeY.setObjectName(_fromUtf8("pixelSizeY")) self.horizontalLayout_12.addWidget(self.pixelSizeY) spacerItem18 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_12.addItem(spacerItem18) self.verticalLayout_2.addLayout(self.horizontalLayout_12) self.horizontalLayout_3.addLayout(self.verticalLayout_2) self.verticalLayout_16.addWidget(self.groupBox_7) self.verticalLayout_17.addLayout(self.verticalLayout_16) self.verticalLayout.addWidget(self.groupBox_3) self.verticalLayout_3.addLayout(self.verticalLayout) spacerItem19 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_3.addItem(spacerItem19) self.tabWidget.addTab(self.tab_2, _fromUtf8("")) self.tab_3 = QtGui.QWidget() self.tab_3.setObjectName(_fromUtf8("tab_3")) self.verticalLayout_24 = QtGui.QVBoxLayout(self.tab_3) self.verticalLayout_24.setObjectName(_fromUtf8("verticalLayout_24")) self.verticalLayout_23 = QtGui.QVBoxLayout() self.verticalLayout_23.setObjectName(_fromUtf8("verticalLayout_23")) self.horizontalLayout_36 = QtGui.QHBoxLayout() self.horizontalLayout_36.setObjectName(_fromUtf8("horizontalLayout_36")) self.label_32 = QtGui.QLabel(self.tab_3) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_32.sizePolicy().hasHeightForWidth()) self.label_32.setSizePolicy(sizePolicy) self.label_32.setText(QtGui.QApplication.translate("Dialog", "Load an existing profile:", None, QtGui.QApplication.UnicodeUTF8)) self.label_32.setObjectName(_fromUtf8("label_32")) self.horizontalLayout_36.addWidget(self.label_32) self.picklayerprofile = QtGui.QComboBox(self.tab_3) self.picklayerprofile.setObjectName(_fromUtf8("picklayerprofile")) self.horizontalLayout_36.addWidget(self.picklayerprofile) self.toolButton_3 = QtGui.QToolButton(self.tab_3) self.toolButton_3.setText(QtGui.QApplication.translate("Dialog", "Create New Profile", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton_3.setObjectName(_fromUtf8("toolButton_3")) self.horizontalLayout_36.addWidget(self.toolButton_3) self.verticalLayout_23.addLayout(self.horizontalLayout_36) self.line_6 = QtGui.QFrame(self.tab_3) self.line_6.setFrameShape(QtGui.QFrame.HLine) self.line_6.setFrameShadow(QtGui.QFrame.Sunken) self.line_6.setObjectName(_fromUtf8("line_6")) self.verticalLayout_23.addWidget(self.line_6) self.groupBox_9 = QtGui.QGroupBox(self.tab_3) self.groupBox_9.setTitle(QtGui.QApplication.translate("Dialog", "Selected Profile", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_9.setObjectName(_fromUtf8("groupBox_9")) self.verticalLayout_22 = QtGui.QVBoxLayout(self.groupBox_9) self.verticalLayout_22.setObjectName(_fromUtf8("verticalLayout_22")) self.verticalLayout_21 = QtGui.QVBoxLayout() self.verticalLayout_21.setObjectName(_fromUtf8("verticalLayout_21")) self.horizontalLayout_37 = QtGui.QHBoxLayout() self.horizontalLayout_37.setObjectName(_fromUtf8("horizontalLayout_37")) self.label_51 = QtGui.QLabel(self.groupBox_9) self.label_51.setText(QtGui.QApplication.translate("Dialog", "Profile Name:", None, QtGui.QApplication.UnicodeUTF8)) self.label_51.setObjectName(_fromUtf8("label_51")) self.horizontalLayout_37.addWidget(self.label_51) self.layerProfileName = QtGui.QLabel(self.groupBox_9) self.layerProfileName.setText(QtGui.QApplication.translate("Dialog", "Name", None, QtGui.QApplication.UnicodeUTF8)) self.layerProfileName.setObjectName(_fromUtf8("layerProfileName")) self.horizontalLayout_37.addWidget(self.layerProfileName) spacerItem20 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_37.addItem(spacerItem20) self.verticalLayout_21.addLayout(self.horizontalLayout_37) self.horizontalLayout_38 = QtGui.QHBoxLayout() self.horizontalLayout_38.setObjectName(_fromUtf8("horizontalLayout_38")) self.label_52 = QtGui.QLabel(self.groupBox_9) self.label_52.setText(QtGui.QApplication.translate("Dialog", "Profile Description:", None, QtGui.QApplication.UnicodeUTF8)) self.label_52.setObjectName(_fromUtf8("label_52")) self.horizontalLayout_38.addWidget(self.label_52) self.layerProfileDescription = QtGui.QLabel(self.groupBox_9) self.layerProfileDescription.setText(QtGui.QApplication.translate("Dialog", "Description", None, QtGui.QApplication.UnicodeUTF8)) self.layerProfileDescription.setObjectName(_fromUtf8("layerProfileDescription")) self.horizontalLayout_38.addWidget(self.layerProfileDescription) spacerItem21 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_38.addItem(spacerItem21) self.verticalLayout_21.addLayout(self.horizontalLayout_38) self.horizontalLayout_39 = QtGui.QHBoxLayout() self.horizontalLayout_39.setObjectName(_fromUtf8("horizontalLayout_39")) self.label_54 = QtGui.QLabel(self.groupBox_9) self.label_54.setText(QtGui.QApplication.translate("Dialog", "Profile Notes:", None, QtGui.QApplication.UnicodeUTF8)) self.label_54.setObjectName(_fromUtf8("label_54")) self.horizontalLayout_39.addWidget(self.label_54) self.layerProfileNotes = QtGui.QLabel(self.groupBox_9) self.layerProfileNotes.setText(QtGui.QApplication.translate("Dialog", "Notes", None, QtGui.QApplication.UnicodeUTF8)) self.layerProfileNotes.setWordWrap(True) self.layerProfileNotes.setObjectName(_fromUtf8("layerProfileNotes")) self.horizontalLayout_39.addWidget(self.layerProfileNotes) spacerItem22 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_39.addItem(spacerItem22) self.verticalLayout_21.addLayout(self.horizontalLayout_39) self.line_7 = QtGui.QFrame(self.groupBox_9) self.line_7.setFrameShape(QtGui.QFrame.HLine) self.line_7.setFrameShadow(QtGui.QFrame.Sunken) self.line_7.setObjectName(_fromUtf8("line_7")) self.verticalLayout_21.addWidget(self.line_7) self.horizontalLayout_35 = QtGui.QHBoxLayout() self.horizontalLayout_35.setObjectName(_fromUtf8("horizontalLayout_35")) self.groupBox_6 = QtGui.QGroupBox(self.groupBox_9) self.groupBox_6.setTitle(QtGui.QApplication.translate("Dialog", "Layer Advance Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_6.setObjectName(_fromUtf8("groupBox_6")) self.horizontalLayout_16 = QtGui.QHBoxLayout(self.groupBox_6) self.horizontalLayout_16.setObjectName(_fromUtf8("horizontalLayout_16")) self.verticalLayout_18 = QtGui.QVBoxLayout() self.verticalLayout_18.setObjectName(_fromUtf8("verticalLayout_18")) self.horizontalLayout_17 = QtGui.QHBoxLayout() self.horizontalLayout_17.setObjectName(_fromUtf8("horizontalLayout_17")) spacerItem23 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_17.addItem(spacerItem23) self.horizontalLayout_18 = QtGui.QHBoxLayout() self.horizontalLayout_18.setObjectName(_fromUtf8("horizontalLayout_18")) self.label_26 = QtGui.QLabel(self.groupBox_6) self.label_26.setText(QtGui.QApplication.translate("Dialog", "Number of starting layers", None, QtGui.QApplication.UnicodeUTF8)) self.label_26.setObjectName(_fromUtf8("label_26")) self.horizontalLayout_18.addWidget(self.label_26) self.numStartLayers = QtGui.QLineEdit(self.groupBox_6) self.numStartLayers.setText(_fromUtf8("")) self.numStartLayers.setObjectName(_fromUtf8("numStartLayers")) self.horizontalLayout_18.addWidget(self.numStartLayers) self.horizontalLayout_17.addLayout(self.horizontalLayout_18) spacerItem24 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_17.addItem(spacerItem24) self.verticalLayout_18.addLayout(self.horizontalLayout_17) self.line_4 = QtGui.QFrame(self.groupBox_6) self.line_4.setFrameShape(QtGui.QFrame.HLine) self.line_4.setFrameShadow(QtGui.QFrame.Sunken) self.line_4.setObjectName(_fromUtf8("line_4")) self.verticalLayout_18.addWidget(self.line_4) self.horizontalLayout_19 = QtGui.QHBoxLayout() self.horizontalLayout_19.setObjectName(_fromUtf8("horizontalLayout_19")) self.verticalLayout_19 = QtGui.QVBoxLayout() self.verticalLayout_19.setObjectName(_fromUtf8("verticalLayout_19")) self.label_3 = QtGui.QLabel(self.groupBox_6) font = QtGui.QFont() font.setPointSize(10) font.setBold(False) font.setWeight(50) self.label_3.setFont(font) self.label_3.setText(QtGui.QApplication.translate("Dialog", "Starting Layers", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setAlignment(QtCore.Qt.AlignCenter) self.label_3.setObjectName(_fromUtf8("label_3")) self.verticalLayout_19.addWidget(self.label_3) self.horizontalLayout_20 = QtGui.QHBoxLayout() self.horizontalLayout_20.setObjectName(_fromUtf8("horizontalLayout_20")) self.label_27 = QtGui.QLabel(self.groupBox_6) self.label_27.setText(QtGui.QApplication.translate("Dialog", "Starting layer exposure ", None, QtGui.QApplication.UnicodeUTF8)) self.label_27.setObjectName(_fromUtf8("label_27")) self.horizontalLayout_20.addWidget(self.label_27) self.exposureStart = QtGui.QLineEdit(self.groupBox_6) self.exposureStart.setText(_fromUtf8("")) self.exposureStart.setObjectName(_fromUtf8("exposureStart")) self.horizontalLayout_20.addWidget(self.exposureStart) self.label_30 = QtGui.QLabel(self.groupBox_6) self.label_30.setText(QtGui.QApplication.translate("Dialog", "s", None, QtGui.QApplication.UnicodeUTF8)) self.label_30.setObjectName(_fromUtf8("label_30")) self.horizontalLayout_20.addWidget(self.label_30) self.verticalLayout_19.addLayout(self.horizontalLayout_20) self.groupBox_8 = QtGui.QGroupBox(self.groupBox_6) self.groupBox_8.setMinimumSize(QtCore.QSize(0, 80)) self.groupBox_8.setTitle(QtGui.QApplication.translate("Dialog", "Inter-layer scripting", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_8.setObjectName(_fromUtf8("groupBox_8")) self.horizontalLayout_21 = QtGui.QHBoxLayout(self.groupBox_8) self.horizontalLayout_21.setObjectName(_fromUtf8("horizontalLayout_21")) self.scriptStart = QtGui.QPlainTextEdit(self.groupBox_8) self.scriptStart.setObjectName(_fromUtf8("scriptStart")) self.horizontalLayout_21.addWidget(self.scriptStart) self.verticalLayout_19.addWidget(self.groupBox_8) self.horizontalLayout_19.addLayout(self.verticalLayout_19) self.line_5 = QtGui.QFrame(self.groupBox_6) self.line_5.setFrameShape(QtGui.QFrame.VLine) self.line_5.setFrameShadow(QtGui.QFrame.Sunken) self.line_5.setObjectName(_fromUtf8("line_5")) self.horizontalLayout_19.addWidget(self.line_5) self.verticalLayout_20 = QtGui.QVBoxLayout() self.verticalLayout_20.setObjectName(_fromUtf8("verticalLayout_20")) self.label_25 = QtGui.QLabel(self.groupBox_6) font = QtGui.QFont() font.setPointSize(10) font.setBold(False) font.setWeight(50) self.label_25.setFont(font) self.label_25.setText(QtGui.QApplication.translate("Dialog", "Normal Layers", None, QtGui.QApplication.UnicodeUTF8)) self.label_25.setAlignment(QtCore.Qt.AlignCenter) self.label_25.setObjectName(_fromUtf8("label_25")) self.verticalLayout_20.addWidget(self.label_25) self.horizontalLayout_28 = QtGui.QHBoxLayout() self.horizontalLayout_28.setObjectName(_fromUtf8("horizontalLayout_28")) self.label_29 = QtGui.QLabel(self.groupBox_6) self.label_29.setText(QtGui.QApplication.translate("Dialog", "Exposure Time", None, QtGui.QApplication.UnicodeUTF8)) self.label_29.setObjectName(_fromUtf8("label_29")) self.horizontalLayout_28.addWidget(self.label_29) self.horizontalLayout_32 = QtGui.QHBoxLayout() self.horizontalLayout_32.setObjectName(_fromUtf8("horizontalLayout_32")) self.exposureNormal = QtGui.QLineEdit(self.groupBox_6) self.exposureNormal.setText(_fromUtf8("")) self.exposureNormal.setObjectName(_fromUtf8("exposureNormal")) self.horizontalLayout_32.addWidget(self.exposureNormal) self.label_31 = QtGui.QLabel(self.groupBox_6) self.label_31.setText(QtGui.QApplication.translate("Dialog", "s", None, QtGui.QApplication.UnicodeUTF8)) self.label_31.setObjectName(_fromUtf8("label_31")) self.horizontalLayout_32.addWidget(self.label_31) self.horizontalLayout_28.addLayout(self.horizontalLayout_32) self.verticalLayout_20.addLayout(self.horizontalLayout_28) self.groupBox = QtGui.QGroupBox(self.groupBox_6) self.groupBox.setMinimumSize(QtCore.QSize(0, 80)) self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Inter-layer scripting", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.horizontalLayout_33 = QtGui.QHBoxLayout(self.groupBox) self.horizontalLayout_33.setObjectName(_fromUtf8("horizontalLayout_33")) self.scriptNormal = QtGui.QPlainTextEdit(self.groupBox) self.scriptNormal.setObjectName(_fromUtf8("scriptNormal")) self.horizontalLayout_33.addWidget(self.scriptNormal) self.verticalLayout_20.addWidget(self.groupBox) self.horizontalLayout_19.addLayout(self.verticalLayout_20) self.verticalLayout_18.addLayout(self.horizontalLayout_19) self.horizontalLayout_16.addLayout(self.verticalLayout_18) self.horizontalLayout_35.addWidget(self.groupBox_6) spacerItem25 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_35.addItem(spacerItem25) self.verticalLayout_21.addLayout(self.horizontalLayout_35) self.verticalLayout_22.addLayout(self.verticalLayout_21) self.verticalLayout_23.addWidget(self.groupBox_9) spacerItem26 = QtGui.QSpacerItem(20, 23, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_23.addItem(spacerItem26) self.verticalLayout_24.addLayout(self.verticalLayout_23) self.tabWidget.addTab(self.tab_3, _fromUtf8("")) self.verticalLayout_11.addWidget(self.tabWidget) self.buttonBox = QtGui.QDialogButtonBox(self) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.verticalLayout_11.addWidget(self.buttonBox) self.verticalLayout_12.addLayout(self.verticalLayout_11) self.tabWidget.setCurrentIndex(0) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.reject) QtCore.QObject.connect(self.toolButton_2, QtCore.SIGNAL(_fromUtf8("pressed()")), self.CreateNewResinProfile) QtCore.QObject.connect(self.toolButton, QtCore.SIGNAL(_fromUtf8("pressed()")), self.CreateNewHardwareProfile) QtCore.QObject.connect(self.pickhardwareprofile, QtCore.SIGNAL(_fromUtf8("currentIndexChanged(QString)")), self.HardwareProfileChanged) QtCore.QObject.connect(self.pickresin, QtCore.SIGNAL(_fromUtf8("currentIndexChanged(QString)")), self.ResinProfileChanged) QtCore.QObject.connect(self.toolButton_3, QtCore.SIGNAL(_fromUtf8("pressed()")), self.CreateNewLayerProfile) QtCore.QObject.connect(self.picklayerprofile, QtCore.SIGNAL(_fromUtf8("currentIndexChanged(QString)")), self.LayerProfileChanged) QtCore.QMetaObject.connectSlotsByName(self) QtCore.QMetaObject.connectSlotsByName(self) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("Dialog", "General Settings", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("Dialog", "Hardware Settings", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), QtGui.QApplication.translate("Dialog", "Layer Advance Settings", None, QtGui.QApplication.UnicodeUTF8)) for object in self.parent.hardwareProfiles: self.pickhardwareprofile.addItem(object.name) for object in self.parent.resinProfiles: self.pickresin.addItem(object.name) for object in self.parent.layerProfiles: self.picklayerprofile.addItem(object.name) self.resinName.setText("") self.density.setText("") self.cost.setText("") self.curingEnergy.setText("") self.name.setText("") self.description.setText("") self.notes.setText("") self.controller.setText("") self.port.setText("") self.pitchZ.setText("") self.stepsPerRevZ.setText("") self.steppingMode.setText("") self.layerThickness.setText("") self.resolutionX.setText("") self.resolutionY.setText("") self.buildAreaX.setText("") self.buildAreaY.setText("") self.pixelSizeX.setText("") self.pixelSizeY.setText("") self.ResinProfileChanged() self.HardwareProfileChanged() def getController(self, dialog): if dialog.radio_ramps.isChecked(): return "RAMPS" elif dialog.radio_arduinoUno.isChecked(): return "ARDUINOUNO" elif dialog.radio_arduinoMega.isChecked(): return "ARDUINOMEGA" elif dialog.radio_pyMCU.isChecked(): return "PYMCU" def getSteppingMode(self, dialog): if dialog.fullStep.isChecked(): return "FULL" elif dialog.halfStep.isChecked(): return "HALF" elif dialog.quarterStep.isChecked(): return "QUARTER" elif dialog.eighthStep.isChecked(): return "EIGHTH" elif dialog.sixteenthStep.isChecked(): return "SIXTEENTH" def CreateNewResinProfile(self): profile = resinProfile() dialog = NewResinProfileDialog(self, self.parent) dialog.exec_() profile.name = self.name.text() profile.density = self.density.text() profile.cost = self.cost.text() profile.curingEnergy = self.curingEnergy.text() self.parent.resinProfiles.append(profile) self.pickresin.addItem(profile.name) self.pickresin.setCurrentIndex(0) def CreateNewHardwareProfile(self): profile = hardwareProfile() dialog = NewHardwareProfileDialog(self, self.parent) dialog.exec_() profile.name = dialog.name.text() profile.description = dialog.description.text() profile.notes = dialog.notes.toPlainText() profile.controller = self.getController(dialog) profile.port = dialog.pickcom.currentText() profile.leadscrewPitchZ = dialog.pitchZ.text() profile.stepsPerRevZ = dialog.stepsPerRevZ.text() profile.steppingMode = self.getSteppingMode(dialog) profile.layerThickness = dialog.layerThickness.text() profile.projectorResolution = (dialog.projectorResolutionX.text(), dialog.projectorResolutionY.text()) profile.buildAreaSize = (dialog.buildAreaX.text(), dialog.buildAreaY.text()) profile.pixelSize = (dialog.pixelSizeX.text(), dialog.pixelSizeY.text()) self.parent.hardwareProfiles.append(profile) #update drop down list with new profile and select it self.pickhardwareprofile.addItem(profile.name) self.pickhardwareprofile.setCurrentIndex(0) def CreateNewLayerProfile(self): profile = layerProfile() dialog = NewLayerProfileDialog(self, self.parent) dialog.exec_() profile.name = dialog.name.text() profile.description = dialog.description.text() profile.notes = dialog.notes.toPlainText() profile.numStartLayers = dialog.numStartLayers.text() profile.exposureStart = dialog.exposureStart.text() profile.exposureNormal = dialog.exposureNormal.text() profile.scriptStart = dialog.scriptStart.toPlainText() profile.scriptNormal = dialog.scriptNormal.toPlainText() self.parent.layerProfiles.append(profile) self.picklayerprofile.addItem(profile.name) self.picklayerprofile.setCurrentIndex(0) def LayerProfileChanged(self): for object in self.parent.layerProfiles: if str(self.picklayerprofile.currentText()) == object.name: self.layerProfileName.setText(object.name) self.layerProfileDescription.setText(object.description) self.layerProfileNotes.setText(object.notes) self.numStartLayers.setText(object.numStartLayers) self.exposureStart.setText(object.exposureStart) self.exposureNormal.setText(object.exposureNormal) self.scriptStart.appendPlainText(object.scriptStart) self.scriptNormal.appendPlainText(object.scriptNormal) def HardwareProfileChanged(self): for object in self.parent.hardwareProfiles: if str(self.pickhardwareprofile.currentText()) == object.name: self.name.setText(str(object.name)) self.description.setText(str(object.description)) self.notes.setText(str(object.notes)) self.controller.setText(str(object.controller)) self.port.setText(str(object.port)) self.pitchZ.setText(str(object.leadscrewPitchZ)) self.stepsPerRevZ.setText(str(object.stepsPerRevZ)) self.steppingMode.setText(str(object.steppingMode)) self.layerThickness.setText(str(object.layerThickness)) self.resolutionX.setText(str(object.projectorResolution[0])) self.resolutionY.setText(str(object.projectorResolution[1])) self.buildAreaX.setText(str(object.buildAreaSize[1])) self.buildAreaY.setText(str(object.buildAreaSize[1])) self.pixelSizeX.setText(str(object.pixelSize[0])) self.pixelSizeY.setText(str(object.pixelSize[1])) def ResinProfileChanged(self): for object in self.parent.resinProfiles: if str(self.pickresin.currentText()) == object.name: self.resinName.setText(str(object.name)) self.density.setText(str(object.density)) self.cost.setText(str(object.cost)) self.curingEnergy.setText(str(object.curingEnergy)) class NewHardwareProfileDialog(QtGui.QDialog): def __init__(self, parent, mainparent): super(NewHardwareProfileDialog, self).__init__(parent) self.parent = mainparent self.setWindowTitle("Define New Hardware Profile") self.resize(682, 510) self.verticalLayout_6 = QtGui.QVBoxLayout(self) self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.verticalLayout_5 = QtGui.QVBoxLayout() self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.label = QtGui.QLabel(self) font = QtGui.QFont() font.setPointSize(14) self.label.setFont(font) self.label.setText(QtGui.QApplication.translate("dialogHardware", "Define New Hardware Profile", None, QtGui.QApplication.UnicodeUTF8)) self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout.addWidget(self.label) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem1) self.verticalLayout_5.addLayout(self.horizontalLayout) self.horizontalLayout_24 = QtGui.QHBoxLayout() self.horizontalLayout_24.setObjectName(_fromUtf8("horizontalLayout_24")) self.label_18 = QtGui.QLabel(self) self.label_18.setText(QtGui.QApplication.translate("dialogHardware", "Profile Name:", None, QtGui.QApplication.UnicodeUTF8)) self.label_18.setObjectName(_fromUtf8("label_18")) self.horizontalLayout_24.addWidget(self.label_18) self.name = QtGui.QLineEdit(self) self.name.setObjectName(_fromUtf8("name")) self.horizontalLayout_24.addWidget(self.name) self.verticalLayout_5.addLayout(self.horizontalLayout_24) self.horizontalLayout_25 = QtGui.QHBoxLayout() self.horizontalLayout_25.setObjectName(_fromUtf8("horizontalLayout_25")) self.label_19 = QtGui.QLabel(self) self.label_19.setText(QtGui.QApplication.translate("dialogHardware", "Profile Description:", None, QtGui.QApplication.UnicodeUTF8)) self.label_19.setObjectName(_fromUtf8("label_19")) self.horizontalLayout_25.addWidget(self.label_19) self.description = QtGui.QLineEdit(self) self.description.setObjectName(_fromUtf8("description")) self.horizontalLayout_25.addWidget(self.description) self.verticalLayout_5.addLayout(self.horizontalLayout_25) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) self.label_4 = QtGui.QLabel(self) self.label_4.setText(QtGui.QApplication.translate("dialogHardware", "Notes:", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setObjectName(_fromUtf8("label_4")) self.horizontalLayout_5.addWidget(self.label_4) self.notes = QtGui.QTextEdit(self) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.notes.sizePolicy().hasHeightForWidth()) self.notes.setSizePolicy(sizePolicy) self.notes.setObjectName(_fromUtf8("notes")) self.horizontalLayout_5.addWidget(self.notes) self.verticalLayout_5.addLayout(self.horizontalLayout_5) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.groupBox = QtGui.QGroupBox(self) self.groupBox.setTitle(QtGui.QApplication.translate("dialogHardware", "Controller Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.verticalLayout_2 = QtGui.QVBoxLayout(self.groupBox) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.horizontalLayout_7 = QtGui.QHBoxLayout() self.horizontalLayout_7.setContentsMargins(-1, -1, 0, -1) self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7")) self.radio_ramps = QtGui.QRadioButton(self.groupBox) self.radio_ramps.setText(QtGui.QApplication.translate("dialogHardware", "RAMPS", None, QtGui.QApplication.UnicodeUTF8)) self.radio_ramps.setChecked(True) self.radio_ramps.setObjectName(_fromUtf8("radio_ramps")) self.horizontalLayout_7.addWidget(self.radio_ramps) self.radio_arduinoUno = QtGui.QRadioButton(self.groupBox) self.radio_arduinoUno.setEnabled(False) self.radio_arduinoUno.setText(QtGui.QApplication.translate("dialogHardware", "Arduino Uno", None, QtGui.QApplication.UnicodeUTF8)) self.radio_arduinoUno.setChecked(False) self.radio_arduinoUno.setObjectName(_fromUtf8("radio_arduinoUno")) self.horizontalLayout_7.addWidget(self.radio_arduinoUno) self.radio_arduinoMega = QtGui.QRadioButton(self.groupBox) self.radio_arduinoMega.setEnabled(False) self.radio_arduinoMega.setText(QtGui.QApplication.translate("dialogHardware", "Arduino Mega", None, QtGui.QApplication.UnicodeUTF8)) self.radio_arduinoMega.setObjectName(_fromUtf8("radio_arduinoMega")) self.horizontalLayout_7.addWidget(self.radio_arduinoMega) self.radio_pyMCU = QtGui.QRadioButton(self.groupBox) self.radio_pyMCU.setEnabled(False) self.radio_pyMCU.setText(QtGui.QApplication.translate("dialogHardware", "PyMCU", None, QtGui.QApplication.UnicodeUTF8)) self.radio_pyMCU.setObjectName(_fromUtf8("radio_pyMCU")) self.horizontalLayout_7.addWidget(self.radio_pyMCU) self.verticalLayout.addLayout(self.horizontalLayout_7) self.horizontalLayout_8 = QtGui.QHBoxLayout() self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8")) self.label_29 = QtGui.QLabel(self.groupBox) self.label_29.setText(QtGui.QApplication.translate("dialogHardware", "COM Port:", None, QtGui.QApplication.UnicodeUTF8)) self.label_29.setObjectName(_fromUtf8("label_29")) self.horizontalLayout_8.addWidget(self.label_29) self.pickcom = QtGui.QComboBox(self.groupBox) self.pickcom.setObjectName(_fromUtf8("pickcom")) self.horizontalLayout_8.addWidget(self.pickcom) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem2) self.verticalLayout.addLayout(self.horizontalLayout_8) self.verticalLayout_2.addLayout(self.verticalLayout) self.horizontalLayout_2.addWidget(self.groupBox) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem3) self.verticalLayout_5.addLayout(self.horizontalLayout_2) self.groupBox_7 = QtGui.QGroupBox(self) self.groupBox_7.setTitle(QtGui.QApplication.translate("dialogHardware", "Hardware Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_7.setObjectName(_fromUtf8("groupBox_7")) self.horizontalLayout_4 = QtGui.QHBoxLayout(self.groupBox_7) self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.verticalLayout_4 = QtGui.QVBoxLayout() self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.horizontalLayout_22 = QtGui.QHBoxLayout() self.horizontalLayout_22.setObjectName(_fromUtf8("horizontalLayout_22")) self.label_6 = QtGui.QLabel(self.groupBox_7) self.label_6.setText(QtGui.QApplication.translate("dialogHardware", "Z Axis Leadscrew Pitch:", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setObjectName(_fromUtf8("label_6")) self.horizontalLayout_22.addWidget(self.label_6) self.pitchZ = QtGui.QLineEdit(self.groupBox_7) self.pitchZ.setObjectName(_fromUtf8("pitchZ")) self.horizontalLayout_22.addWidget(self.pitchZ) self.label_7 = QtGui.QLabel(self.groupBox_7) self.label_7.setText(QtGui.QApplication.translate("dialogHardware", "mm/rev", None, QtGui.QApplication.UnicodeUTF8)) self.label_7.setObjectName(_fromUtf8("label_7")) self.horizontalLayout_22.addWidget(self.label_7) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_22.addItem(spacerItem4) self.verticalLayout_4.addLayout(self.horizontalLayout_22) self.horizontalLayout_23 = QtGui.QHBoxLayout() self.horizontalLayout_23.setObjectName(_fromUtf8("horizontalLayout_23")) self.label_8 = QtGui.QLabel(self.groupBox_7) self.label_8.setText(QtGui.QApplication.translate("dialogHardware", "Z Axis Steps/rev:", None, QtGui.QApplication.UnicodeUTF8)) self.label_8.setObjectName(_fromUtf8("label_8")) self.horizontalLayout_23.addWidget(self.label_8) self.stepsPerRevZ = QtGui.QLineEdit(self.groupBox_7) self.stepsPerRevZ.setObjectName(_fromUtf8("stepsPerRevZ")) self.horizontalLayout_23.addWidget(self.stepsPerRevZ) self.label_9 = QtGui.QLabel(self.groupBox_7) self.label_9.setText(QtGui.QApplication.translate("dialogHardware", "steps", None, QtGui.QApplication.UnicodeUTF8)) self.label_9.setObjectName(_fromUtf8("label_9")) self.horizontalLayout_23.addWidget(self.label_9) spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_23.addItem(spacerItem5) self.verticalLayout_4.addLayout(self.horizontalLayout_23) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) self.label_10 = QtGui.QLabel(self.groupBox_7) self.label_10.setText(QtGui.QApplication.translate("dialogHardware", "Layer Thickness:", None, QtGui.QApplication.UnicodeUTF8)) self.label_10.setObjectName(_fromUtf8("label_10")) self.horizontalLayout_9.addWidget(self.label_10) self.layerThickness = QtGui.QLineEdit(self.groupBox_7) self.layerThickness.setObjectName(_fromUtf8("layerThickness")) self.horizontalLayout_9.addWidget(self.layerThickness) self.label_13 = QtGui.QLabel(self.groupBox_7) self.label_13.setText(QtGui.QApplication.translate("dialogHardware", "um", None, QtGui.QApplication.UnicodeUTF8)) self.label_13.setObjectName(_fromUtf8("label_13")) self.horizontalLayout_9.addWidget(self.label_13) spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem6) self.verticalLayout_4.addLayout(self.horizontalLayout_9) self.horizontalLayout_10 = QtGui.QHBoxLayout() self.horizontalLayout_10.setObjectName(_fromUtf8("horizontalLayout_10")) self.label_11 = QtGui.QLabel(self.groupBox_7) self.label_11.setText(QtGui.QApplication.translate("dialogHardware", "Projector Resolution (pixels):", None, QtGui.QApplication.UnicodeUTF8)) self.label_11.setObjectName(_fromUtf8("label_11")) self.horizontalLayout_10.addWidget(self.label_11) self.projectorResolutionX = QtGui.QLineEdit(self.groupBox_7) self.projectorResolutionX.setObjectName(_fromUtf8("projectorResolutionX")) self.horizontalLayout_10.addWidget(self.projectorResolutionX) self.label_12 = QtGui.QLabel(self.groupBox_7) self.label_12.setText(QtGui.QApplication.translate("dialogHardware", "x", None, QtGui.QApplication.UnicodeUTF8)) self.label_12.setObjectName(_fromUtf8("label_12")) self.horizontalLayout_10.addWidget(self.label_12) self.projectorResolutionY = QtGui.QLineEdit(self.groupBox_7) self.projectorResolutionY.setObjectName(_fromUtf8("projectorResolutionY")) self.horizontalLayout_10.addWidget(self.projectorResolutionY) spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_10.addItem(spacerItem7) self.verticalLayout_4.addLayout(self.horizontalLayout_10) self.horizontalLayout_11 = QtGui.QHBoxLayout() self.horizontalLayout_11.setObjectName(_fromUtf8("horizontalLayout_11")) self.label_14 = QtGui.QLabel(self.groupBox_7) self.label_14.setText(QtGui.QApplication.translate("dialogHardware", "Build Area Size (mm):", None, QtGui.QApplication.UnicodeUTF8)) self.label_14.setObjectName(_fromUtf8("label_14")) self.horizontalLayout_11.addWidget(self.label_14) self.buildAreaX = QtGui.QLineEdit(self.groupBox_7) self.buildAreaX.setObjectName(_fromUtf8("buildAreaX")) self.horizontalLayout_11.addWidget(self.buildAreaX) self.label_15 = QtGui.QLabel(self.groupBox_7) self.label_15.setText(QtGui.QApplication.translate("dialogHardware", "x", None, QtGui.QApplication.UnicodeUTF8)) self.label_15.setObjectName(_fromUtf8("label_15")) self.horizontalLayout_11.addWidget(self.label_15) self.buildAreaY = QtGui.QLineEdit(self.groupBox_7) self.buildAreaY.setObjectName(_fromUtf8("buildAreaY")) self.horizontalLayout_11.addWidget(self.buildAreaY) spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_11.addItem(spacerItem8) self.verticalLayout_4.addLayout(self.horizontalLayout_11) self.horizontalLayout_12 = QtGui.QHBoxLayout() self.horizontalLayout_12.setObjectName(_fromUtf8("horizontalLayout_12")) self.label_16 = QtGui.QLabel(self.groupBox_7) self.label_16.setText(QtGui.QApplication.translate("dialogHardware", "Pixel Size (um):", None, QtGui.QApplication.UnicodeUTF8)) self.label_16.setObjectName(_fromUtf8("label_16")) self.horizontalLayout_12.addWidget(self.label_16) self.pixelSizeX = QtGui.QLabel(self.groupBox_7) self.pixelSizeX.setText(QtGui.QApplication.translate("dialogHardware", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.pixelSizeX.setObjectName(_fromUtf8("pixelSizeX")) self.horizontalLayout_12.addWidget(self.pixelSizeX) self.label_17 = QtGui.QLabel(self.groupBox_7) self.label_17.setText(QtGui.QApplication.translate("dialogHardware", "x", None, QtGui.QApplication.UnicodeUTF8)) self.label_17.setObjectName(_fromUtf8("label_17")) self.horizontalLayout_12.addWidget(self.label_17) self.pixelSizeY = QtGui.QLabel(self.groupBox_7) self.pixelSizeY.setText(QtGui.QApplication.translate("dialogHardware", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.pixelSizeY.setObjectName(_fromUtf8("pixelSizeY")) self.horizontalLayout_12.addWidget(self.pixelSizeY) spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_12.addItem(spacerItem9) self.verticalLayout_4.addLayout(self.horizontalLayout_12) self.horizontalLayout_3.addLayout(self.verticalLayout_4) self.groupBox_4 = QtGui.QGroupBox(self.groupBox_7) self.groupBox_4.setTitle(QtGui.QApplication.translate("dialogHardware", "Stepping Mode", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_4.setObjectName(_fromUtf8("groupBox_4")) self.horizontalLayout_13 = QtGui.QHBoxLayout(self.groupBox_4) self.horizontalLayout_13.setObjectName(_fromUtf8("horizontalLayout_13")) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.fullStep = QtGui.QRadioButton(self.groupBox_4) self.fullStep.setText(QtGui.QApplication.translate("dialogHardware", "Full Stepping", None, QtGui.QApplication.UnicodeUTF8)) self.fullStep.setChecked(True) self.fullStep.setObjectName(_fromUtf8("fullStep")) self.verticalLayout_3.addWidget(self.fullStep) self.halfStep = QtGui.QRadioButton(self.groupBox_4) self.halfStep.setText(QtGui.QApplication.translate("dialogHardware", "1/2 Microstepping", None, QtGui.QApplication.UnicodeUTF8)) self.halfStep.setObjectName(_fromUtf8("halfStep")) self.verticalLayout_3.addWidget(self.halfStep) self.quarterStep = QtGui.QRadioButton(self.groupBox_4) self.quarterStep.setText(QtGui.QApplication.translate("dialogHardware", "1/4 Microstepping", None, QtGui.QApplication.UnicodeUTF8)) self.quarterStep.setObjectName(_fromUtf8("quarterStep")) self.verticalLayout_3.addWidget(self.quarterStep) self.eighthStep = QtGui.QRadioButton(self.groupBox_4) self.eighthStep.setText(QtGui.QApplication.translate("dialogHardware", "1/8 Microstepping", None, QtGui.QApplication.UnicodeUTF8)) self.eighthStep.setObjectName(_fromUtf8("eighthStep")) self.verticalLayout_3.addWidget(self.eighthStep) self.sixteenthStep = QtGui.QRadioButton(self.groupBox_4) self.sixteenthStep.setText(QtGui.QApplication.translate("dialogHardware", "1/16 Microstepping", None, QtGui.QApplication.UnicodeUTF8)) self.sixteenthStep.setObjectName(_fromUtf8("sixteenthStep")) self.verticalLayout_3.addWidget(self.sixteenthStep) self.horizontalLayout_13.addLayout(self.verticalLayout_3) self.horizontalLayout_3.addWidget(self.groupBox_4) self.horizontalLayout_4.addLayout(self.horizontalLayout_3) self.verticalLayout_5.addWidget(self.groupBox_7) spacerItem10 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_5.addItem(spacerItem10) self.buttonBox = QtGui.QDialogButtonBox(self) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.verticalLayout_5.addWidget(self.buttonBox) self.verticalLayout_6.addLayout(self.verticalLayout_5) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.reject) QtCore.QObject.connect(self.buildAreaX, QtCore.SIGNAL(_fromUtf8("textChanged(QString)")), self.CalculatePixelSize) QtCore.QObject.connect(self.buildAreaY, QtCore.SIGNAL(_fromUtf8("textChanged(QString)")), self.CalculatePixelSize) QtCore.QMetaObject.connectSlotsByName(self) self.pixelSizeX.setText("") self.pixelSizeY.setText("") for x in range(self.parent.numports): portentry = self.parent.ports[x] #switch to dict x if portentry['available'] == True: #if it is currently available portname = portentry['name'] #find the name of the port #print portname self.pickcom.addItem(portname) #self.pickcom.setItemText(x, QtGui.QApplication.translate("SettingsDialogBaseClass", "%s"%portname, None, QtGui.QApplication.UnicodeUTF8)) def CalculatePixelSize(self): try: self.pixelSizeX.setText(str((float(str(self.buildAreaX.text()))/float(str(self.projectorResolutionX.text())))*1000)) self.pixelSizeY.setText(str((float(str(self.buildAreaY.text()))/float(str(self.projectorResolutionY.text())))*1000)) except: pass class NewResinProfileDialog(QtGui.QDialog): def __init__(self, parent, mainparent): super(NewResinProfileDialog, self).__init__(parent) self.parent = mainparent self.setWindowTitle("Define New Resin Profile") self.horizontalLayout_5 = QtGui.QHBoxLayout(self) self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem) self.label = QtGui.QLabel(self) font = QtGui.QFont() font.setPointSize(14) self.label.setFont(font) self.label.setText(QtGui.QApplication.translate("dialogResin", "Define New Resin", None, QtGui.QApplication.UnicodeUTF8)) self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout_4.addWidget(self.label) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem1) self.verticalLayout.addLayout(self.horizontalLayout_4) spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem2) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.label_2 = QtGui.QLabel(self) self.label_2.setText(QtGui.QApplication.translate("dialogResin", "Name:", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setObjectName(_fromUtf8("label_2")) self.horizontalLayout_3.addWidget(self.label_2) self.name = QtGui.QLineEdit(self) self.name.setObjectName(_fromUtf8("name")) self.horizontalLayout_3.addWidget(self.name) self.verticalLayout.addLayout(self.horizontalLayout_3) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.label_3 = QtGui.QLabel(self) self.label_3.setText(QtGui.QApplication.translate("dialogResin", "Density:", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setObjectName(_fromUtf8("label_3")) self.horizontalLayout_2.addWidget(self.label_3) self.density = QtGui.QLineEdit(self) self.density.setObjectName(_fromUtf8("density")) self.horizontalLayout_2.addWidget(self.density) self.label_21 = QtGui.QLabel(self) self.label_21.setText(QtGui.QApplication.translate("dialogResin", "g/mL", None, QtGui.QApplication.UnicodeUTF8)) self.label_21.setObjectName(_fromUtf8("label_21")) self.horizontalLayout_2.addWidget(self.label_21) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.label_4 = QtGui.QLabel(self) self.label_4.setText(QtGui.QApplication.translate("dialogResin", "Cost:", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setObjectName(_fromUtf8("label_4")) self.horizontalLayout.addWidget(self.label_4) self.cost = QtGui.QLineEdit(self) self.cost.setObjectName(_fromUtf8("cost")) self.horizontalLayout.addWidget(self.cost) self.label_19 = QtGui.QLabel(self) self.label_19.setText(QtGui.QApplication.translate("dialogResin", "$/L", None, QtGui.QApplication.UnicodeUTF8)) self.label_19.setObjectName(_fromUtf8("label_19")) self.horizontalLayout.addWidget(self.label_19) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_29 = QtGui.QHBoxLayout() self.horizontalLayout_29.setObjectName(_fromUtf8("horizontalLayout_29")) self.label_22 = QtGui.QLabel(self) self.label_22.setText(QtGui.QApplication.translate("dialogResin", "Curing Energy:", None, QtGui.QApplication.UnicodeUTF8)) self.label_22.setObjectName(_fromUtf8("label_22")) self.horizontalLayout_29.addWidget(self.label_22) self.curingEnergy = QtGui.QLineEdit(self) self.curingEnergy.setObjectName(_fromUtf8("curingEnergy")) self.horizontalLayout_29.addWidget(self.curingEnergy) self.label_36 = QtGui.QLabel(self) self.label_36.setText(QtGui.QApplication.translate("dialogResin", "W/cm^2", None, QtGui.QApplication.UnicodeUTF8)) self.label_36.setObjectName(_fromUtf8("label_36")) self.horizontalLayout_29.addWidget(self.label_36) self.verticalLayout.addLayout(self.horizontalLayout_29) spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem3) self.buttonBox = QtGui.QDialogButtonBox(self) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.verticalLayout.addWidget(self.buttonBox) self.horizontalLayout_5.addLayout(self.verticalLayout) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.reject) QtCore.QMetaObject.connectSlotsByName(self) class NewLayerProfileDialog(QtGui.QDialog): def __init__(self, parent, mainparent): super(NewLayerProfileDialog, self).__init__(parent) self.parent = mainparent self.setWindowTitle("Define New Layer Advance Profile") self.verticalLayout_2 = QtGui.QVBoxLayout(self) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_5.addItem(spacerItem) self.label_5 = QtGui.QLabel(self) font = QtGui.QFont() font.setPointSize(14) self.label_5.setFont(font) self.label_5.setText(QtGui.QApplication.translate("Dialog", "Define New Layer Advance Scripting Profile", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setObjectName(_fromUtf8("label_5")) self.horizontalLayout_5.addWidget(self.label_5) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_5.addItem(spacerItem1) self.verticalLayout.addLayout(self.horizontalLayout_5) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.label_2 = QtGui.QLabel(self) self.label_2.setText(QtGui.QApplication.translate("Dialog", "Name:", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setObjectName(_fromUtf8("label_2")) self.horizontalLayout_3.addWidget(self.label_2) self.name = QtGui.QLineEdit(self) self.name.setObjectName(_fromUtf8("name")) self.horizontalLayout_3.addWidget(self.name) self.verticalLayout.addLayout(self.horizontalLayout_3) self.horizontalLayout_25 = QtGui.QHBoxLayout() self.horizontalLayout_25.setObjectName(_fromUtf8("horizontalLayout_25")) self.label_19 = QtGui.QLabel(self) self.label_19.setText(QtGui.QApplication.translate("Dialog", "Profile Description:", None, QtGui.QApplication.UnicodeUTF8)) self.label_19.setObjectName(_fromUtf8("label_19")) self.horizontalLayout_25.addWidget(self.label_19) self.description = QtGui.QLineEdit(self) self.description.setObjectName(_fromUtf8("description")) self.horizontalLayout_25.addWidget(self.description) self.verticalLayout.addLayout(self.horizontalLayout_25) self.horizontalLayout_6 = QtGui.QHBoxLayout() self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6")) self.label_4 = QtGui.QLabel(self) self.label_4.setText(QtGui.QApplication.translate("Dialog", "Notes:", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setObjectName(_fromUtf8("label_4")) self.horizontalLayout_6.addWidget(self.label_4) self.notes = QtGui.QTextEdit(self) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.notes.sizePolicy().hasHeightForWidth()) self.notes.setSizePolicy(sizePolicy) self.notes.setObjectName(_fromUtf8("notes")) self.horizontalLayout_6.addWidget(self.notes) self.verticalLayout.addLayout(self.horizontalLayout_6) self.line = QtGui.QFrame(self) self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName(_fromUtf8("line")) self.verticalLayout.addWidget(self.line) self.groupBox_6 = QtGui.QGroupBox(self) self.groupBox_6.setTitle(QtGui.QApplication.translate("Dialog", "Layer Advance Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_6.setObjectName(_fromUtf8("groupBox_6")) self.horizontalLayout_16 = QtGui.QHBoxLayout(self.groupBox_6) self.horizontalLayout_16.setObjectName(_fromUtf8("horizontalLayout_16")) self.verticalLayout_18 = QtGui.QVBoxLayout() self.verticalLayout_18.setObjectName(_fromUtf8("verticalLayout_18")) self.horizontalLayout_17 = QtGui.QHBoxLayout() self.horizontalLayout_17.setObjectName(_fromUtf8("horizontalLayout_17")) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_17.addItem(spacerItem2) self.horizontalLayout_18 = QtGui.QHBoxLayout() self.horizontalLayout_18.setObjectName(_fromUtf8("horizontalLayout_18")) self.label_26 = QtGui.QLabel(self.groupBox_6) self.label_26.setText(QtGui.QApplication.translate("Dialog", "Number of starting layers", None, QtGui.QApplication.UnicodeUTF8)) self.label_26.setObjectName(_fromUtf8("label_26")) self.horizontalLayout_18.addWidget(self.label_26) self.numStartLayers = QtGui.QLineEdit(self.groupBox_6) self.numStartLayers.setText(_fromUtf8("")) self.numStartLayers.setObjectName(_fromUtf8("numStartLayers")) self.horizontalLayout_18.addWidget(self.numStartLayers) self.horizontalLayout_17.addLayout(self.horizontalLayout_18) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_17.addItem(spacerItem3) self.verticalLayout_18.addLayout(self.horizontalLayout_17) self.line_4 = QtGui.QFrame(self.groupBox_6) self.line_4.setFrameShape(QtGui.QFrame.HLine) self.line_4.setFrameShadow(QtGui.QFrame.Sunken) self.line_4.setObjectName(_fromUtf8("line_4")) self.verticalLayout_18.addWidget(self.line_4) self.horizontalLayout_19 = QtGui.QHBoxLayout() self.horizontalLayout_19.setObjectName(_fromUtf8("horizontalLayout_19")) self.verticalLayout_19 = QtGui.QVBoxLayout() self.verticalLayout_19.setObjectName(_fromUtf8("verticalLayout_19")) self.label_3 = QtGui.QLabel(self.groupBox_6) font = QtGui.QFont() font.setPointSize(10) font.setBold(False) font.setWeight(50) self.label_3.setFont(font) self.label_3.setText(QtGui.QApplication.translate("Dialog", "Starting Layers", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setAlignment(QtCore.Qt.AlignCenter) self.label_3.setObjectName(_fromUtf8("label_3")) self.verticalLayout_19.addWidget(self.label_3) self.horizontalLayout_20 = QtGui.QHBoxLayout() self.horizontalLayout_20.setObjectName(_fromUtf8("horizontalLayout_20")) self.label_27 = QtGui.QLabel(self.groupBox_6) self.label_27.setText(QtGui.QApplication.translate("Dialog", "Starting layer exposure ", None, QtGui.QApplication.UnicodeUTF8)) self.label_27.setObjectName(_fromUtf8("label_27")) self.horizontalLayout_20.addWidget(self.label_27) self.exposureStart = QtGui.QLineEdit(self.groupBox_6) self.exposureStart.setText(_fromUtf8("")) self.exposureStart.setObjectName(_fromUtf8("exposureStart")) self.horizontalLayout_20.addWidget(self.exposureStart) self.label_30 = QtGui.QLabel(self.groupBox_6) self.label_30.setText(QtGui.QApplication.translate("Dialog", "s", None, QtGui.QApplication.UnicodeUTF8)) self.label_30.setObjectName(_fromUtf8("label_30")) self.horizontalLayout_20.addWidget(self.label_30) self.verticalLayout_19.addLayout(self.horizontalLayout_20) self.groupBox_8 = QtGui.QGroupBox(self.groupBox_6) self.groupBox_8.setMinimumSize(QtCore.QSize(0, 80)) self.groupBox_8.setTitle(QtGui.QApplication.translate("Dialog", "Inter-layer scripting", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_8.setObjectName(_fromUtf8("groupBox_8")) self.horizontalLayout_21 = QtGui.QHBoxLayout(self.groupBox_8) self.horizontalLayout_21.setObjectName(_fromUtf8("horizontalLayout_21")) self.scriptStart = QtGui.QPlainTextEdit(self.groupBox_8) self.scriptStart.setObjectName(_fromUtf8("scriptStart")) self.horizontalLayout_21.addWidget(self.scriptStart) self.verticalLayout_19.addWidget(self.groupBox_8) self.horizontalLayout_19.addLayout(self.verticalLayout_19) self.line_5 = QtGui.QFrame(self.groupBox_6) self.line_5.setFrameShape(QtGui.QFrame.VLine) self.line_5.setFrameShadow(QtGui.QFrame.Sunken) self.line_5.setObjectName(_fromUtf8("line_5")) self.horizontalLayout_19.addWidget(self.line_5) self.verticalLayout_20 = QtGui.QVBoxLayout() self.verticalLayout_20.setObjectName(_fromUtf8("verticalLayout_20")) self.label_25 = QtGui.QLabel(self.groupBox_6) font = QtGui.QFont() font.setPointSize(10) font.setBold(False) font.setWeight(50) self.label_25.setFont(font) self.label_25.setText(QtGui.QApplication.translate("Dialog", "Normal Layers", None, QtGui.QApplication.UnicodeUTF8)) self.label_25.setAlignment(QtCore.Qt.AlignCenter) self.label_25.setObjectName(_fromUtf8("label_25")) self.verticalLayout_20.addWidget(self.label_25) self.horizontalLayout_28 = QtGui.QHBoxLayout() self.horizontalLayout_28.setObjectName(_fromUtf8("horizontalLayout_28")) self.label_29 = QtGui.QLabel(self.groupBox_6) self.label_29.setText(QtGui.QApplication.translate("Dialog", "Exposure Time", None, QtGui.QApplication.UnicodeUTF8)) self.label_29.setObjectName(_fromUtf8("label_29")) self.horizontalLayout_28.addWidget(self.label_29) self.horizontalLayout_32 = QtGui.QHBoxLayout() self.horizontalLayout_32.setObjectName(_fromUtf8("horizontalLayout_32")) self.exposureNormal = QtGui.QLineEdit(self.groupBox_6) self.exposureNormal.setText(_fromUtf8("")) self.exposureNormal.setObjectName(_fromUtf8("exposureNormal")) self.horizontalLayout_32.addWidget(self.exposureNormal) self.label_31 = QtGui.QLabel(self.groupBox_6) self.label_31.setText(QtGui.QApplication.translate("Dialog", "s", None, QtGui.QApplication.UnicodeUTF8)) self.label_31.setObjectName(_fromUtf8("label_31")) self.horizontalLayout_32.addWidget(self.label_31) self.horizontalLayout_28.addLayout(self.horizontalLayout_32) self.verticalLayout_20.addLayout(self.horizontalLayout_28) self.groupBox = QtGui.QGroupBox(self.groupBox_6) self.groupBox.setMinimumSize(QtCore.QSize(0, 80)) self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Inter-layer scripting", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.horizontalLayout_33 = QtGui.QHBoxLayout(self.groupBox) self.horizontalLayout_33.setObjectName(_fromUtf8("horizontalLayout_33")) self.scriptNormal = QtGui.QPlainTextEdit(self.groupBox) self.scriptNormal.setObjectName(_fromUtf8("scriptNormal")) self.horizontalLayout_33.addWidget(self.scriptNormal) self.verticalLayout_20.addWidget(self.groupBox) self.horizontalLayout_19.addLayout(self.verticalLayout_20) self.verticalLayout_18.addLayout(self.horizontalLayout_19) self.horizontalLayout_16.addLayout(self.verticalLayout_18) self.verticalLayout.addWidget(self.groupBox_6) self.buttonBox = QtGui.QDialogButtonBox(self) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.verticalLayout.addWidget(self.buttonBox) self.verticalLayout_2.addLayout(self.verticalLayout) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.reject) QtCore.QMetaObject.connectSlotsByName(self) class wizardNewGeneral(QtGui.QWizardPage): def __init__(self, parent, mainparent): super(wizardNewGeneral, self).__init__(parent) self.parent = mainparent self.setTitle("General Print Job Settings") self.setSubTitle("test general settings page") self.horizontalLayout_3 = QtGui.QHBoxLayout(self) self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.verticalLayout_8 = QtGui.QVBoxLayout() self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) self.groupBox_2 = QtGui.QGroupBox(self) self.groupBox_2.setTitle(QtGui.QApplication.translate("WizardPage", "General Information", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) self.verticalLayout_6 = QtGui.QVBoxLayout(self.groupBox_2) self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.label = QtGui.QLabel(self.groupBox_2) self.label.setText(QtGui.QApplication.translate("WizardPage", "Job Name:", None, QtGui.QApplication.UnicodeUTF8)) self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout.addWidget(self.label) self.jobName = QtGui.QLineEdit(self.groupBox_2) self.jobName.setObjectName(_fromUtf8("jobName")) self.horizontalLayout.addWidget(self.jobName) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.label_2 = QtGui.QLabel(self.groupBox_2) self.label_2.setText(QtGui.QApplication.translate("WizardPage", "Description:", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setObjectName(_fromUtf8("label_2")) self.horizontalLayout_2.addWidget(self.label_2) self.jobDescription = QtGui.QLineEdit(self.groupBox_2) self.jobDescription.setObjectName(_fromUtf8("jobDescription")) self.horizontalLayout_2.addWidget(self.jobDescription) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.label_4 = QtGui.QLabel(self.groupBox_2) self.label_4.setText(QtGui.QApplication.translate("WizardPage", "Notes:", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setObjectName(_fromUtf8("label_4")) self.horizontalLayout_4.addWidget(self.label_4) self.jobNotes = QtGui.QTextEdit(self.groupBox_2) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.jobNotes.sizePolicy().hasHeightForWidth()) self.jobNotes.setSizePolicy(sizePolicy) self.jobNotes.setObjectName(_fromUtf8("jobNotes")) self.horizontalLayout_4.addWidget(self.jobNotes) self.verticalLayout.addLayout(self.horizontalLayout_4) self.verticalLayout_6.addLayout(self.verticalLayout) self.verticalLayout_8.addWidget(self.groupBox_2) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_8.addItem(spacerItem) self.horizontalLayout_3.addLayout(self.verticalLayout_8) def initializePage(self): pass def validatePage(self): self.parent.printJob.name = self.jobName.text() self.parent.printJob.description = self.jobDescription.text() self.parent.printJob.notes = self.jobNotes.toPlainText() return True class wizardNewHardware(QtGui.QWizardPage): def __init__(self, parent, mainparent): super(wizardNewHardware, self).__init__(parent) self.setTitle("Print Job Hardware Settings") self.setSubTitle("test hardware settings page") self.parent = mainparent self.profile = None self.horizontalLayout = QtGui.QHBoxLayout(self) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.horizontalLayout_6 = QtGui.QHBoxLayout() self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6")) self.label_5 = QtGui.QLabel(self) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) self.label_5.setSizePolicy(sizePolicy) self.label_5.setText(QtGui.QApplication.translate("WizardPage", "Load an existing hardware profile:", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setObjectName(_fromUtf8("label_5")) self.horizontalLayout_6.addWidget(self.label_5) self.comboBox = QtGui.QComboBox(self) self.comboBox.setObjectName(_fromUtf8("comboBox")) self.horizontalLayout_6.addWidget(self.comboBox) self.toolButton = QtGui.QToolButton(self) self.toolButton.setText(QtGui.QApplication.translate("WizardPage", "Create New Profile", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton.setObjectName(_fromUtf8("toolButton")) self.horizontalLayout_6.addWidget(self.toolButton) self.verticalLayout_3.addLayout(self.horizontalLayout_6) self.line = QtGui.QFrame(self) self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName(_fromUtf8("line")) self.verticalLayout_3.addWidget(self.line) spacerItem = QtGui.QSpacerItem(681, 13, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_3.addItem(spacerItem) self.groupBox_3 = QtGui.QGroupBox(self) self.groupBox_3.setTitle(QtGui.QApplication.translate("WizardPage", "Selected Hardware Profile", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_3.setObjectName(_fromUtf8("groupBox_3")) self.verticalLayout_17 = QtGui.QVBoxLayout(self.groupBox_3) self.verticalLayout_17.setObjectName(_fromUtf8("verticalLayout_17")) self.horizontalLayout_25 = QtGui.QHBoxLayout() self.horizontalLayout_25.setObjectName(_fromUtf8("horizontalLayout_25")) self.label_47 = QtGui.QLabel(self.groupBox_3) self.label_47.setText(QtGui.QApplication.translate("WizardPage", "Profile Name:", None, QtGui.QApplication.UnicodeUTF8)) self.label_47.setObjectName(_fromUtf8("label_47")) self.horizontalLayout_25.addWidget(self.label_47) self.name = QtGui.QLabel(self.groupBox_3) self.name.setText(QtGui.QApplication.translate("WizardPage", "Name", None, QtGui.QApplication.UnicodeUTF8)) self.name.setObjectName(_fromUtf8("name")) self.horizontalLayout_25.addWidget(self.name) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_25.addItem(spacerItem1) self.verticalLayout_17.addLayout(self.horizontalLayout_25) self.horizontalLayout_26 = QtGui.QHBoxLayout() self.horizontalLayout_26.setObjectName(_fromUtf8("horizontalLayout_26")) self.label_49 = QtGui.QLabel(self.groupBox_3) self.label_49.setText(QtGui.QApplication.translate("WizardPage", "Profile Description:", None, QtGui.QApplication.UnicodeUTF8)) self.label_49.setObjectName(_fromUtf8("label_49")) self.horizontalLayout_26.addWidget(self.label_49) self.description = QtGui.QLabel(self.groupBox_3) self.description.setText(QtGui.QApplication.translate("WizardPage", "Description", None, QtGui.QApplication.UnicodeUTF8)) self.description.setObjectName(_fromUtf8("description")) self.horizontalLayout_26.addWidget(self.description) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_26.addItem(spacerItem2) self.verticalLayout_17.addLayout(self.horizontalLayout_26) self.horizontalLayout_27 = QtGui.QHBoxLayout() self.horizontalLayout_27.setObjectName(_fromUtf8("horizontalLayout_27")) self.label_50 = QtGui.QLabel(self.groupBox_3) self.label_50.setText(QtGui.QApplication.translate("WizardPage", "Profile Notes:", None, QtGui.QApplication.UnicodeUTF8)) self.label_50.setObjectName(_fromUtf8("label_50")) self.horizontalLayout_27.addWidget(self.label_50) self.notes = QtGui.QLabel(self.groupBox_3) self.notes.setText(QtGui.QApplication.translate("WizardPage", "Notes", None, QtGui.QApplication.UnicodeUTF8)) self.notes.setWordWrap(True) self.notes.setObjectName(_fromUtf8("notes")) self.horizontalLayout_27.addWidget(self.notes) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_27.addItem(spacerItem3) self.verticalLayout_17.addLayout(self.horizontalLayout_27) self.line_2 = QtGui.QFrame(self.groupBox_3) self.line_2.setFrameShape(QtGui.QFrame.HLine) self.line_2.setFrameShadow(QtGui.QFrame.Sunken) self.line_2.setObjectName(_fromUtf8("line_2")) self.verticalLayout_17.addWidget(self.line_2) self.verticalLayout_16 = QtGui.QVBoxLayout() self.verticalLayout_16.setObjectName(_fromUtf8("verticalLayout_16")) self.horizontalLayout_31 = QtGui.QHBoxLayout() self.horizontalLayout_31.setObjectName(_fromUtf8("horizontalLayout_31")) self.groupBox_10 = QtGui.QGroupBox(self.groupBox_3) self.groupBox_10.setTitle(QtGui.QApplication.translate("WizardPage", "Controller Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_10.setObjectName(_fromUtf8("groupBox_10")) self.verticalLayout_14 = QtGui.QVBoxLayout(self.groupBox_10) self.verticalLayout_14.setObjectName(_fromUtf8("verticalLayout_14")) self.verticalLayout_5 = QtGui.QVBoxLayout() self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.horizontalLayout_24 = QtGui.QHBoxLayout() self.horizontalLayout_24.setObjectName(_fromUtf8("horizontalLayout_24")) self.label_46 = QtGui.QLabel(self.groupBox_10) self.label_46.setText(QtGui.QApplication.translate("WizardPage", "Controller Type:", None, QtGui.QApplication.UnicodeUTF8)) self.label_46.setObjectName(_fromUtf8("label_46")) self.horizontalLayout_24.addWidget(self.label_46) self.controller = QtGui.QLabel(self.groupBox_10) self.controller.setText(QtGui.QApplication.translate("WizardPage", "RAMPS", None, QtGui.QApplication.UnicodeUTF8)) self.controller.setObjectName(_fromUtf8("controller")) self.horizontalLayout_24.addWidget(self.controller) self.verticalLayout_5.addLayout(self.horizontalLayout_24) self.horizontalLayout_30 = QtGui.QHBoxLayout() self.horizontalLayout_30.setObjectName(_fromUtf8("horizontalLayout_30")) self.label_48 = QtGui.QLabel(self.groupBox_10) self.label_48.setText(QtGui.QApplication.translate("WizardPage", "COM Port:", None, QtGui.QApplication.UnicodeUTF8)) self.label_48.setObjectName(_fromUtf8("label_48")) self.horizontalLayout_30.addWidget(self.label_48) self.port = QtGui.QLabel(self.groupBox_10) self.port.setText(QtGui.QApplication.translate("WizardPage", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.port.setObjectName(_fromUtf8("port")) self.horizontalLayout_30.addWidget(self.port) self.verticalLayout_5.addLayout(self.horizontalLayout_30) self.verticalLayout_14.addLayout(self.verticalLayout_5) self.horizontalLayout_31.addWidget(self.groupBox_10) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_31.addItem(spacerItem4) self.verticalLayout_16.addLayout(self.horizontalLayout_31) self.groupBox_7 = QtGui.QGroupBox(self.groupBox_3) self.groupBox_7.setTitle(QtGui.QApplication.translate("WizardPage", "Hardware Settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_7.setObjectName(_fromUtf8("groupBox_7")) self.horizontalLayout_3 = QtGui.QHBoxLayout(self.groupBox_7) self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.horizontalLayout_22 = QtGui.QHBoxLayout() self.horizontalLayout_22.setObjectName(_fromUtf8("horizontalLayout_22")) self.label_6 = QtGui.QLabel(self.groupBox_7) self.label_6.setText(QtGui.QApplication.translate("WizardPage", "Z Axis Leadscrew Pitch:", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setObjectName(_fromUtf8("label_6")) self.horizontalLayout_22.addWidget(self.label_6) self.pitchZ = QtGui.QLabel(self.groupBox_7) self.pitchZ.setText(QtGui.QApplication.translate("WizardPage", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.pitchZ.setObjectName(_fromUtf8("pitchZ")) self.horizontalLayout_22.addWidget(self.pitchZ) self.label_7 = QtGui.QLabel(self.groupBox_7) self.label_7.setText(QtGui.QApplication.translate("WizardPage", "mm/rev", None, QtGui.QApplication.UnicodeUTF8)) self.label_7.setObjectName(_fromUtf8("label_7")) self.horizontalLayout_22.addWidget(self.label_7) spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_22.addItem(spacerItem5) self.verticalLayout_2.addLayout(self.horizontalLayout_22) self.horizontalLayout_23 = QtGui.QHBoxLayout() self.horizontalLayout_23.setObjectName(_fromUtf8("horizontalLayout_23")) self.label_8 = QtGui.QLabel(self.groupBox_7) self.label_8.setText(QtGui.QApplication.translate("WizardPage", "Z Axis Steps/rev:", None, QtGui.QApplication.UnicodeUTF8)) self.label_8.setObjectName(_fromUtf8("label_8")) self.horizontalLayout_23.addWidget(self.label_8) self.stepsPerRevZ = QtGui.QLabel(self.groupBox_7) self.stepsPerRevZ.setText(QtGui.QApplication.translate("WizardPage", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.stepsPerRevZ.setObjectName(_fromUtf8("stepsPerRevZ")) self.horizontalLayout_23.addWidget(self.stepsPerRevZ) self.label_9 = QtGui.QLabel(self.groupBox_7) self.label_9.setText(QtGui.QApplication.translate("WizardPage", "steps", None, QtGui.QApplication.UnicodeUTF8)) self.label_9.setObjectName(_fromUtf8("label_9")) self.horizontalLayout_23.addWidget(self.label_9) spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_23.addItem(spacerItem6) self.verticalLayout_2.addLayout(self.horizontalLayout_23) self.horizontalLayout_34 = QtGui.QHBoxLayout() self.horizontalLayout_34.setObjectName(_fromUtf8("horizontalLayout_34")) self.label_53 = QtGui.QLabel(self.groupBox_7) self.label_53.setText(QtGui.QApplication.translate("WizardPage", "Stepping Mode:", None, QtGui.QApplication.UnicodeUTF8)) self.label_53.setObjectName(_fromUtf8("label_53")) self.horizontalLayout_34.addWidget(self.label_53) self.steppingMode = QtGui.QLabel(self.groupBox_7) self.steppingMode.setText(QtGui.QApplication.translate("WizardPage", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.steppingMode.setObjectName(_fromUtf8("steppingMode")) self.horizontalLayout_34.addWidget(self.steppingMode) spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_34.addItem(spacerItem7) self.verticalLayout_2.addLayout(self.horizontalLayout_34) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) self.label_10 = QtGui.QLabel(self.groupBox_7) self.label_10.setText(QtGui.QApplication.translate("WizardPage", "Layer Thickness:", None, QtGui.QApplication.UnicodeUTF8)) self.label_10.setObjectName(_fromUtf8("label_10")) self.horizontalLayout_9.addWidget(self.label_10) self.layerThickness = QtGui.QLabel(self.groupBox_7) self.layerThickness.setText(QtGui.QApplication.translate("WizardPage", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.layerThickness.setObjectName(_fromUtf8("layerThickness")) self.horizontalLayout_9.addWidget(self.layerThickness) self.label_13 = QtGui.QLabel(self.groupBox_7) self.label_13.setText(QtGui.QApplication.translate("WizardPage", "um", None, QtGui.QApplication.UnicodeUTF8)) self.label_13.setObjectName(_fromUtf8("label_13")) self.horizontalLayout_9.addWidget(self.label_13) spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem8) self.verticalLayout_2.addLayout(self.horizontalLayout_9) self.horizontalLayout_10 = QtGui.QHBoxLayout() self.horizontalLayout_10.setObjectName(_fromUtf8("horizontalLayout_10")) self.label_11 = QtGui.QLabel(self.groupBox_7) self.label_11.setText(QtGui.QApplication.translate("WizardPage", "Projector Resolution (pixels):", None, QtGui.QApplication.UnicodeUTF8)) self.label_11.setObjectName(_fromUtf8("label_11")) self.horizontalLayout_10.addWidget(self.label_11) self.resolutionX = QtGui.QLabel(self.groupBox_7) self.resolutionX.setText(QtGui.QApplication.translate("WizardPage", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.resolutionX.setObjectName(_fromUtf8("resolutionX")) self.horizontalLayout_10.addWidget(self.resolutionX) self.label_12 = QtGui.QLabel(self.groupBox_7) self.label_12.setText(QtGui.QApplication.translate("WizardPage", "x", None, QtGui.QApplication.UnicodeUTF8)) self.label_12.setObjectName(_fromUtf8("label_12")) self.horizontalLayout_10.addWidget(self.label_12) self.resolutionY = QtGui.QLabel(self.groupBox_7) self.resolutionY.setText(QtGui.QApplication.translate("WizardPage", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.resolutionY.setObjectName(_fromUtf8("resolutionY")) self.horizontalLayout_10.addWidget(self.resolutionY) spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_10.addItem(spacerItem9) self.verticalLayout_2.addLayout(self.horizontalLayout_10) self.horizontalLayout_11 = QtGui.QHBoxLayout() self.horizontalLayout_11.setObjectName(_fromUtf8("horizontalLayout_11")) self.label_14 = QtGui.QLabel(self.groupBox_7) self.label_14.setText(QtGui.QApplication.translate("WizardPage", "Build Area Size (mm):", None, QtGui.QApplication.UnicodeUTF8)) self.label_14.setObjectName(_fromUtf8("label_14")) self.horizontalLayout_11.addWidget(self.label_14) self.buildAreaX = QtGui.QLabel(self.groupBox_7) self.buildAreaX.setText(QtGui.QApplication.translate("WizardPage", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.buildAreaX.setObjectName(_fromUtf8("buildAreaX")) self.horizontalLayout_11.addWidget(self.buildAreaX) self.label_15 = QtGui.QLabel(self.groupBox_7) self.label_15.setText(QtGui.QApplication.translate("WizardPage", "x", None, QtGui.QApplication.UnicodeUTF8)) self.label_15.setObjectName(_fromUtf8("label_15")) self.horizontalLayout_11.addWidget(self.label_15) self.buildAreaY = QtGui.QLabel(self.groupBox_7) self.buildAreaY.setText(QtGui.QApplication.translate("WizardPage", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.buildAreaY.setObjectName(_fromUtf8("buildAreaY")) self.horizontalLayout_11.addWidget(self.buildAreaY) spacerItem10 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_11.addItem(spacerItem10) self.verticalLayout_2.addLayout(self.horizontalLayout_11) self.horizontalLayout_12 = QtGui.QHBoxLayout() self.horizontalLayout_12.setObjectName(_fromUtf8("horizontalLayout_12")) self.label_16 = QtGui.QLabel(self.groupBox_7) self.label_16.setText(QtGui.QApplication.translate("WizardPage", "Pixel Size (um):", None, QtGui.QApplication.UnicodeUTF8)) self.label_16.setObjectName(_fromUtf8("label_16")) self.horizontalLayout_12.addWidget(self.label_16) self.pixelSizeX = QtGui.QLabel(self.groupBox_7) self.pixelSizeX.setText(QtGui.QApplication.translate("WizardPage", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.pixelSizeX.setObjectName(_fromUtf8("pixelSizeX")) self.horizontalLayout_12.addWidget(self.pixelSizeX) self.label_17 = QtGui.QLabel(self.groupBox_7) self.label_17.setText(QtGui.QApplication.translate("WizardPage", "x", None, QtGui.QApplication.UnicodeUTF8)) self.label_17.setObjectName(_fromUtf8("label_17")) self.horizontalLayout_12.addWidget(self.label_17) self.pixelSizeY = QtGui.QLabel(self.groupBox_7) self.pixelSizeY.setText(QtGui.QApplication.translate("WizardPage", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.pixelSizeY.setObjectName(_fromUtf8("pixelSizeY")) self.horizontalLayout_12.addWidget(self.pixelSizeY) spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_12.addItem(spacerItem11) self.verticalLayout_2.addLayout(self.horizontalLayout_12) spacerItem12 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem12) self.horizontalLayout_3.addLayout(self.verticalLayout_2) self.verticalLayout_16.addWidget(self.groupBox_7) self.verticalLayout_17.addLayout(self.verticalLayout_16) spacerItem13 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_17.addItem(spacerItem13) self.verticalLayout_3.addWidget(self.groupBox_3) self.horizontalLayout.addLayout(self.verticalLayout_3) QtCore.QObject.connect(self.comboBox, QtCore.SIGNAL(_fromUtf8("currentIndexChanged(int)")), self.ProfileChanged) QtCore.QObject.connect(self.toolButton, QtCore.SIGNAL(_fromUtf8("pressed()")), self.CreateNewProfile) QtCore.QMetaObject.connectSlotsByName(self) self.controller.setText("") self.port.setText("") self.pitchZ.setText("") self.stepsPerRevZ.setText("") self.steppingMode.setText("") self.layerThickness.setText("") self.resolutionX.setText("") self.resolutionY.setText("") self.buildAreaX.setText("") self.buildAreaY.setText("") self.pixelSizeX.setText("") self.pixelSizeY.setText("") def getController(self, dialog): if dialog.radio_ramps.isChecked(): return "RAMPS" elif dialog.radio_arduinoUno.isChecked(): return "ARDUINOUNO" elif dialog.radio_arduinoMega.isChecked(): return "ARDUINOMEGA" elif dialog.radio_pyMCU.isChecked(): return "PYMCU" def getSteppingMode(self, dialog): if dialog.fullStep.isChecked(): return "FULL" elif dialog.halfStep.isChecked(): return "HALF" elif dialog.quarterStep.isChecked(): return "QUARTER" elif dialog.eighthStep.isChecked(): return "EIGHTH" elif dialog.sixteenthStep.isChecked(): return "SIXTEENTH" def CreateNewProfile(self): profile = hardwareProfile() dialog = NewHardwareProfileDialog(self, self.parent) dialog.exec_() profile.name = dialog.name.text() profile.description = dialog.description.text() profile.notes = dialog.notes.toPlainText() profile.controller = self.getController(dialog) profile.port = dialog.pickcom.currentText() profile.leadscrewPitchZ = dialog.pitchZ.text() profile.stepsPerRevZ = dialog.stepsPerRevZ.text() profile.steppingMode = self.getSteppingMode(dialog) profile.layerThickness = dialog.layerThickness.text() profile.projectorResolution = (dialog.projectorResolutionX.text(), dialog.projectorResolutionY.text()) profile.buildAreaSize = (dialog.buildAreaX.text(), dialog.buildAreaY.text()) profile.pixelSize = (dialog.pixelSizeX.text(), dialog.pixelSizeY.text()) self.parent.hardwareProfiles.append(profile) #update drop down list with new profile and select it self.comboBox.addItem(profile.name) self.comboBox.setCurrentIndex(0) def ProfileChanged(self): for object in self.parent.hardwareProfiles: if str(self.comboBox.currentText()) == object.name: self.name.setText(str(object.name)) self.description.setText(str(object.description)) self.notes.setText(str(object.notes)) self.controller.setText(str(object.controller)) self.port.setText(str(object.port)) self.pitchZ.setText(str(object.leadscrewPitchZ)) self.stepsPerRevZ.setText(str(object.stepsPerRevZ)) self.steppingMode.setText(str(object.steppingMode)) self.layerThickness.setText(str(object.layerThickness)) self.resolutionX.setText(str(object.projectorResolution[0])) self.resolutionY.setText(str(object.projectorResolution[1])) self.buildAreaX.setText(str(object.buildAreaSize[1])) self.buildAreaY.setText(str(object.buildAreaSize[1])) self.pixelSizeX.setText(str(object.pixelSize[0])) self.pixelSizeY.setText(str(object.pixelSize[1])) def initializePage(self): for item in self.parent.hardwareProfiles: self.comboBox.addItem(item.name) def validatePage(self): for object in self.parent.hardwareProfiles: if object.name == str(self.name.text()): self.parent.printJob.hardwareProfile = object return True #######################GUI class and event handling############################# class OpenAbout(QtGui.QDialog, Ui_Dialog): def __init__(self,parent=None): QtGui.QDialog.__init__(self,parent) self.setupUi(self) class Main(QtGui.QMainWindow): def resizeEvent(self,Event): if self.ui.workspacePre.isVisible(): self.ModelViewPre.resize(self.ui.modelFramePre.geometry().width()-16,self.ui.modelFramePre.geometry().height()-30) elif self.ui.workspacePost.isVisible(): self.ModelViewPost.resize(self.ui.modelFramePost.geometry().width()-16,self.ui.modelFramePost.geometry().height()-30) self.slicepreview.resize(self.ui.sliceFramePost.geometry().width(), self.ui.sliceFramePost.geometry().height()) self.pmscaled = self.pm.scaled(self.ui.sliceFramePost.geometry().width(), self.ui.sliceFramePost.geometry().height(), QtCore.Qt.KeepAspectRatio) self.slicepreview.setPixmap(self.pmscaled) def closeEvent(self, event): reply = QtGui.QMessageBox.question(self, "Quit", "Are you sure you want to quit?", QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if reply == QtGui.QMessageBox.Yes: event.accept() else: event.ignore() def __init__(self): QtGui.QMainWindow.__init__(self) self.ui=Ui_MainWindow() self.ui.setupUi(self) self.setWindowTitle(QtGui.QApplication.translate("MainWindow", "3DLP Host", None, QtGui.QApplication.UnicodeUTF8)) self.pm = QtGui.QPixmap(':/blank/10x10black.png') #add toolbar labels label = QtGui.QLabel(" Current Layer: ") self.ui.toolBar_3.addWidget(label) self.layercount = QtGui.QLabel("0 of 0") self.ui.toolBar_3.addWidget(self.layercount) self.cwd = os.getcwd() #get current execution (working) directory # Install the custom output stream sys.stdout = EmittingStream(textWritten=self.normalOutputWritten) self.screencount = QtGui.QDesktopWidget().numScreens() print "number of monitors: ", self.screencount self.ports = comscan.comscan() #returns a list with each entry being a dict of useful information print self.ports self.numports = len(self.ports) #how many dicts did comscan return? #print "Found %d ports, %d available." %(self.numports, numports) self.parser = SafeConfigParser() ##to make sure it can find the config.ini file originally bundled with the .exe by Pyinstaller filename = 'config.ini' if hasattr(sys, '_MEIPASS'): # PyInstaller >= 1.6 os.chdir(sys._MEIPASS) filename = os.path.join(sys._MEIPASS, filename) APPNAME = '3DLP' APPDATA = os.path.join(os.environ['APPDATA'], APPNAME) if not os.path.isdir(os.path.join(APPDATA)): os.mkdir(os.path.join(APPDATA)) shutil.copy(filename, os.path.join(APPDATA, '')) self.parser.read(os.path.join(APPDATA, 'config.ini')) self.LoadSettingsFromConfigFile() else: if not os.path.isfile(os.path.join(APPDATA, 'config.ini')): shutil.copy(filename, os.path.join(APPDATA)) else: self.parser.read(os.path.join(APPDATA, 'config.ini')) self.LoadSettingsFromConfigFile() else: #otherwise it's running in pydev environment: use the dev config file os.chdir(os.path.dirname(sys.argv[0])) filename = os.path.join(os.path.dirname(sys.argv[0]), filename) self.parser.read('config.ini') self.LoadSettingsFromConfigFile() self.modelList = [] self.step = "" self.hardwareProfiles = [] self.resinProfiles = [] self.layerProfiles = [] #load stored hardware presets, if any filename = 'hardwareProfiles.p' if hasattr(sys, '_MEIPASS'): # PyInstaller >= 1.6 os.chdir(sys._MEIPASS) filename = os.path.join(sys._MEIPASS, filename) APPNAME = '3DLP' APPDATA = os.path.join(os.environ['APPDATA'], APPNAME) if not os.path.isfile(os.path.join(APPDATA, 'hardwareProfiles.p')): pass else: self.hardwareProfiles = pickle.load(open(os.path.join(APPDATA, 'hardwareProfiles.p'), "rb")) else: #otherwise it's running in pydev environment: use the dev config file os.chdir(os.path.dirname(sys.argv[0])) filename = os.path.join(os.path.dirname(sys.argv[0]), filename) if not os.path.isfile(filename): pass else: self.hardwareProfiles = pickle.load(open(filename, "rb")) #load stored resin presets, if any filename = 'resinProfiles.p' if hasattr(sys, '_MEIPASS'): # PyInstaller >= 1.6 os.chdir(sys._MEIPASS) filename = os.path.join(sys._MEIPASS, filename) APPNAME = '3DLP' APPDATA = os.path.join(os.environ['APPDATA'], APPNAME) if not os.path.isfile(os.path.join(APPDATA, 'resinProfiles.p')): pass else: self.resinProfiles = pickle.load(open(os.path.join(APPDATA, 'resinProfiles.p'), "rb")) else: #otherwise it's running in pydev environment: use the dev config file os.chdir(os.path.dirname(sys.argv[0])) filename = os.path.join(os.path.dirname(sys.argv[0]), filename) if not os.path.isfile(filename): pass else: self.resinProfiles = pickle.load(open(filename, "rb")) #load stored layer presets, if any filename = 'layerProfiles.p' if hasattr(sys, '_MEIPASS'): # PyInstaller >= 1.6 os.chdir(sys._MEIPASS) filename = os.path.join(sys._MEIPASS, filename) APPNAME = '3DLP' APPDATA = os.path.join(os.environ['APPDATA'], APPNAME) if not os.path.isfile(os.path.join(APPDATA, 'layerProfiles.p')): pass else: self.layerProfiles = pickle.load(open(os.path.join(APPDATA, 'layerProfiles.p'), "rb")) else: #otherwise it's running in pydev environment: use the dev config file os.chdir(os.path.dirname(sys.argv[0])) filename = os.path.join(os.path.dirname(sys.argv[0]), filename) if not os.path.isfile(filename): pass else: self.layerProfiles = pickle.load(open(filename, "rb")) ####pre-slice setup self.renPre = vtk.vtkRenderer() self.renPre.SetBackground(.4,.4,.4) self.ModelViewPre = QVTKRenderWindowInteractor(self.ui.modelFramePre) self.ModelViewPre.SetInteractorStyle(MyInteractorStyle()) self.ModelViewPre.Initialize() self.ModelViewPre.Start() self.renWinPre=self.ModelViewPre.GetRenderWindow() self.renWinPre.AddRenderer(self.renPre) ###post-slice setup self.renPost = vtk.vtkRenderer() self.renPost.SetBackground(.4,.4,.4) self.ModelViewPost = QVTKRenderWindowInteractor(self.ui.modelFramePost) self.ModelViewPost.SetInteractorStyle(MyInteractorStyle()) self.ModelViewPost.Initialize() self.ModelViewPost.Start() self.renWin=self.ModelViewPost.GetRenderWindow() self.renWin.AddRenderer(self.renPost) self.slicepreview = QtGui.QLabel(self.ui.sliceFramePost) filename = '10x10black.png' if hasattr(sys, '_MEIPASS'): # PyInstaller >= 1.6 os.chdir(sys._MEIPASS) filename = os.path.join(sys._MEIPASS, filename) else: #otherwise it's running in pydev environment: use the 10x10black.png file in the dev folder os.chdir(os.path.dirname(sys.argv[0])) filename = os.path.join(os.path.dirname(sys.argv[0]), filename) pm = QtGui.QPixmap(filename) pmscaled = pm.scaled(400, 600) self.slicepreview.setPixmap(pmscaled) #set black pixmap for blank slide #this is needed here to resize after the window is created to fill frames self.slicepreview.resize(self.ui.frame_2.geometry().width(), self.ui.frame_2.geometry().height()) self.pmscaled = self.pm.scaled(self.ui.frame_2.geometry().width(), self.ui.frame_2.geometry().height(), QtCore.Qt.KeepAspectRatio) self.slicepreview.setPixmap(self.pmscaled) ######## self.ChangeWorkspacePreSlice() self.printJob = None def __del__(self): # Restore sys.stdout sys.stdout = sys.__stdout__ #save hardware presets, if any filename = 'hardwareProfiles.p' if hasattr(sys, '_MEIPASS'): # PyInstaller >= 1.6 os.chdir(sys._MEIPASS) filename = os.path.join(sys._MEIPASS, filename) APPNAME = '3DLP' APPDATA = os.path.join(os.environ['APPDATA'], APPNAME) pickle.dump(self.hardwareProfiles, open(os.path.join(APPDATA, 'hardwareProfiles.p'), os.O_CREAT, "wb")) else: #otherwise it's running in pydev environment: use the dev config file os.chdir(os.path.dirname(sys.argv[0])) filename = os.path.join(os.path.dirname(sys.argv[0]), filename) pickle.dump(self.hardwareProfiles, open(filename, "wb")) #save resin presets, if any filename = 'resinProfiles.p' if hasattr(sys, '_MEIPASS'): # PyInstaller >= 1.6 os.chdir(sys._MEIPASS) filename = os.path.join(sys._MEIPASS, filename) APPNAME = '3DLP' APPDATA = os.path.join(os.environ['APPDATA'], APPNAME) pickle.dump(self.resinProfiles, open(os.path.join(APPDATA, 'resinProfiles.p'), os.O_CREAT, "wb")) else: #otherwise it's running in pydev environment: use the dev config file os.chdir(os.path.dirname(sys.argv[0])) filename = os.path.join(os.path.dirname(sys.argv[0]), filename) pickle.dump(self.resinProfiles, open(filename, "wb")) #save layer presets, if any filename = 'layerProfiles.p' if hasattr(sys, '_MEIPASS'): # PyInstaller >= 1.6 os.chdir(sys._MEIPASS) filename = os.path.join(sys._MEIPASS, filename) APPNAME = '3DLP' APPDATA = os.path.join(os.environ['APPDATA'], APPNAME) pickle.dump(self.layerProfiles, open(os.path.join(APPDATA, 'layerProfiles.p'), os.O_CREAT, "wb")) else: #otherwise it's running in pydev environment: use the dev config file os.chdir(os.path.dirname(sys.argv[0])) filename = os.path.join(os.path.dirname(sys.argv[0]), filename) pickle.dump(self.layerProfiles, open(filename, "wb")) if hasattr(self, 'printer'): self.printer.close() #close serial connection to printer if open self.renPre.GetRenderWindow().Finalize() self.renPost.GetRenderWindow().Finalize() def normalOutputWritten(self, text): """Append text to the QTextEdit.""" # Maybe QTextEdit.append() works as well, but this is how I do it: cursor = self.ui.consoletext.textCursor() cursor.movePosition(QtGui.QTextCursor.End) cursor.insertText(text) self.ui.consoletext.setTextCursor(cursor) self.ui.consoletext.ensureCursorVisible() def ChangeWorkspacePreSlice(self): if self.ui.workspacePost.isVisible(): response = QtGui.QMessageBox.information(self, 'Changing to Pre-slicing mode',"""By changing to pre-slicing mode you will have to re-slice later. Would you like to continue and re-enter pre-slice mode?""", QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if response == QtGui.QMessageBox.Yes: pass elif response == QtGui.QMessageBox.No: self.ui.actionPreSlice.setChecked(False) return self.ui.preSliceBar.show() self.ui.sliceListBar.hide() self.ui.printJobInfoBar.hide() self.ui.workspacePost.hide() self.ui.workspacePre.show() self.ModelViewPre.show() self.ModelViewPre.resize(self.ui.modelFramePre.geometry().width(), self.ui.modelFramePre.geometry().height()) self.ui.actionPreSlice.setChecked(True) self.ui.actionPostSlice.setChecked(False) def ChangeWorkspacePostSlice(self): if self.ui.workspacePre.isVisible(): response = QtGui.QMessageBox.information(self, 'Changing to Post-slicing mode',"""You must first slice a model before you can view it in post-slice mode. Would you like to slice what is currently in the pre-slice view now?""", QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if response == QtGui.QMessageBox.Yes: self.SliceModel() self.EnterPostSliceMode("test") elif response == QtGui.QMessageBox.No: self.ui.actionPostSlice.setChecked(False) return self.ui.preSliceBar.hide() self.ui.sliceListBar.show() self.ui.printJobInfoBar.show() self.ui.workspacePost.show() self.ui.workspacePre.hide() self.ModelViewPost.show() self.ModelViewPost.resize(self.ui.modelFramePost.geometry().width(), self.ui.modelFramePost.geometry().height()) self.slicepreview.resize(self.ui.sliceFramePost.geometry().width(), self.ui.sliceFramePost.geometry().height()) self.pmscaled = self.pm.scaled(self.ui.sliceFramePost.geometry().width(), self.ui.sliceFramePost.geometry().height(), QtCore.Qt.KeepAspectRatio) self.slicepreview.setPixmap(self.pmscaled) self.ui.actionPreSlice.setChecked(False) self.ui.actionPostSlice.setChecked(True) def getController(self, dialog): if dialog.radio_ramps.isChecked(): return "RAMPS" elif dialog.radio_arduinoUno.isChecked(): return "ARDUINOUNO" elif dialog.radio_arduinoMega.isChecked(): return "ARDUINOMEGA" elif dialog.radio_pyMCU.isChecked(): return "PYMCU" def getSteppingMode(self, dialog): if dialog.fullStep.isChecked(): return "FULL" elif dialog.halfStep.isChecked(): return "HALF" elif dialog.quarterStep.isChecked(): return "QUARTER" elif dialog.eighthStep.isChecked(): return "EIGHTH" elif dialog.sixteenthStep.isChecked(): return "SIXTEENTH" def CreateNewHardwareProfile(self): profile = hardwareProfile() dialog = NewHardwareProfileDialog(self, self) dialog.exec_() profile.name = dialog.name.text() profile.description = dialog.description.text() profile.notes = dialog.notes.toPlainText() profile.controller = self.getController(dialog) profile.port = dialog.pickcom.currentText() profile.leadscrewPitchZ = dialog.pitchZ.text() profile.stepsPerRevZ = dialog.stepsPerRevZ.text() profile.steppingMode = self.getSteppingMode(dialog) profile.layerThickness = dialog.layerThickness.text() profile.projectorResolution = (dialog.projectorResolutionX.text(), dialog.projectorResolutionY.text()) profile.buildAreaSize = (dialog.buildAreaX.text(), dialog.buildAreaY.text()) profile.pixelSize = (dialog.pixelSizeX.text(), dialog.pixelSizeY.text()) self.hardwareProfiles.append(profile) def CreateNewResinProfile(self): profile = resinProfile() dialog = NewResinProfileDialog(self, self) dialog.exec_() profile.name = dialog.name.text() profile.density = dialog.density.text() profile.cost = dialog.cost.text() profile.curingEnergy = dialog.curingEnergy.text() self.resinProfiles.append(profile) def NewPrintJob(self): self.printJob = _3dlpfile() wizard = QtGui.QWizard(self) wizard.addPage(wizardNewGeneral(wizard, self)) wizard.addPage(wizardNewHardware(wizard, self)) wizard.resize(640, 480) wizard.setWizardStyle(QtGui.QWizard.ModernStyle) wizard.WizardOption(QtGui.QWizard.IndependentPages) wizard.exec_() outfile = str(QFileDialog.getSaveFileName(self, "Save 3DLP Print Job file", "", ".3dlp")) self.SavePrintJobAs(outfile) def SavePrintJobAs(self, filename): os.chdir(os.path.split(str(filename))[0]) #change to base dir of the selected filename self.zfile = zipfile.ZipFile(os.path.split(str(filename))[1], 'w') if self.step == "": self.SaveConfig() elif self.step == "pre": self.SaveConfig() self.SavePreSliceLayout() elif self.step == "post": self.SaveConfig() self.SavePreSliceLayout() self.SavePostSlice() def SavePreSliceLayout(self): objectTransformMatricies = [] for object in self.modelList: objectTransformMatricies.append((object.transform.GetMatrix(), object.transform.GetOrientation(), object.transform.GetPosition(), object.transform.GetScale())) self.zfile.write(str(object.filename), arcname = os.path.split(str(object.filename))[1]) stringio = StringIO.StringIO() pickle.dump(objectTransformMatricies, stringio) self.zfile.writestr("matricies.p", stringio.getvalue()) def SavePostSlice(self): pass def SaveConfig(self): #print job object #hardware profiles # Config = ConfigParser() # Config.add_section('print_settings') # Config.set('print_settings', 'layer_thickness', self.layerincrement) # Config.add_section('preview_settings') # base, file = os.path.split(str(self.filename)) #can't be QString # Config.set('preview_settings', 'STL_name', file) # stringio = StringIO.StringIO() # Config.write(stringio) # self.zfile.writestr("printconfiguration.ini", stringio.getvalue())#arcname = "printconfiguration.ini") stringio2 = StringIO.StringIO() pickle.dump(self.sliceCorrelations, stringio2) self.zfile.writestr("slices.p", stringio2.getvalue()) #pickle and save the layer-plane correlations self.zfile.write(str(self.filename), arcname = file) self.zfile.close() def SavePrintJob(self): pass def OpenPrintJob(self): self._3dlpfile = zipfile.ZipFile(str(QtGui.QFileDialog.getOpenFileName(self, 'Open 3DLP Print Job', '.', '*.3dlp'))) self.FileList = [] for file in self._3dlpfile.namelist(): if file.startswith("/slices/") and file.endswith(".png"): #if it's a supported image type in the slices directory temp = tempfile.SpooledTemporaryFile() temp.write(self._3dlpfile.read(file)) temp.seek(0) self.FileList.append(temp) print self.FileList if len(self.FileList)<1: print "no valid slice images were found" return if not "printconfiguration.ini" in self._3dlpfile.namelist(): print "no print configuration file was found" return try: self.printconfigparser = SafeConfigParser() ini = self._3dlpfile.open("printconfiguration.ini") string = StringIO.StringIO(ini.read()) self.printconfigparser.readfp(string) except: print "unknown error encountered while trying to parse print configuration file" return #extract model for opening - can't open it from memory unfortunately :( temp = tempfile.NamedTemporaryFile() self._3dlpfile.extract((self.printconfigparser.get('preview_settings', 'STL_name')), os.getcwd()) self.OpenModel(self.printconfigparser.get('preview_settings', 'STL_name')) if not "slices.p" in self._3dlpfile.namelist(): print "Error loading slices.p" QtGui.QMessageBox.information(self, 'Error loading preview correlations',"Error finding or loading slices.p. You will not be able to preview slices in real-time within the 3D model.", QtGui.QMessageBox.Ok) self.preview = False else: p = self._3dlpfile.read("slices.p") string = StringIO.StringIO(p) self.sliceCorrelations = pickle.load(string) print self.sliceCorrelations self.preview = True self.currentlayer = 1 self.numberOfLayers = len(self.FileList) self.layercount.setText(str(self.currentlayer) + " of " + str(len(self.FileList))) self.pm = QtGui.QPixmap() #remember to compensate for 0-index self.pm.loadFromData(self.FileList[self.currentlayer-1].read()) self.pmscaled = self.pm.scaled(self.ui.frame_2.geometry().width(), self.ui.frame_2.geometry().height(), QtCore.Qt.KeepAspectRatio) self.slicepreview.setPixmap(self.pmscaled) self.UpdateModelLayer(self.sliceCorrelations[self.currentlayer-1][1]) QApplication.processEvents() #make sure the toolbar gets updated with new text self.slicepreview.resize(self.ui.frame_2.geometry().width(), self.ui.frame_2.geometry().height()) def AddModel(self): self.step = "pre" filename = QtGui.QFileDialog.getOpenFileName(self, 'Open 3D Model', '.', '*.stl') if filename == '': #user hit cancel return modelObject = model(self, filename) self.modelList.append(modelObject) self.ui.modelList.addItem(os.path.basename(str(filename))) if len(self.modelList) == 1: self.FirstOpen() self.renPre.ResetCamera() self.ModelViewPre.Render() #update model view def FirstOpen(self): #create annotated cube anchor actor self.axesActor = vtk.vtkAnnotatedCubeActor(); self.axesActor.SetXPlusFaceText('Right') self.axesActor.SetXMinusFaceText('Left') self.axesActor.SetYMinusFaceText('Front') self.axesActor.SetYPlusFaceText('Back') self.axesActor.SetZMinusFaceText('Bot') self.axesActor.SetZPlusFaceText('Top') self.axesActor.GetTextEdgesProperty().SetColor(.8,.8,.8) self.axesActor.GetZPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetZMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetXPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetXMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetYPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetYMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetTextEdgesProperty().SetLineWidth(2) self.axesActor.GetCubeProperty().SetColor(.2,.2,.2) self.axesActor.SetFaceTextScale(0.25) self.axesActor.SetZFaceTextRotation(90) #create orientation markers self.axes = vtk.vtkOrientationMarkerWidget() self.axes.SetOrientationMarker(self.axesActor) self.axes.SetInteractor(self.ModelViewPre) self.axes.EnabledOn() self.axes.InteractiveOff() self.ui.Transform_groupbox.setEnabled(True) def EnterPostSliceMode(self, filename): self.ModelViewPost.resize(self.ui.modelFramePost.geometry().width()-16,self.ui.modelFramePost.geometry().height()-30) #just in case resizeEvent() hasn't been called yet self.filename = filename self.reader = vtk.vtkSTLReader() self.reader.SetFileName(filename) self.polyDataOutput = self.reader.GetOutput() self.mapper = vtk.vtkPolyDataMapper() self.mapper.SetInputConnection(self.reader.GetOutputPort()) #create model actor self.modelActor = vtk.vtkActor() self.modelActor.GetProperty().SetColor(0,.8,0) self.modelActor.GetProperty().SetOpacity(1) self.modelActor.SetMapper(self.mapper) #create a plane to cut,here it cuts in the XZ direction (xz normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0) self.slicingplane=vtk.vtkPlane() self.slicingplane.SetOrigin(0,0,20) self.slicingplane.SetNormal(0,0,1) #create cutter self.cutter=vtk.vtkCutter() self.cutter.SetCutFunction(self.slicingplane) self.cutter.SetInputConnection(self.reader.GetOutputPort()) self.cutter.Update() self.FeatureEdges = vtk.vtkFeatureEdges() self.FeatureEdges.SetInputConnection(self.cutter.GetOutputPort()) self.FeatureEdges.BoundaryEdgesOn() self.FeatureEdges.FeatureEdgesOff() self.FeatureEdges.NonManifoldEdgesOff() self.FeatureEdges.ManifoldEdgesOff() self.FeatureEdges.Update() self.cutStrips = vtk.vtkStripper() #Forms loops (closed polylines) from cutter self.cutStrips.SetInputConnection(self.cutter.GetOutputPort()) self.cutStrips.Update() self.cutPoly = vtk.vtkPolyData() #This trick defines polygons as polyline loop self.cutPoly.SetPoints((self.cutStrips.GetOutput()).GetPoints()) self.cutPoly.SetPolys((self.cutStrips.GetOutput()).GetLines()) self.cutPoly.Update() # Triangle filter self.cutTriangles = vtk.vtkTriangleFilter() self.cutTriangles.SetInput(self.cutPoly) self.cutTriangles.Update() #cutter mapper self.cutterMapper=vtk.vtkPolyDataMapper() self.cutterMapper.SetInput(self.cutPoly) self.cutterMapper.SetInputConnection(self.cutTriangles.GetOutputPort()) self.cutterOutlineMapper=vtk.vtkPolyDataMapper() self.cutterOutlineMapper.SetInputConnection(self.cutter.GetOutputPort()) # #create plane actor self.slicingplaneActor=vtk.vtkActor() self.slicingplaneActor.GetProperty().SetColor(1.0,1.0,1.0) self.slicingplaneActor.GetProperty().SetLineWidth(4) self.slicingplaneActor.SetMapper(self.cutterMapper) # #create plane actor self.slicingplaneoutlineActor=vtk.vtkActor() self.slicingplaneoutlineActor.GetProperty().SetColor(1.0,0,0) self.slicingplaneoutlineActor.GetProperty().SetLineWidth(4) self.slicingplaneoutlineActor.SetMapper(self.cutterOutlineMapper) #create outline mapper self.outline = vtk.vtkOutlineFilter() self.outline.SetInputConnection(self.reader.GetOutputPort()) self.outlineMapper = vtk.vtkPolyDataMapper() self.outlineMapper.SetInputConnection(self.outline.GetOutputPort()) #create outline actor self.outlineActor = vtk.vtkActor() self.outlineActor.SetMapper(self.outlineMapper) #create annotated cube anchor actor self.axesActor = vtk.vtkAnnotatedCubeActor() self.axesActor.SetXPlusFaceText('Right') self.axesActor.SetXMinusFaceText('Left') self.axesActor.SetYMinusFaceText('Front') self.axesActor.SetYPlusFaceText('Back') self.axesActor.SetZMinusFaceText('Bot') self.axesActor.SetZPlusFaceText('Top') self.axesActor.GetTextEdgesProperty().SetColor(.8,.8,.8) self.axesActor.GetZPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetZMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetXPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetXMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetYPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetYMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetTextEdgesProperty().SetLineWidth(2) self.axesActor.GetCubeProperty().SetColor(.2,.2,.2) self.axesActor.SetFaceTextScale(0.25) self.axesActor.SetZFaceTextRotation(90) self.ren.AddActor(self.modelActor) self.ren.AddActor(self.slicingplaneActor) self.ren.AddActor(self.slicingplaneoutlineActor) self.ren.AddActor(self.outlineActor) #create orientation markers self.axes = vtk.vtkOrientationMarkerWidget() self.axes.SetOrientationMarker(self.axesActor) self.axes.SetInteractor(self.ModelView) self.axes.EnabledOn() self.axes.InteractiveOff() self.ren.ResetCamera() self.ModelView.Render() #update model view def OpenModel(self, filename): self.ModelViewPost.resize(self.ui.modelFramePost.geometry().width()-16,self.ui.modelFramePost.geometry().height()-30) #just in case resizeEvent() hasn't been called yet self.filename = filename self.reader = vtk.vtkSTLReader() self.reader.SetFileName(filename) self.polyDataOutput = self.reader.GetOutput() self.mapper = vtk.vtkPolyDataMapper() self.mapper.SetInputConnection(self.reader.GetOutputPort()) #create model actor self.modelActor = vtk.vtkActor() self.modelActor.GetProperty().SetColor(0,.8,0) self.modelActor.GetProperty().SetOpacity(1) self.modelActor.SetMapper(self.mapper) #create a plane to cut,here it cuts in the XZ direction (xz normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0) self.slicingplane=vtk.vtkPlane() self.slicingplane.SetOrigin(0,0,20) self.slicingplane.SetNormal(0,0,1) #create cutter self.cutter=vtk.vtkCutter() self.cutter.SetCutFunction(self.slicingplane) self.cutter.SetInputConnection(self.reader.GetOutputPort()) self.cutter.Update() self.FeatureEdges = vtk.vtkFeatureEdges() self.FeatureEdges.SetInputConnection(self.cutter.GetOutputPort()) self.FeatureEdges.BoundaryEdgesOn() self.FeatureEdges.FeatureEdgesOff() self.FeatureEdges.NonManifoldEdgesOff() self.FeatureEdges.ManifoldEdgesOff() self.FeatureEdges.Update() self.cutStrips = vtk.vtkStripper() #Forms loops (closed polylines) from cutter self.cutStrips.SetInputConnection(self.cutter.GetOutputPort()) self.cutStrips.Update() self.cutPoly = vtk.vtkPolyData() #This trick defines polygons as polyline loop self.cutPoly.SetPoints((self.cutStrips.GetOutput()).GetPoints()) self.cutPoly.SetPolys((self.cutStrips.GetOutput()).GetLines()) self.cutPoly.Update() # Triangle filter self.cutTriangles = vtk.vtkTriangleFilter() self.cutTriangles.SetInput(self.cutPoly) self.cutTriangles.Update() #cutter mapper self.cutterMapper=vtk.vtkPolyDataMapper() self.cutterMapper.SetInput(self.cutPoly) self.cutterMapper.SetInputConnection(self.cutTriangles.GetOutputPort()) self.cutterOutlineMapper=vtk.vtkPolyDataMapper() self.cutterOutlineMapper.SetInputConnection(self.cutter.GetOutputPort()) # #create plane actor self.slicingplaneActor=vtk.vtkActor() self.slicingplaneActor.GetProperty().SetColor(1.0,1.0,1.0) self.slicingplaneActor.GetProperty().SetLineWidth(4) self.slicingplaneActor.SetMapper(self.cutterMapper) # #create plane actor self.slicingplaneoutlineActor=vtk.vtkActor() self.slicingplaneoutlineActor.GetProperty().SetColor(1.0,0,0) self.slicingplaneoutlineActor.GetProperty().SetLineWidth(4) self.slicingplaneoutlineActor.SetMapper(self.cutterOutlineMapper) #create outline mapper self.outline = vtk.vtkOutlineFilter() self.outline.SetInputConnection(self.reader.GetOutputPort()) self.outlineMapper = vtk.vtkPolyDataMapper() self.outlineMapper.SetInputConnection(self.outline.GetOutputPort()) #create outline actor self.outlineActor = vtk.vtkActor() self.outlineActor.SetMapper(self.outlineMapper) #create annotated cube anchor actor self.axesActor = vtk.vtkAnnotatedCubeActor() self.axesActor.SetXPlusFaceText('Right') self.axesActor.SetXMinusFaceText('Left') self.axesActor.SetYMinusFaceText('Front') self.axesActor.SetYPlusFaceText('Back') self.axesActor.SetZMinusFaceText('Bot') self.axesActor.SetZPlusFaceText('Top') self.axesActor.GetTextEdgesProperty().SetColor(.8,.8,.8) self.axesActor.GetZPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetZMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetXPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetXMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetYPlusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetYMinusFaceProperty().SetColor(.8,.8,.8) self.axesActor.GetTextEdgesProperty().SetLineWidth(2) self.axesActor.GetCubeProperty().SetColor(.2,.2,.2) self.axesActor.SetFaceTextScale(0.25) self.axesActor.SetZFaceTextRotation(90) self.renPost.AddActor(self.modelActor) self.renPost.AddActor(self.slicingplaneActor) self.renPost.AddActor(self.slicingplaneoutlineActor) self.renPost.AddActor(self.outlineActor) #create orientation markers self.axes = vtk.vtkOrientationMarkerWidget() self.axes.SetOrientationMarker(self.axesActor) self.axes.SetInteractor(self.ModelViewPost) self.axes.EnabledOn() self.axes.InteractiveOff() self.renPost.ResetCamera() self.ModelViewPost.Render() #update model view def IncrementSlicingPlanePositive(self): try: if self.modelActor: #check to see if a model is loaded, if not it will throw an exception pass except: #self.modelActor doesn't exist (hasn't been instantiated with a model yet) return if self.currentlayer == len(self.FileList): return #####slice preview self.currentlayer = self.currentlayer + 1 self.layercount.setText(str(self.currentlayer) + " of " + str(len(self.FileList))) self.pm.loadFromData(self.FileList[self.currentlayer-1].read()) self.FileList[self.currentlayer-1].seek(0) self.pmscaled = self.pm.scaled(self.ui.frame_2.geometry().width(), self.ui.frame_2.geometry().height(), QtCore.Qt.KeepAspectRatio) self.slicepreview.setPixmap(self.pmscaled) QApplication.processEvents() #make sure the toolbar gets updated with new text #####model preview if not self.preview: return else: self.slicingplane.SetOrigin(0,0,self.sliceCorrelations[self.currentlayer-1][1]) self.cutter.Update() self.cutStrips.Update() self.cutPoly.SetPoints((self.cutStrips.GetOutput()).GetPoints()) self.cutPoly.SetPolys((self.cutStrips.GetOutput()).GetLines()) self.cutPoly.Update() self.cutTriangles.Update() self.renPost.Render() self.ModelViewPost.Render() def IncrementSlicingPlaneNegative(self): try: if self.modelActor: #check to see if a model is loaded, if not it will throw an exception pass except: #self.modelActor doesn't exist (hasn't been instantiated with a model yet) return if self.currentlayer == 1: return #####slice preview self.currentlayer = self.currentlayer - 1 self.layercount.setText(str(self.currentlayer) + " of " + str(len(self.FileList))) self.pm.loadFromData(self.FileList[self.currentlayer-1].read()) self.FileList[self.currentlayer-1].seek(0) self.pmscaled = self.pm.scaled(self.ui.frame_2.geometry().width(), self.ui.frame_2.geometry().height(), QtCore.Qt.KeepAspectRatio) self.slicepreview.setPixmap(self.pmscaled) QApplication.processEvents() #make sure the toolbar gets updated with new text #####model preview if not self.preview: return else: self.slicingplane.SetOrigin(0,0,self.sliceCorrelations[self.currentlayer-1][1]) self.cutter.Update() self.cutStrips.Update() self.cutPoly.SetPoints((self.cutStrips.GetOutput()).GetPoints()) self.cutPoly.SetPolys((self.cutStrips.GetOutput()).GetLines()) self.cutPoly.Update() self.cutTriangles.Update() self.renPost.Render() self.ModelViewPost.Render() def GoToLayer(self): try: if self.modelActor: #check to see if a model is loaded, if not it will throw an exception pass except: #self.modelActor doesn't exist (hasn't been instantiated with a model yet) QtGui.QMessageBox.critical(self, 'Error changing current layer',"You must load a model to navigate between layers!", QtGui.QMessageBox.Ok) return layer, ok = QtGui.QInputDialog.getText(self, 'Go To Layer', 'Enter the desired layer (1 - %s)' %(int(len(self.FileList)))) if not ok: #the user hit the "cancel" button return if int(layer)<0: QtGui.QMessageBox.critical(self, 'Error going to layer',"You must enter a layer between 1 and %s" %(int(len(self.FileList))), QtGui.QMessageBox.Ok) return #####slice preview self.currentlayer = int(layer) self.layercount.setText(str(self.currentlayer) + " of " + str(len(self.FileList))) self.pm.loadFromData(self.FileList[self.currentlayer-1].read()) self.FileList[self.currentlayer-1].seek(0) self.pmscaled = self.pm.scaled(self.ui.frame_2.geometry().width(), self.ui.frame_2.geometry().height(), QtCore.Qt.KeepAspectRatio) self.slicepreview.setPixmap(self.pmscaled) QApplication.processEvents() #make sure the toolbar gets updated with new text #####model preview if not self.preview: return else: self.slicingplane.SetOrigin(0,0,self.sliceCorrelations[self.currentlayer-1][1]) self.cutter.Update() self.cutStrips.Update() self.cutPoly.SetPoints((self.cutStrips.GetOutput()).GetPoints()) self.cutPoly.SetPolys((self.cutStrips.GetOutput()).GetLines()) self.cutPoly.Update() self.cutTriangles.Update() self.renPost.Render() self.ModelViewPost.Render() def GoToFirstLayer(self): try: if self.modelActor: #check to see if a model is loaded, if not it will throw an exception pass except: #self.modelActor doesn't exist (hasn't been instantiated with a model yet) return self.currentlayer = 1 self.layercount.setText(str(self.currentlayer) + " of " + str(len(self.FileList))) self.pm.loadFromData(self.FileList[self.currentlayer-1].read()) #remember to compensate for 0-index self.FileList[self.currentlayer-1].seek(0) self.pmscaled = self.pm.scaled(self.ui.frame_2.geometry().width(), self.ui.frame_2.geometry().height(), QtCore.Qt.KeepAspectRatio) self.slicepreview.setPixmap(self.pmscaled) QApplication.processEvents() #make sure the toolbar gets updated with new text #####model preview if not self.preview: return else: self.slicingplane.SetOrigin(0,0,self.sliceCorrelations[self.currentlayer-1][1]) self.cutter.Update() self.cutStrips.Update() self.cutPoly.SetPoints((self.cutStrips.GetOutput()).GetPoints()) self.cutPoly.SetPolys((self.cutStrips.GetOutput()).GetLines()) self.cutPoly.Update() self.cutTriangles.Update() self.renPost.Render() self.ModelViewPost.Render() def GoToLastLayer(self): try: if self.modelActor: #check to see if a model is loaded, if not it will throw an exception pass except: #self.modelActor doesn't exist (hasn't been instantiated with a model yet) return self.currentlayer = int(self.numberOfLayers) self.layercount.setText(str(self.currentlayer) + " of " + str(len(self.FileList))) self.pm.loadFromData(self.FileList[self.currentlayer-1].read()) #remember to compensate for 0-index self.FileList[self.currentlayer-1].seek(0) self.pmscaled = self.pm.scaled(self.ui.frame_2.geometry().width(), self.ui.frame_2.geometry().height(), QtCore.Qt.KeepAspectRatio) self.slicepreview.setPixmap(self.pmscaled) QApplication.processEvents() #make sure the toolbar gets updated with new text #####model preview if not self.preview: return else: self.slicingplane.SetOrigin(0,0,self.sliceCorrelations[self.currentlayer-1][1]) self.cutter.Update() self.cutStrips.Update() self.cutPoly.SetPoints((self.cutStrips.GetOutput()).GetPoints()) self.cutPoly.SetPolys((self.cutStrips.GetOutput()).GetLines()) self.cutPoly.Update() self.cutTriangles.Update() self.renPost.Render() self.ModelViewPost.Render() def UpdateModelLayer(self, z): self.slicingplane.SetOrigin(0,0,z) self.cutter.Update() self.cutStrips.Update() self.cutPoly.SetPoints((self.cutStrips.GetOutput()).GetPoints()) self.cutPoly.SetPolys((self.cutStrips.GetOutput()).GetLines()) self.cutPoly.Update() self.cutTriangles.Update() self.renPost.Render() self.ModelViewPost.Render() def UpdateModelOpacityPre(self): if len(self.modelList)>0: #check to see if a model is loaded, if not it will throw an exception modelObject = self.modelList[self.ui.modelList.currentRow()] opacity, ok = QtGui.QInputDialog.getText(self, 'Set Model Opacity', 'Enter the desired opacity for %s (0-100):' %(os.path.basename(str(modelObject.filename)))) if not ok: #the user hit the "cancel" button return modelObject.actor.GetProperty().SetOpacity(float(opacity)/100) self.renPre.Render() self.ModelViewPre.Render() else: QtGui.QMessageBox.critical(self, 'Error setting opacity',"You must load a model to change the opacity!", QtGui.QMessageBox.Ok) def UpdateModelOpacityPost(self): try: if self.modelActor: #check to see if a model is loaded, if not it will throw an exception opacity, ok = QtGui.QInputDialog.getText(self, 'Model Opacity', 'Enter the desired opacity (0-100):') if not ok: #the user hit the "cancel" button return self.modelActor.GetProperty().SetOpacity(float(opacity)/100) self.ren.Render() self.ModelView.Render() except: #self.modelActor doesn't exist (hasn't been instantiated with a model yet) QtGui.QMessageBox.critical(self, 'Error setting opacity',"You must load a model to change the opacity!", QtGui.QMessageBox.Ok) def ModelIndexChanged(self, new, previous): modelObject = self.modelList[self.ui.modelList.currentRow()] self.ui.positionX.setValue(modelObject.CurrentXPosition) self.ui.positionY.setValue(modelObject.CurrentYPosition) self.ui.positionZ.setValue(modelObject.CurrentZPosition) self.ui.rotationX.setValue(modelObject.CurrentXRotation) self.ui.rotationY.setValue(modelObject.CurrentYRotation) self.ui.rotationZ.setValue(modelObject.CurrentZRotation) self.ui.scale.setValue(modelObject.CurrentScale) def UpdatePositionX(self, position): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.Translate((float(position)-modelObject.CurrentXPosition), 0.0, 0.0) modelObject.CurrentXPosition = modelObject.CurrentXPosition + (float(position)-modelObject.CurrentXPosition) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.renPre.Render() self.ModelViewPre.Render() def UpdatePositionY(self, position): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.Translate(0.0, (float(position)-modelObject.CurrentYPosition), 0.0) modelObject.CurrentYPosition = modelObject.CurrentYPosition + (float(position)-modelObject.CurrentYPosition) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.renPre.Render() self.ModelViewPre.Render() def UpdatePositionZ(self, position): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.Translate(0.0, 0.0, (float(position)-modelObject.CurrentZPosition)) modelObject.CurrentZPosition = modelObject.CurrentZPosition + (float(position)-modelObject.CurrentZPosition) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.renPre.Render() self.ModelViewPre.Render() def UpdateRotationX(self, rotation): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.RotateX((float(rotation)-modelObject.CurrentXRotation)) modelObject.CurrentXRotation = modelObject.CurrentXRotation + (float(rotation)-modelObject.CurrentXRotation) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.renPre.Render() self.ModelViewPre.Render() def UpdateRotationY(self, rotation): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.RotateY((float(rotation)-modelObject.CurrentYRotation)) modelObject.CurrentYRotation = modelObject.CurrentYRotation + (float(rotation)-modelObject.CurrentYRotation) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.renPre.Render() self.ModelViewPre.Render() def UpdateRotationZ(self, rotation): modelObject = self.modelList[self.ui.modelList.currentRow()] transform = modelObject.transform transform.RotateZ((float(rotation)-modelObject.CurrentZRotation)) modelObject.CurrentZRotation = modelObject.CurrentZRotation + (float(rotation)-modelObject.CurrentZRotation) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() self.renPre.Render() self.ModelViewPre.Render() def UpdateScale(self, scale): modelObject = self.modelList[self.ui.modelList.currentRow()] orientation = modelObject.transform.GetOrientation() position = modelObject.transform.GetPosition() modelObject.transform = vtk.vtkTransform() modelObject.transform.RotateX(orientation[0]) modelObject.transform.RotateY(orientation[1]) modelObject.transform.RotateZ(orientation[2]) modelObject.transform.Translate(position[0], position[1], position[2]) #now scale it to the new value and update the window modelObject.transform.Scale(float(scale)/100,float(scale)/100,float(scale)/100) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(modelObject.transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() modelObject.mapper.SetInputConnection(transformFilter.GetOutputPort()) modelObject.mapper.Update() modelObject.outlineMapper.Update() self.renPre.Render() self.ModelViewPre.Render() def ConcatenateSTLs(self): filename = str(QFileDialog.getSaveFileName(self, "Save STL file", "", ".stl")) if filename == "": return ap = vtk.vtkAppendPolyData() for modelObject in self.modelList: matrix = modelObject.transform.GetMatrix() transform = vtk.vtkTransform() transform.SetMatrix(matrix) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() ap.AddInput(transformFilter.GetOutput()) writer = vtk.vtkSTLWriter() writer.SetInput(ap.GetOutput()) writer.SetFileName(str(filename)) writer.Write() def SliceModel(self): if len(self.modelList)>0: #check to see if a model is loaded, if not it will throw an exception pass else: #self.modelActor doesn't exist (hasn't been instantiated with a model yet) QtGui.QMessageBox.critical(self, 'Error slicing model',"You must first load a model to slice it!", QtGui.QMessageBox.Ok) return outputFile = str(QFileDialog.getSaveFileName(self, "Save 3DLP project file", "", ".3dlp")) #concatenate all models into a single polydata dataset ap = vtk.vtkAppendPolyData() for modelObject in self.modelList: matrix = modelObject.transform.GetMatrix() transform = vtk.vtkTransform() transform.SetMatrix(matrix) transformFilter = vtk.vtkTransformPolyDataFilter() transformFilter.SetTransform(transform) transformFilter.SetInputConnection(modelObject.reader.GetOutputPort()) transformFilter.Update() ap.AddInput(transformFilter.GetOutput()) writer = vtk.vtkSTLWriter() writer.SetInput(ap.GetOutput()) writer.SetFileName("concat.stl") writer.Write() os.chdir(os.path.split(str(outputFile))[0]) zfile = zipfile.ZipFile(os.path.split(str(outputFile))[1], 'w') #zfile. self.slicer = slicer.slicer(self) self.slicer.imageheight = 500 self.slicer.imagewidth = 500 # check to see if starting depth is less than ending depth!! this assumption is crucial self.slicer.startingdepth = 0 self.slicer.endingdepth = 20 self.slicer.layerincrement = 1 self.slicer.OpenModel("wfu_cbi_skull_cleaned.stl") self.slicer.slice() def LoadSettingsFromConfigFile(self): self.printerBaud = int(self.parser.get('program_defaults', 'printerBAUD')) self.zScript = self.parser.get('scripting', 'sequence') self.projectorPowerOffCommand = self.parser.get('projector_settings', 'PowerOffCommand') self.projectorBaud = self.parser.get('projector_settings', 'projectorBAUD') self.exposeTime = self.parser.get('program_defaults', 'ExposeTime') self.numberOfStartLayers = self.parser.get('program_defaults', 'NumStartLayers') self.startLayersExposureTime = self.parser.get('program_defaults', 'StartLayersExposeTime') if self.parser.get('program_defaults', 'printercontroller') == 'ARDUINO_UNO': self.controller = "arduinoUNO" elif self.parser.get('program_defaults', 'printercontroller') == 'ARDUINO_MEGA': self.controller = "arduinoMEGA" elif self.parser.get('program_defaults', 'printercontroller') == 'PYMCU': self.controller = "pymcu" elif self.parser.get('program_defaults', 'printercontroller') == 'RAMPS': self.controller = "ramps" if self.parser.get('program_defaults', 'slideshowenabled') == 'True': self.slideshowEnabled = True else: self.slideshowEnabled = False if self.parser.get('program_defaults', 'printercontrol') == 'True': self.enablePrinterControl = True else: self.enablePrinterControl = False if self.parser.get('projector_settings', 'projectorcontrol') == 'True': self.projectorControlEnabled = True else: self.projectorControlEnabled = False self.COM_Port = self.parser.get('program_defaults', 'printerCOM') self.screenNumber = self.parser.get('program_defaults', 'screennumber') self.pitch = int(self.parser.get('printer_hardware', 'Leadscrew_pitch')) self.stepsPerRev = int(self.parser.get('printer_hardware', 'Steps_per_rev')) def OpenSettingsDialog(self): self.SettingsDialog = StartSettingsDialog(self) for x in range(self.numports): portentry = self.ports[x] #switch to dict x if portentry['available'] == True: #if it is currently available portname = portentry['name'] #find the name of the port #print portname self.SettingsDialog.pickcom.addItem(portname) self.SettingsDialog.pickcom.setItemText(x, QtGui.QApplication.translate("SettingsDialogBaseClass", "%s"%portname, None, QtGui.QApplication.UnicodeUTF8)) ####setup screen picker#### for x in range(self.screencount): self.SettingsDialog.pickscreen.addItem("") self.SettingsDialog.pickscreen.setItemText(x, QtGui.QApplication.translate("SettingsDialogBaseClass", "%d"%x, None, QtGui.QApplication.UnicodeUTF8)) bauddict = {'115200':0, '57600':1, '38400':2, '19200':3, '9600':4, '4800':5, '2400':6} #self. = bauddict[self.parser.get('program_defaults', 'projectorBAUD')] #insert all other values from current namespace self.SettingsDialog.zscript.setPlainText(self.zScript) self.SettingsDialog.projector_poweroffcommand.setText(self.projectorPowerOffCommand) self.SettingsDialog.exposure_time.setText(str(self.exposeTime)) self.SettingsDialog.starting_layers.setText(str(self.numberOfStartLayers)) self.SettingsDialog.starting_layer_exposure.setText(str(self.startLayersExposureTime)) self.SettingsDialog.pitch.setText(str(self.pitch)) self.SettingsDialog.stepsPerRev.setText(str(self.stepsPerRev)) if self.controller == 'arduinoUNO': self.SettingsDialog.radio_arduinoUno.click() elif self.controller == 'arduinoMEGA': self.SettingsDialog.radio_arduinoMega.click() elif self.controller == 'pymcu': self.SettingsDialog.radio_pyMCU.click() elif self.controller == 'ramps': self.SettingsDialog.radio_ramps.click() if self.parser.get('program_defaults', 'slideshowenabled') == 'True': self.SettingsDialog.enableslideshow.click() if self.parser.get('program_defaults', 'printercontrol') == 'True': self.SettingsDialog.enableprintercontrol.click() if self.parser.get('projector_settings', 'projectorcontrol') == 'True': self.SettingsDialog.projectorcontrol.click() #self.getSettingsDialogValues() self.connect(self.SettingsDialog, QtCore.SIGNAL('ApplySettings()'), self.getSettingsDialogValues) self.SettingsDialog.exec_() def getSettingsDialogValues(self): print "got here" self.zScript = self.SettingsDialog.zscript.document().toPlainText() self.parser.set('scripting', 'sequence', '%s'%self.zScript) self.COM_Port = self.SettingsDialog.pickcom.currentText() self.parser.set('program_defaults', 'printerCOM', '%s'%self.COM_Port) self.exposeTime = float(self.SettingsDialog.exposure_time.text()) self.parser.set('program_defaults', 'ExposeTime', '%s'%self.exposeTime) #AdvanceTime = float(self.ui.advance_time.text()) self.numberOfStartLayers = float(self.SettingsDialog.starting_layers.text()) self.parser.set('program_defaults', 'NumStartLayers', '%s'%self.numberOfStartLayers) self.startLayersExposureTime = float(self.SettingsDialog.starting_layer_exposure.text()) self.parser.set('program_defaults', 'StartLayersExposeTime', '%s'%self.startLayersExposureTime) self.projector_baud = self.SettingsDialog.projector_baud.currentText() self.parser.set('program_defaults', 'projectorBAUD', '%s'%self.projector_baud) self.pitch = int(self.SettingsDialog.pitch.text()) self.parser.set('printer_hardware', 'Leadscrew_pitch', '%s'%self.pitch) self.stepsPerRev = int(self.SettingsDialog.stepsPerRev.text()) self.parser.set('printer_hardware', 'Steps_per_rev', '%s'%self.stepsPerRev) if self.SettingsDialog.projectorcontrol.isChecked(): self.projectorControlEnabled = True self.parser.set('program_defaults', 'projectorcontrol', 'True') else: self.projectorControlEnabled = False self.parser.set('program_defaults', 'projectorcontrol', 'False') if self.SettingsDialog.enableprintercontrol.isChecked(): self.printercontrolenabled = True self.parser.set('program_defaults', 'printercontrol', 'True') else: self.printercontrolenabled = False self.parser.set('program_defaults', 'printercontrol', 'False') if self.SettingsDialog.enableslideshow.isChecked(): self.slideshowEnabled = True self.parser.set('program_defaults', 'slideshowenabled', 'True') else: self.slideshowEnabled = False self.parser.set('program_defaults', 'slideshowenabled', 'False') if self.SettingsDialog.radio_pyMCU.isChecked(): self.controller = "pymcu" self.parser.set('program_defaults', 'printercontroller', 'PYMCU') self.screenNumber = self.SettingsDialog.pickscreen.currentText() #get the screen number from picker if self.SettingsDialog.radio_arduinoUno.isChecked(): self.controller = "arduinoUNO" self.parser.set('program_defaults', 'printercontroller', 'ARDUINO_UNO') if self.SettingsDialog.radio_arduinoMega.isChecked(): self.controller = "arduinoMEGA" self.parser.set('program_defaults', 'printercontroller', 'ARDUINO_MEGA') if self.SettingsDialog.radio_ramps.isChecked(): self.controller = "ramps" self.parser.set('program_defaults', 'printercontroller', 'RAMPS') #SAVE config settings ##to make sure it can find the config.ini file bundled with the .exe by Pyinstaller # filename = 'config.ini' # if hasattr(sys, '_MEIPASS'): # # PyInstaller >= 1.6 # os.chdir(sys._MEIPASS) # filename = os.path.join(sys._MEIPASS, filename) # else: # os.chdir(os.path.dirname(sys.argv[0])) # filename = os.path.join(os.path.dirname(sys.argv[0]), filename) ## filename = 'config.ini' if hasattr(sys, '_MEIPASS'): # PyInstaller >= 1.6 APPNAME = '3DLP' APPDATA = os.path.join(os.environ['APPDATA'], APPNAME) filename = os.path.join(APPDATA, filename) outputini = open(filename, 'w') #open a file pointer for the config file parser to write changes to self.parser.write(outputini) outputini.close() #done writing config file changes else: #otherwise it's running in pydev environment: use the dev config file os.chdir(os.path.dirname(sys.argv[0])) filename = os.path.join(os.path.dirname(sys.argv[0]), filename) outputini = open(filename, 'w') #open a file pointer for the config file parser to write changes to self.parser.write(outputini) outputini.close() #done writing config file changes ## def openhelp(self): webbrowser.open("http://www.chrismarion.net/3dlp/software/help") def OpenPrintJobSettings(self): dialog = PrintJobSettingsDialog(self) dialog.exec_() def openmanualcontrol(self): try: #check to see if printer object exists if self.printer: pass except: QtGui.QMessageBox.critical(self, 'Error opening manual control dialog',"You must first connect to a printer to control it!", QtGui.QMessageBox.Ok) return ManualControl = StartManualControl(self) ManualControl.exec_() def ConnectToPrinter(self): self.printer = hardware.ramps("COM11") if self.printer.status == 1: print "unknown error encountered while trying to connect to printer." return def disablestopbutton(self): self.ui.button_stop_printing.setEnabled(False) def enablestopbutton(self): self.ui.button_stop_printing.setEnabled(True) def openaboutdialog(self): dialog = OpenAbout(self) dialog.exec_() def printpressed(self): try: #check to see if printer object exists if self.printer: pass except: QtGui.QMessageBox.critical(self, 'Error starting print job',"You must first connect to a printer to print to it!", QtGui.QMessageBox.Ok) return self.printThread = printmodel.printmodel(self.zScript, self.COM_Port, self.printerBaud, self.exposeTime , self.numberOfStartLayers, self.startLayersExposureTime , self.projectorControlEnabled, self.controller, self.screenNumber, self.cwd, self) #connect to slideshow signal self.connect(self.printThread, QtCore.SIGNAL('updatePreview'), self.updatepreview) self.connect(self.printThread, QtCore.SIGNAL('updatePreviewBlank'), self.updatepreviewblank) self.connect(self.printThread, QtCore.SIGNAL('disable_stop_button'), self.disablestopbutton) self.connect(self.printThread, QtCore.SIGNAL('enable_stop_button'), self.enablestopbutton) self.printThread.start() def StopPrinting(self): print "Stopping print cycle.. finishing current layer" self.printThread.stop = True ################################################################################ def GetInHMS(seconds): m, s = divmod(seconds, 60) h, m = divmod(m, 60) #print "%d:%02d:%02d" % (h, m, s) return "%d:%02d:%02d" % (h, m, s) ################################################################################ def main(): ################pyQt stuff app = QtGui.QApplication(sys.argv) splash_pix = QPixmap(':/splash/3dlp_splash.png') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() app.processEvents() window=Main() window.show() splash.finish(window) window.resizeEvent("") # It's exec_ because exec is a reserved word in Python sys.exit(app.exec_()) ############### if __name__ == "__main__": main()
Python
# -*- coding: utf-8 -*- """ Created on Sun Nov 18 17:06:39 2012 @author: Chris """ from PyQt4 import QtCore,QtGui from PyQt4.Qt import * import re, os, hardware from slideshowgui import SlideShowWindow from time import sleep class printmodel(QtCore.QThread): def __init__(self, zscript, COM_Port, Printer_Baud, ExposeTime, NumberOfStartLayers, StartLayersExposureTime , projectorcontrolenabled, controller, screennumber, cwd, parent): self.zscript = zscript self.COM_Port = COM_Port self.Printer_Baud = Printer_Baud self.ExposeTime = float(ExposeTime) self.screennumber = screennumber self.NumberOfStartLayers = NumberOfStartLayers self.StartLayersExposureTime = StartLayersExposureTime self.projectorcontrolenabled = projectorcontrolenabled self.controller = controller self.stop = False self.cwd = cwd self.printer = parent.printer self.parent = parent super(printmodel, self).__init__(parent) #QtCore.QThread.__init__(self, parent = None) #self.printmodel() #start the printmodel method below def run(self): self.emit(QtCore.SIGNAL('enable_stop_button')) #emit signal to enable stop button #************Start custom z scripting******* """ syntax for custom z scripting; [] - signifies a command block Z_xxx - move Z axis xxx number of steps X_xxx - move X axis xxx number of steps Z_UP - change direction of z axis to move up Z_DOWN - change direction of z axis to move down X_UP - change direction of x axis to move up X_DOWN - change direction of x axis to move down PAUSE_xxxx - pause xxxx number of milliseconds in scripting sequence Z_ENABLE Z_DISABLE X_ENABLE X_DISABLE """ self.commands = [] for match in re.findall("\[(.*?)\]", self.zscript): print match self.commands.append(match) #******************************************* self.startingexecutionpath = self.cwd #********************************************** # if self.controller=="ramps": # print "Connecting to RAMPS board..." # self.printer = hardware.ramps(self.COM_Port) # if self.controller=="arduinoUNO": # print "Connecting to printer firmware..." # try: # self.board = hardware.arduinoUno(self.COM_Port) # print "no issues opening serial connection to firmata..." # except: # print"Failed to connect to firmata on %s. Check connections and settings, restart the program, and try again." %self.COM_Port # self.emit(QtCore.SIGNAL('disable_stop_button')) #emit signal to disable stop button # return # # if self.controller=="arduinoMEGA": # try: # self.board = hardware.arduinoMega(self.COM_Port) # print "no issues opening serial connection to firmata..." # except: # print"Failed to connect to firmata on %s. Check connections and settings, restart the program, and try again." %self.COM_Port # self.emit(QtCore.SIGNAL('disable_stop_button')) #emit signal to disable stop button # return #****************************************** imgnum = 0 #initialize variable at 0, it is appended +1 for each file found concatenater = "\\" seq = (self.cwd, "slices") #concatenate this list of strings with "str" as a separator slicesdir = concatenater.join(seq) #build slices path relative to working directory, separated by concatenator string try: os.chdir(slicesdir)#change to slices dir print slicesdir except: print "Slices folder does not exist." print"waiting for thread to close." self.emit(QtCore.SIGNAL('disable_stop_button')) #emit signal to disable stop button return #************** print"building file list..." FileList = [] for file in os.listdir("."): #for every file in slices dir (changed dir above) if file.endswith(".png"): #if it's the specified image type imgnum = imgnum + 1 stringg = "\\" seq = (self.cwd, "slices", "%s" %(file)) #concatenate this list of strings with "str" as a separator imagepath = stringg.join(seq) #build image path relative to working directory FileList.append(imagepath) #************** NumberOfImages = imgnum #number of slice images layers = imgnum print "\nNumber of Layers: ", NumberOfImages #open slideshow window self.SlideShow = SlideShowWindow() #create instance of OtherWindow class self.SlideShow.show() #show slideshow window self.SlideShow.setupUi(self) screen = QtGui.QDesktopWidget().availableGeometry(screen = int(self.screennumber)) #get available geometry of the screen chosen self.SlideShow.move(screen.left(), screen.top()) #move window to the top-left of the chosen screen self.SlideShow.resize(screen.width(), screen.height()) #resize the window to fit the chosen screen self.SlideShow.showMaximized() self.SlideShow.showFullScreen() #size = self.SlideShow.frameGeometry() #print size #start slideshow #print "Enabling Stepper Motor Drivers..." #self.printer.EnableZ() #self.printer.EnableX() #print "..ok." print "Printing..." self.parent.ui.progressBar.setEnabled(True) self.parent.ui.progressBar.setValue(50) #eta = (NumberOfImages*ExposeTime) + (NumberOfImages*AdvanceTime) + custom commands!!!! eta = 0 percentagechunk = 100.0/float(NumberOfImages) ProgPercentage = 0.0 for layer in range(NumberOfImages): if self.stop == True: print "Exiting print cycle now." self.emit(QtCore.SIGNAL('disable_stop_button')) #emit signal to disable stop button #self.printer.close() #close connection with printer return TimeRemaining = GetInHMS(eta) if layer >= self.NumberOfStartLayers: ExposureTime = float(self.ExposeTime) else: ExposureTime = self.StartLayersExposureTime blankpath = "%s\\10x10black.png" %(self.startingexecutionpath) self.pm = QtGui.QPixmap(blankpath) #insert code to move printer to starting point ### pmscaled = self.pm.scaled(screen.width(), screen.height(), QtCore.Qt.KeepAspectRatio) self.SlideShow.label.setPixmap(pmscaled) #set black pixmap for blank slide QCoreApplication.processEvents() #have to call this so the GUI updates before the sleep function self.emit(QtCore.SIGNAL('updatePreviewBlank')) #emit signal to update preview image #**send command to stage print "beginning custom scripted command sequence..." for command in self.commands: if command == "Z_UP": self.printer.Z_Up() elif command == "Z_DOWN": self.printer.Z_Down() elif command == "X_UP": self.printer.Z_Up() elif command == "X_DOWN": self.printer.X_Down() elif command == "Z_ENABLE": self.printer.Z_Enable() elif command == "Z_DISABLE": self.printer.Z_Disable() #make sure the next two cases are last to avoid false positives elif command.startswith("Z"): numsteps = int(command[2:command.__len__()]) print "Incrementing Z axis %d steps" %numsteps self.printer.IncrementZ(numsteps) elif command.startswith("X"): numsteps = int(command[2:command.__len__()]) print "Incrementing X axis %d steps"%numsteps self.printer.IncrementX(numsteps) elif command.startswith("PAUSE"): delayval = int(command[6:command.__len__()]) print "Pausing %d milliseconds"%delayval sleep(float(delayval)/1000.00) #sleep(AdvanceTime) #eta = eta - AdvanceTime #print "Now printing layer %d out of %d. Progress: %r%% Time Remaining: %s" %(layer+1, layers, ProgPercentage, TimeRemaining) layer = layer - 0 pm = QtGui.QPixmap(FileList[layer]) pmscaled = pm.scaled(screen.width(), screen.height(), QtCore.Qt.KeepAspectRatio) self.SlideShow.label.setPixmap(pmscaled) QCoreApplication.processEvents() self.emit(QtCore.SIGNAL('updatePreview')) #emit signal to update preview image sleep(float(ExposureTime)) eta = eta - float(ExposureTime) ProgPercentage = ProgPercentage + percentagechunk print "\nPrint job completed successfully. %d layers were built." %layers #if printercontrolenabled==True and arduinocontrolled==True: # board.exit() #close firmata connection def GetInHMS(seconds): m, s = divmod(seconds, 60) h, m = divmod(m, 60) #print "%d:%02d:%02d" % (h, m, s) return "%d:%02d:%02d" % (h, m, s)
Python
## Pre-defined animation. ## ## Move selected object to the top right corner. import animation from keyframe import PosKeyFrame def anim_topRight(firstFrame, lastFrame, nFrames): #self.firstFrame = firstFrame #self.lastFrame = lastFrame #self.nframes = nframes anim = animation.Animation ([PosKeyFrame (firstFrame, [0,0,0]), PosKeyFrame (lastFrame, [0,1,0])]) interptrans = anim.interpolate (nFrames, firstFrame) return anim, interptrans
Python
## Pre-defined animation. ## ##class DefAnimTransRot(): import animation from keyframe import PosKeyFrame, RotKeyFrame ## FUTURO - Chamar bringObj.py ## * The code bellow is responsable for creating keyframe animation structure to bring an' object near to the user. def anim_bringObj(firstFrame, lastFrame, nFrames): #self.firstFrame = firstFrame #self.lastFrame = lastFrame #self.nframes = nframes anim = animation.Animation([PosKeyFrame(firstFrame, [0, 0, 0]), PosKeyFrame(lastFrame, [0, 0, -1.2])]) interptrans = anim.interpolate(nFrames, firstFrame) return anim, interptrans
Python
# -*- coding: utf-8 -*- ## This code is responsable for creating keyframe animation structure. ## Master Research: Elisabete Thomaselli Nogueira ## Professor: Claudio Esperanca ## Graduate Student: Victor Soares Bursztyn ## Created in: 13-03-08 ## Last updated in: class KeyFrame: """Represents a key frame item in an animation.""" frameno = 0 translation=(0.0,0.0,0.0) rotation=(0.0,0.0,1.0,0.0) scale=(1.0,1.0,1.0) def __init__(self, frameno): """Constructor.""" self.frameno = frameno class PosKeyFrame(KeyFrame): """Represents a positional key frame.""" def __init__(self, frameno, translation): """Constructor. @param frameno: Frame number of this keyframe. @param translation: Three coordinates of a translation displacement.""" assert (len(translation)==3) self.translation=translation KeyFrame.__init__(self,frameno) class RotKeyFrame(KeyFrame): """Represents a rotational key frame.""" def __init__(self, frameno, rotation): """Constructor. @param frameno: Frame number of this keyframe. @param rotation: Three coordinates of a rotation axis plus angle.""" assert (len(rotation)==4) self.rotation=rotation KeyFrame.__init__(self,frameno) class ScaleKeyFrame(KeyFrame): """Represents a scale key frame.""" def __init__(self, frameno, scale): """Constructor. @param frameno: Frame number of this keyframe. @param rotation: Three coordinates of a scale transformation.""" assert (len(scale)==3) self.scale=scale KeyFrame.__init__(self,frameno)
Python
# -*- coding: utf-8 -*- ## This code is responsable for creating keyframe animation structure. ## Master Research: Elisabete Thomaselli Nogueira ## Professor: Claudio Esperanca ## Graduate Student: Victor Soares Bursztyn ## Created in: 13-02-08 ## Last updated in: from scipy import * from keyframe import * class Animation: """Represents keyframed animations of 3d objects.""" def __init__(self, keys): """Constructor. @param keys: a list of objects of type keyframe.""" self.keys = keys[:] self.keys.sort(cmp=lambda a,b: a.frameno-b.frameno) self.mult = 1 def interpolate(self,nframes,firstframe=0): """Prepares the interpolation from the keys. @param nframes: the number of frames to be interpolated. @param firstframe: the first frame to be interpolated.""" def makearrays (coord): """Utility function to transpose a list of points into a a list of coordinate arrays. Thus, for instance, makearrays([[1,2],[3,4],[5,6]]) returns [array([1,3,5]),array([2,4,6])]""" result = [] for i in range(len(coord[0])): result.append(array(map(lambda x:x[i], coord))) return result # Collect the various types of keyframe values into lists trans = [] ; ut = [] rot = [] ; ur = [] scale = [] ; us = [] for k in self.keys: if k.translation is not KeyFrame.translation: trans.append (k.translation) ut.append (k.frameno) if k.rotation is not KeyFrame.rotation: rot.append (k.rotation) ur.append (k.frameno) if k.scale is not KeyFrame.scale: scale.append (k.scale) ur.append (k.scale) # Create the desired frame range self.firstframe = firstframe self.nframes = nframes frange = arange(firstframe,firstframe+nframes,1) # Use scipy's interpolating splines to interpolate the various values if len(ut)<=1: trans = [(0,0,0),(0,0,0)] ; ut = [0,1] spline,u = interpolate.splprep(makearrays(trans),s=0,k=min(3,len(ut)-1),u=array(ut)) self.interptrans = interpolate.splev(frange,spline) #print "self.interptrans ", self.interptrans if len(ur)<=1: rot = [(0,0,1,0),(0,0,1,0)] ; ur = [0,1] spline,u = interpolate.splprep(makearrays(rot),s=0,k=min(3,len(ur)-1),u=array(ur)) self.interprotate = interpolate.splev(frange,spline) if len(us)<=1: scale = [(1,1,1),(1,1,1)] ; us = [0,1] spline,u = interpolate.splprep(makearrays(scale),s=0,k=min(3,len(us)-1),u=array(us)) self.interpscale = interpolate.splev(frange,spline) return self.interptrans ## Get translation moviments to put in a graph def updateObject (self, frame, obj, sceneElements): """Updates an object with the animation parameters for a given frame @param frame: animation frame number @param obj: object to be updated """ print "frame, self.firstframe, self.nframes ",frame, self.firstframe, self.nframes assert (frame >= self.firstframe and frame < self.firstframe+self.nframes) self.sceneElements = sceneElements i = frame - self.firstframe ## Fazer as operacoes com o objeto de indice self.index_m """ if self.selectedModel != -1: index_m, index_g = self.findSelections() if self.selectedGroup != -1: self.sceneElements[index_m].groups[index_g].setTranslate(0, 0, self.tz) self.sceneElements[index_m].groups[index_g].box = self.sceneElements[index_m].groups[index_g].box.transform(self.sceneElements[index_m].groups[index_g].getTransformationMatrix()) else: self.sceneElements[index_m].setTranslate(0, 0, self.tz) self.sceneElements[index_m].box = self.sceneElements[index_m].box.transform(self.sceneElements[index_m].getTransformationMatrix()) self.update() """ self.sceneElements[-1].setTranslate (self.interptrans[0][i], self.interptrans[1][i], self.interptrans[2][i]) self.sceneElements[-1].setRotate (self.interprotate[0][i], self.interprotate[1][i], self.interprotate[2][i]) ## self.interprotate[2][i], ## self.interprotate[3][i]) self.sceneElements[-1].setScale (self.interpscale[0][i], self.interpscale[1][i], self.interpscale[2][i]) def printFrame(self, frame): """Prints parameters for the given frame @param frame: number of frame to print""" i = frame - self.firstframe print "Scale", self.interpscale[0][i],self.interpscale[1][i],self.interpscale[2][i] print "Rotate", self.interprotate[0][i],self.interprotate[1][i],self.interprotate[2][i],self.interprotate[3][i] print "Translate", self.interptrans[0][i],self.interptrans[1][i],self.interptrans[2][i]
Python
class c: def __init__(self): self.a = 1 def geta (self) : return self.a def seta (self,val) : self.a = val class d: def __init__(self,getter,setter): self.getter = getter self.setter = setter def update (self): self.setter (self.getter()+1) c0=c() d0=d(c0.geta,c0.seta) d0.update() print c0.a
Python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'interfAnim_sem_Delay_sem_Graph.ui' # # Created: Fri May 02 01:04:07 2008 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! import sys from PyQt4 import QtCore, QtGui class Ui_Dialog_Anim(object): def setupUi(self, Dialog_Anim): Dialog_Anim.setObjectName("Dialog_Anim") Dialog_Anim.resize(QtCore.QSize(QtCore.QRect(0,0,285,234).size()).expandedTo(Dialog_Anim.minimumSizeHint())) self.label_Anim = QtGui.QLabel(Dialog_Anim) self.label_Anim.setGeometry(QtCore.QRect(30,30,51,16)) self.label_Anim.setObjectName("label_Anim") self.label_Velocity = QtGui.QLabel(Dialog_Anim) self.label_Velocity.setGeometry(QtCore.QRect(30,160,46,14)) self.label_Velocity.setObjectName("label_Velocity") self.comboBox_Vel = QtGui.QComboBox(Dialog_Anim) self.comboBox_Vel.setGeometry(QtCore.QRect(90,160,71,22)) self.comboBox_Vel.setObjectName("comboBox_Vel") self.label_lastFrame = QtGui.QLabel(Dialog_Anim) self.label_lastFrame.setGeometry(QtCore.QRect(30,130,61,16)) self.label_lastFrame.setObjectName("label_lastFrame") self.spinBox_Last = QtGui.QSpinBox(Dialog_Anim) self.spinBox_Last.setGeometry(QtCore.QRect(110,130,51,22)) self.spinBox_Last.setMaximum(200) self.spinBox_Last.setProperty("value",QtCore.QVariant(200)) self.spinBox_Last.setObjectName("spinBox_Last") self.label_iniFrame = QtGui.QLabel(Dialog_Anim) self.label_iniFrame.setGeometry(QtCore.QRect(30,100,71,16)) self.label_iniFrame.setObjectName("label_iniFrame") self.labelExit = QtGui.QLabel(Dialog_Anim) self.labelExit.setGeometry(QtCore.QRect(30,60,46,14)) self.labelExit.setObjectName("labelExit") self.comboBox_Stop = QtGui.QComboBox(Dialog_Anim) self.comboBox_Stop.setGeometry(QtCore.QRect(90,60,181,22)) self.comboBox_Stop.setObjectName("comboBox_Stop") self.comboBox_Anim = QtGui.QComboBox(Dialog_Anim) self.comboBox_Anim.setGeometry(QtCore.QRect(90,30,184,22)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(4),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.comboBox_Anim.sizePolicy().hasHeightForWidth()) self.comboBox_Anim.setSizePolicy(sizePolicy) self.comboBox_Anim.setObjectName("comboBox_Anim") self.buttonBox = QtGui.QDialogButtonBox(Dialog_Anim) self.buttonBox.setGeometry(QtCore.QRect(20,190,171,31)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.spinBox_Ini = QtGui.QSpinBox(Dialog_Anim) self.spinBox_Ini.setGeometry(QtCore.QRect(110,100,51,22)) self.spinBox_Ini.setMaximum(999) self.spinBox_Ini.setProperty("value",QtCore.QVariant(1)) self.spinBox_Ini.setObjectName("spinBox_Ini") self.action_Graph = QtGui.QAction(Dialog_Anim) self.action_Graph.setIcon(QtGui.QIcon("icones/grafico.png")) self.action_Graph.setObjectName("action_Graph") self.retranslateUi(Dialog_Anim) QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),Dialog_Anim.reject) QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),Dialog_Anim.accept) QtCore.QMetaObject.connectSlotsByName(Dialog_Anim) def retranslateUi(self, Dialog_Anim): Dialog_Anim.setWindowTitle(QtGui.QApplication.translate("Dialog_Anim", "Dialog", None, QtGui.QApplication.UnicodeUTF8)) self.label_Anim.setText(QtGui.QApplication.translate("Dialog_Anim", "Animation:", None, QtGui.QApplication.UnicodeUTF8)) self.label_Velocity.setText(QtGui.QApplication.translate("Dialog_Anim", "Velocity:", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox_Vel.addItem(QtGui.QApplication.translate("Dialog_Anim", "Slow", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox_Vel.addItem(QtGui.QApplication.translate("Dialog_Anim", "Medium", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox_Vel.addItem(QtGui.QApplication.translate("Dialog_Anim", "High", None, QtGui.QApplication.UnicodeUTF8)) self.label_lastFrame.setText(QtGui.QApplication.translate("Dialog_Anim", "Last Frame:", None, QtGui.QApplication.UnicodeUTF8)) self.label_iniFrame.setText(QtGui.QApplication.translate("Dialog_Anim", "Initial Frame:", None, QtGui.QApplication.UnicodeUTF8)) self.labelExit.setText(QtGui.QApplication.translate("Dialog_Anim", "Finish:", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox_Stop.addItem(QtGui.QApplication.translate("Dialog_Anim", "and return to the first frame", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox_Stop.addItem(QtGui.QApplication.translate("Dialog_Anim", "and stay", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox_Anim.addItem(QtGui.QApplication.translate("Dialog_Anim", "Translate and rotate", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox_Anim.addItem(QtGui.QApplication.translate("Dialog_Anim", "Bring to front", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox_Anim.addItem(QtGui.QApplication.translate("Dialog_Anim", "Go to the top right corner", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox_Anim.addItem(QtGui.QApplication.translate("Dialog_Anim", "Go to the top left corner", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox_Anim.addItem(QtGui.QApplication.translate("Dialog_Anim", "Go to the bottom left corner", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox_Anim.addItem(QtGui.QApplication.translate("Dialog_Anim", "Go to the bottom right corner", None, QtGui.QApplication.UnicodeUTF8)) self.action_Graph.setText(QtGui.QApplication.translate("Dialog_Anim", "_Graph", None, QtGui.QApplication.UnicodeUTF8))
Python
# -*- coding: utf-8 -*- ## This code is responsable for creating keyframe animation structure. ## Master Research: Elisabete Thomaselli Nogueira ## Professor: Claudio Esperanca ## Graduate Student: Victor Soares Bursztyn ## Created in: 13-03-08 ## Last updated in: ## Rotine responsable for importing a list of animations from the directory ## In the future: This rotine will import all content from the animations subdirectory. import anim_TransRot ## Translate and Rotate selected object after a while. import anim_bringObj ## Bring selected object to front. import anim_topRight ## Move selected object to the top right corner. #import anim_botRight ## Move selected object to the bottom right corner. Similar ao anim_topRight #import anim_topLeft ## Move selected object to the top left corner. #import anim_botLeft ## Move selected object to the bottom left corner. from animation import * # ou import animation? #from animation_scripts import * from keyframe import * from interfAnim import * ## Interface Layout to Animation Parameters Window print "animacoes importadas"
Python
## Pre-defined animation. ## ##class DefAnimTransRot(): import animation from keyframe import PosKeyFrame, RotKeyFrame def anim_TransRot(firstFrame, lastFrame, nFrames): #self.firstFrame = firstFrame #self.lastFrame = lastFrame #self.nframes = nframes anim = animation.Animation ([PosKeyFrame (firstFrame, [0,0,0]), PosKeyFrame (nFrames/2, [1,0,0]), PosKeyFrame (lastFrame, [0,1,0]), RotKeyFrame (firstFrame, [1,1,1,0]), RotKeyFrame (50, [1,1,1,180])]) interptrans = anim.interpolate (nFrames, firstFrame) return anim, interptrans
Python
# -*- coding: utf-8 -*- ## This code is responsable for creating keyframe animation structure. ## Master Research: Elisabete Thomaselli Nogueira ## Professor: Claudio Esperanca ## Graduate Student: Victor Soares Bursztyn ## Created in: 13-03-08 ## Last updated in: ## Rotine responsable for importing a list of animations from the directory ## In the future: This rotine will import all content from the animations subdirectory. import anim_TransRot ## Translate and Rotate selected object after a while. import anim_bringObj ## Bring selected object to front. import anim_topRight ## Move selected object to the top right corner. #import anim_botRight ## Move selected object to the bottom right corner. Similar ao anim_topRight #import anim_topLeft ## Move selected object to the top left corner. #import anim_botLeft ## Move selected object to the bottom left corner. print "animacoes importadas"
Python
#!/usr/bin/env python """extremely simple demonstration playing a soundfile and waiting for it to finish. you'll need the pygame.mixer module for this to work. Note how in this simple example we don't even bother loading all of the pygame package. Just pick the mixer for sound and time for the delay function.""" import os.path import pygame.mixer, pygame.time mixer = pygame.mixer time = pygame.time #choose a desired audio format mixer.init(11025) #raises exception on fail #load the sound #file = 'som/music.wav' file = 'music.wav' sound = mixer.Sound(file) #start playing print 'Playing Sound...' channel = sound.play() #poll until finished while channel.get_busy(): #still playing print ' ...still going...' time.wait(1000) print '...Finished'
Python
# -*- coding: utf-8 -*- ## ******************************************************************* GLWIDGET.PY ## * Description: ## * The code contained in this file is meant to handle all the elements ## * (events, routines and classes) that exist in the glwidget canvas. ## ******************************************************************************* ## * Created in: 07-01-07 ## * Last updated in: 03-13-08 ## ******************************************************************************* ## * Authoring: Elisabete Thomaselli Nogueira and Victor S. Bursztyn ## * Orientation: Claudio Esperanca ## ******************************************************************************* #import sys ##2008-05-06 #import os ##2008-05-06 from PyQt4 import * from PyQt4.QtCore import * from PyQt4.QtGui import * try: from OpenGL.GL import * from OpenGL.GLU import * except: print '''ERROR: PyOpenGL not installed properly.''' sys.exit(1) from PyQt4.QtOpenGL import * ## ******************************************************************************* import cPickle #In order to save presentations from scipy import * from threading import Timer from math import * ## ******************************************************************************* ## * Importing complementary code contained in other self-explained files. ## ******************************************************************************* from animations import * import Image #In order to handle textures from arcball import * #from BoundingBox import * #from EditableVisualElement import * from scene import * ##******************************************************************************* # Load Documentation Image ##******************************************************************************* def loadImage(path): """Loads an image from a file. @param imageName: path to the actual image file. @return: ID of the new allocated texture. """ """Load an image file as a 2D texture using PIL This method combines all of the functionality required to load the image with PIL, convert it to a format compatible with PyOpenGL, generate the texture ID, and store the image data under that texture ID. Note: only the ID is returned, no reference to the image object or the string data is stored in user space, the data is only present within the OpenGL engine after this call exits. """ im = Image.open(path) #im.transpose(Image.FLIP_TOP_BOTTOM) try: ## get image meta-data (dimensions) and data ix, iy, image = im.size[0], im.size[1], im.tostring() except SystemError: ## has no alpha channel, synthesize one, see the ## texture module for more realistic handling ix, iy, image = im.size[0], im.size[1], im.tostring() ## generate a texture ID ID = glGenTextures(1) ## make it current glBindTexture(GL_TEXTURE_2D, ID) #glPixelStorei(GL_UNPACK_ALIGNMENT,1) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, image) ## return the ID for use return ID ##******************************************************************************* ## * Classe txtNote() deve ser revista ap?s as novas considera??es feitas ## * no conceito de documenta??o. ## ******************************************************************************* """class txtNote(): def __init__(self): ## Textual note constructor. ## Whenever a text comment is associated to a model, a txtNote instance is added to this model's txtNotes list. ## The description is saved to an automatically generated *.bmp file, which is loaded through loadImage(), generating ## the proper ID for the texture. ## **************************************************************************************** ## DocumentationDialog -> txtNote.bmp -> txtNote instance -> part of model's txtNotes list ## **************************************************************************************** return""" ## ******************************************************************************* class glWidget(QGLWidget): sceneElements = [] ## List of models contained in the current scene def __init__(self, parent=None, Width = 640, Height = 480, animType = None, playerExit = 1, firstFrame = 1, lastFrame = 100, Running = True, fps = 10): """Constructor""" super (glWidget, self).__init__(parent) self.motionfunc = self.defaultMouseMoveEvent QGLWidget.setMouseTracking(self, 1) self.enable_wheel = True self.Width = Width self.Height = Height self.selectedModel = -1 self.selectedGroup = -1 #self.setSelected(True) ## cut, copy self.setFocusPolicy(QtCore.Qt.StrongFocus) ## Ativate wheel in keyPress ##?? Tem ?? Initializes all transformations needed to the ArcBall routine self.r_isDragging = False #******************************************************* # Default transformation parameters #******************************************************* self.sx, self.sy, self.sz = 1.0, 1.0, 1.0 ## The default is not to scale self.tx, self.ty, self.tz = 0, 0, 0 ## The default is not to translate self.lastpt = [0, 0, 0] ## The previous point coordenate in the openGL screen self.newpt = [0, 0, 0] ## The current point coordenate in the openGL screen #self.lastpt = [0, 0] ##m ## The previous point coordenate in the screen #self.newpt = [0, 0] ## The current point coordenate in the screen self.side = (0.1, 0.1, 0.1) #******************************************************* # Default animation display parameters #******************************************************* self.firstFrame = firstFrame self.frameCount = firstFrame self.fps = fps self.lastFrame = lastFrame self.nframes = self.lastFrame - self.firstFrame + 1 ## VER LOCAL CORRETO self.Running = True self.playerExit = playerExit ## gluPerspective parameters self.fovy = 80 self.zNear = 2 #0.1 self.zFar = -5 #500 ##FUTURA REFERENCIA - tornar os parametros de camera editaveis pela aplicacao. self.eyeX = 0.0 self.eyeY = 0.0 self.eyeZ = 3.0 self.centerX = 0.0 self.centerY = 0.0 self.centerZ = 0.0 self.upX = 0.0 self.upY = 1.0 self.upZ = 0.0 ##FUTURA REFERENCIA - tornar as luzes da cena editaveis pela aplicacao. self. lamb = [1.0, 1.0, 1.0, 0.1] self.ldif = [1.0, 1.0, 1.0, 1.0] self.lspec = [0.5, 0.5, 0.5, 0.1] self.lpos = [-1.0, 3.0, 1.0, 1.0] self.lmod_amb = [1.0, 1.0, 1.0, 1.0] self.sceneRenderSetUp() def paintEvent(self, event): painter = QtGui.QPainter() painter.begin(self) painter.setRenderHint(QtGui.QPainter.Antialiasing) self.drawScene(False) painter.end() def resizeGL (self, width, height): """A simple resize callback.""" """ Resizes the window, sets a new vieport and a new perspetive transformation. """ if width < 2 or height < 2: ##? To avoid ZeroDivisionError. It must be 2 because arcball subtracts 1 return self.width,self.height = width,height self.screencenter = (width/2.0, height/2.0, 0.0) ## Inicialize scene center as windows center. glViewport (0, 0, width, height); glMatrixMode (GL_PROJECTION); glLoadIdentity() glOrtho (0, width, 0, height, -1000, 1000) glMatrixMode(GL_MODELVIEW); glLoadIdentity() ##1 self.centerscene() def initializeGL(self): self.newCursorModel() ## Includes a 3D Cursor in the scene. self.sceneRenderSetUp() def sceneRenderSetUp(self): """ This routine defines scene aspects. * gluPerspective - define a view frustum @param fovy: Specifies the field of view angle, in degrees, in the y direction. @param aspect:Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height). @param zNear: Specifies the distance from the viewer to the near clipping plane (always positive). @param zFar: Specifies the distance from the viewer to the far clipping plane (always positive). * gluLookAt - define a viewing transformation @param eyeX: Specifies the position of the eye point. @param eyeY: @param eyeZ: @param centerX: Specifies the position of the reference point. @param centerY: @param centerZ: @param upX: Specifies the direction of the up vector. @param upY: @param upZ:""" glMatrixMode(GL_PROJECTION) #err pyqt4.3 24-03 glLoadIdentity() aspect = self.Width/self.Height ## ************************************************************************************* ## * gluPerspective specifies a viewing frustum into the world coordinate system. ## * In general, the aspect ratio in gluPerspective should match the aspect ratio of the associated viewport. ## ************************************************************************************* gluPerspective(self.fovy, aspect, self.zNear, self.zFar) glMatrixMode(GL_MODELVIEW) glLoadIdentity() ## ************************************************************************************* ## * gluLookAt creates a viewing matrix derived from an eye point, a reference point indicating the center of the ## * scene, and an UP vector. ## ************************************************************************************* gluLookAt(self.eyeX, self.eyeY, self.eyeZ, self.centerX, self.centerY, self.centerZ, self.upX, self.upY, self.upZ) ##glLightfv trata a iluminacao da cena. ##glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmod_amb) glLightfv(GL_LIGHT0, GL_AMBIENT, self.lamb) glLightfv(GL_LIGHT0, GL_DIFFUSE, self.ldif) glLightfv(GL_LIGHT0, GL_POSITION, self.lpos) glLightfv(GL_LIGHT0, GL_SPECULAR, self.lspec) glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE) glBlendFunc(GL_SRC_ALPHA, GL_ONE) glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) glEnable(GL_DEPTH_TEST) glEnable(GL_NORMALIZE) glShadeModel(GL_SMOOTH) glEnable(GL_COLOR_MATERIAL) glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT) glClearColor(0.25,0.25,0.25,1) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) def drawScene(self, testSelection = False): glMatrixMode(GL_MODELVIEW) #Nao funciona no windows. self.autoSave() ## Salva contexto para undo/redo if not testSelection: ##If is not testSelection self.sceneRenderSetUp() # Ja esta no init e no initGL ?? mas precisa disso. Porque? for model in self.sceneElements: if (model.modelId == self.selectedModel): ##If is selectedModel if (model.copyId != -1): ##If is copy for m in self.sceneElements: if (m.modelId == model.copyId): m.draw(self.selectedGroup, False, model.getTransformationMatrix(), model.getTransformation(), model.getGroupTransformations(), model.getGroupIds(), model.getGroupRGBs()) m.box.draw() if self.r_isDragging == True: self.arcball.draw(model.getTransformationMatrix(), model.getTransformation(), model.box.vertices(), model.objName) else: ##If is not copy model.draw(self.selectedGroup, False, model.getTransformationMatrix(), model.getTransformation(), model.getGroupTransformations(), model.getGroupIds(), model.getGroupRGBs()) if self.selectedModel != 0: ## except for 3DCursor model.box.draw() else: print "3DCursor mustn't have bounding box. self.selectedModel ", self.selectedModel ## if self.r_isDragging == True: self.arcball.draw(model.getTransformationMatrix(), model.getTransformation(), model.box.vertices(), model.objName) else: ##If is not selectedModel if (model.copyId != -1): ##If is copy for m in self.sceneElements: if (m.modelId == model.copyId): m.draw(-1, False, model.getTransformationMatrix(), model.getTransformation(), model.getGroupTransformations(), model.getGroupIds(), model.getGroupRGBs()) if self.r_isDragging == True: self.arcball.draw(model.getTransformationMatrix(), model.getTransformation(), model.box.vertices(), model.objName) else: ##If is not copy model.draw(-1, False, model.getTransformationMatrix(), model.getTransformation(), model.getGroupTransformations(), model.getGroupIds(), model.getGroupRGBs()) if self.r_isDragging == True: self.arcball.draw(model.getTransformationMatrix(), model.getTransformation(), model.box.vertices(), model.objName) else: ##If is testSelection for model in self.sceneElements: glPushName(model.modelId) if (model.copyId != -1): ##If is copy for m in self.sceneElements: if (m.modelId == model.copyId): m.draw(-1, True, model.getTransformationMatrix(), model.getTransformation(), model.getGroupTransformations(), model.getGroupIds(), model.getGroupRGBs()) if self.r_isDragging == True: self.arcball.draw(model.getTransformationMatrix(), model.getTransformation(), model.objName) else: ##If is not copy model.draw(-1, True, model.getTransformationMatrix(), model.getTransformation(), model.getGroupTransformations(), model.getGroupIds(), model.getGroupRGBs()) if self.r_isDragging == True: self.arcball.draw(model.getTransformationMatrix(), model.getTransformation(), model.objName) #os.rename("autosave.step", "undo.step") #self.autoSave() ## Salva contexto para undo/redo glPopName() #os.rename("autosave.step", "undo.step") #self.autoSave() ## Salva contexto para undo/redo glMatrixMode(GL_PROJECTION) #******************************************************* # Animation routines #******************************************************* ##VER se precisa def timerEvent(self, event): if not Running: return def animateObj(self, animType, playerExit, initFrame, lastFrame, vel, Running): self.animType = animType self.playerExit = playerExit self.firstFrame = initFrame self.frameCount = self.firstFrame self.lastFrame = lastFrame self.vel = vel self.Running = Running self.nframes = self.lastFrame - self.firstFrame + 1 """ According to animation choose in interfAnim window, a group of frames will be interpolated. These animations will be played together in a timeline. @param anim: animation script""" print "animateObj Running ", self.animType, " ",self.Running if self.animType == "TransRot": self.anim, self.interptrans = anim_TransRot.anim_TransRot(self.firstFrame, self.lastFrame, self.nframes) #self.anim, self.interptrans, self.interpolate = self.anim.anim_TransRot() ##animation_scripts.anim_TransRot.anim_TransRot(self) ## Versao futura print "self.anim, self.interptrans, self.interpolate ", self.anim, "***", self.interptrans, "***", self.interpolate elif self.animType == "bringObj": self.anim, self.interptrans = anim_bringObj.anim_bringObj(self.firstFrame, self.lastFrame, self.nframes) elif self.animType == "topRight": self.anim, self.interptrans = anim_topRight.anim_topRight(self.firstFrame, self.lastFrame, self.nframes) elif self.animType == "topLeft": self.anim, self.interptrans = self.anim.anim_topLeft(self.firstFrame, self.lastFrame, self.nframes) elif self.animType == "botRight": self.anim, self.interptrans = self.anim.anim_botRight(self.firstFrame, self.lastFrame, self.nframes) elif self.animType == "botLeft": self.anim, self.interptrans = self.anim.anim_botLeft(self.firstFrame, self.lastFrame, self.nframes) #print "self.anim, self.interptrans, self.interpolate ", self.anim, "***", self.interptrans, "***", self.interpolate ##VER se precisa def playHandler(self, args): self.Running = args def scenePause(self, args): print "scenePause Running ", self.Running self.Running = args def setValue(self, value): self.horizontalSlider.setValue(value) def frameCount(self): return self.frameCount def playStop(self, args): self.playerExit = args if self.playerExit == 1: print "self.playerExit 1 ", self.playerExit self.Running = False self.frameCount = self.firstFrame self.emit(QtCore.SIGNAL("modelMoved(int)"), self.firstFrame) #return else: print "self.playerExit 2", self.playerExit self.Running == False #return def update2Scene(self, frame): self.frameCount = frame self.anim.updateObject (self.frameCount, -1, self.sceneElements) #self.repaint() #self.update() def updateScene(self): ## Animation procedure print "updateScene", self.Running, "self.frameCount ", self.frameCount, "self.lastFrame ", self.lastFrame if self.Running == False: return if self.frameCount > self.lastFrame: return if self.playerExit == 0: self.Running = False self.frameCount = self.firstFrame self.emit(QtCore.SIGNAL("modelMoved(int)"), self.firstFrame) return ## Updates selected object curent position, according to frameCount self.anim.updateObject (self.frameCount, -1, self.sceneElements) #self.repaint() #self.update() self.frameCount = self.frameCount + 1 print "self.frameCount, self.lastFrame ", self.frameCount, " ",self.lastFrame if self.frameCount <= self.lastFrame: ## Ultimo frame da pagina = 200 self.emit(QtCore.SIGNAL("modelMoved(int)"), self.frameCount) else: print "sai do updateScene" self.emit(QtCore.SIGNAL("quitPlayer(int)"), self.playerExit) def scenePause(self, args): print "scenePause Running ", self.Running self.Running = args def plotGraph(self): """Plot the animation curve from the current animation keyframe""" #import plot import numpy import pylab import matplotlib.axes3d #import plot #self.plot_frames() f = pylab.figure() ax = matplotlib.axes3d.Axes3D(f) #print "anim ", self.anim #ax.plot3D(array([ 0, 1, 2, 3 ]), array([ 0, 1, 2, 3 ]), # array([ 0, 1, 2, 3 ])) ax.plot3D(array(self.interptrans[0]), array(self.interptrans[1]), array(self.interptrans[2])) pylab.show() #********************************************************************************************************* # Basic file functions #********************************************************************************************************* def newProject(self): self.sceneElements = [] self.emit(QtCore.SIGNAL("sceneCleared")) self.newCursorModel() ## Includes a 3D Cursor in the scene. self.update() def autoSave(self): ## Salva contexto para undo/redo print "autoSave" self.fileName = "autosave.step" output = open(unicode(self.fileName), 'wb') cPickle.dump(self.sceneElements,output) output.close() ## Save presentation content in pickle file format with fileName default.step def savePresentation (self): self.fileName = "default.step" output = open(unicode(self.fileName), 'wb') cPickle.dump(self.sceneElements,output) output.close() ## Save presentation content in pickle file format with a given fileName defined in getSaveFileName dialog. def save_As_Presentation (self): self.exportStruct("Save Presentation As") def exportSlide(self): self.exportStruct("Export Slide") def exportStruct(self, type): fileName = QtGui.QFileDialog.getSaveFileName(self, type, "", "Presentations (*.step)") output = open(unicode(fileName), 'wb') cPickle.dump(self.sceneElements,output) output.close() def openPresentation (self): ## Restores presentation content from pickle file format and updates hierarchical presentation tree. self.newProject() self.importStruct("Open Presentation") def importSlide(self): self.importStruct("Import Slide") def importStruct(self, type): fileName = QtGui.QFileDialog.getOpenFileName(self, type, "", "Presentations (*.step)") if fileName: try: ## Restores presentation to a list. self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(Qt.WaitCursor))) output = open(unicode(fileName), 'rb') ## fileName is the path to the file chosen in getOpenFileName dialog. except (Exception, ): QMessageBox.warning(self, 'Error', 'Open project error.') else: try: self.sceneElements = cPickle.load(output) except (Exception, ): QMessageBox.warning(self, 'Error', 'Read project error.') finally: self.fileName = fileName for model in self.sceneElements: ## Updates hierarchical presentation tree self.emit(QtCore.SIGNAL("presentationLoaded"), (model.groups, model.objName)) self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(Qt.ArrowCursor))) output.close() #********************************************************************************************************* # 3D pre defined objetos - 3dcursor and shapes #********************************************************************************************************* ## Puts the object in the 3D point where the 3Dcursor is. def Cursor3DPosition(self): for model in self.sceneElements: ## Updates hierarchical presentation tree if model.objName == "cursor.obj": ## It's the 3Dcursor object. teste = self.sceneElements[0].getTransformation() print "cursor matrix ", teste[0] self.tx = teste[0] self.ty = teste[1] self.tz = teste[2] #self.rx = self.sceneElements[model.modelId].rx #self.ry = self.sceneElements[model.modelId].ry #self.rz = self.sceneElements[model.modelId].rz print "model.objName ",model.objName, self.tx, self.ty, self.tz #self.sceneElements[-1].setTranslate(self.tx, self.ty, self.tz) return self.tx, self.ty, self.tz # E'return mesmo? ## Include the 3D arrow model in the current frame. def newArrowModel(self): self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(3))) newArrow = visualElement("obj/arrow.obj", 9990, -1, None, False) self.tx, self.ty, self.tz = self.Cursor3DPosition() self.sceneElements.append(newArrow) self.emit(QtCore.SIGNAL("modelLoaded"), (newArrow.groups, newArrow.objName)) self.repaint() del newArrow self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) ## Include the 3D sphere model in the current frame def newSphereModel(self): self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(3))) newSphere = visualElement("obj/sphere.obj", 9991, -1, None, False) self.tx, self.ty, self.tz = self.Cursor3DPosition() self.sceneElements.append(newSphere) self.emit(QtCore.SIGNAL("modelLoaded"), (newSphere.groups, newSphere.objName)) self.repaint() del newSphere self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) ## Include the 3D cube model in the current frame def newCubeModel(self): self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(3))) newCube = visualElement("obj/cube.obj", 9992, -1, None, False) self.tx, self.ty, self.tz = self.Cursor3DPosition() self.sceneElements.append(newCube) self.emit(QtCore.SIGNAL("modelLoaded"), (newCube.groups, newCube.objName)) self.repaint() del newCube self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) ## Include the 3D cilynder model in the current frame def newCylinderModel(self): self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(3))) newCylinder = visualElement("obj/cylinder.obj", 9993, -1, None, False) self.tx, self.ty, self.tz = self.Cursor3DPosition() self.sceneElements.append(newCylinder) self.emit(QtCore.SIGNAL("modelLoaded"), (newCylinder.groups, newCylinder.objName)) self.repaint() del newCylinder self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) ## Include the 3D gear model in the current frame def newGearModel(self): self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(3))) newGear = visualElement("obj/gear.obj", 9994, -1, None, False) self.tx, self.ty, self.tz = self.Cursor3DPosition() self.sceneElements.append(newGear) self.emit(QtCore.SIGNAL("modelLoaded"), (newGear.groups, newGear.objName)) self.repaint() del newGear self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) ## Include the 3D star model in the current frame def newStarModel(self): self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(3))) newStar = visualElement("obj/star.obj", 9995, -1, None, False) self.tx, self.ty, self.tz = self.Cursor3DPosition() self.sceneElements.append(newStar) self.emit(QtCore.SIGNAL("modelLoaded"), (newStar.groups, newStar.objName)) self.repaint() del newStar self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) ## Include the clasp model in the current frame ## colchete def newClaspModel(self): self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(3))) new3DCursor = visualElement("obj/clasp.obj", 9996, -1, None, False) self.tx, self.ty, self.tz = self.Cursor3DPosition() self.sceneElements.append(new3DCursor) self.emit(QtCore.SIGNAL("modelLoaded"), (newClasp.groups, newClasp.objName)) self.repaint() del newClasp self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) ## Include the 3D cursor model in the current frame def newCursorModel(self): self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(3))) new3DCursor = visualElement("obj/cursor.obj", 0, -1, None, False) #self.Cursor3DPosition() self.sceneElements.append(new3DCursor) self.emit(QtCore.SIGNAL("modelLoaded"), (new3DCursor.groups, new3DCursor.objName)) self.repaint() del new3DCursor self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) def openModel(self): fileName = QtGui.QFileDialog.getOpenFileName(self, "Open File", "", "Models (*.obj)") if (fileName != ""): self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(Qt.WaitCursor))) if len(self.sceneElements): isCopy = False for index, model in enumerate(self.sceneElements): if model.modelPath == fileName: newModel = visualElement(fileName, self.sceneElements[-1].modelId + len(self.sceneElements[-1].groups) + 1, model.modelId, self.sceneElements[index].getGroupNames()) isCopy = True break if not isCopy: newModel = visualElement(fileName, self.sceneElements[-1].modelId + len(self.sceneElements[-1].groups) + 1, -1, None) else: newModel = visualElement(fileName, 0, -1, None, False) self.sceneElements.append(newModel) self.emit(QtCore.SIGNAL("modelLoaded"), (newModel.groups, newModel.objName)) del newModel self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(Qt.ArrowCursor))) def selectGroup(self, parent, item): if ((parent == "") and (item != "")): ##Se nao ha pai, mas ha item, entao e' modelo. for model in self.sceneElements: ##Identifica o indice do modelo selecionado na lista de modelos if (model.objName == item): self.selectedModel = model.modelId self.selectedGroup = -1 break else: for index, model in enumerate(self.sceneElements): ##Identifica o indice do modelo selecionado na lista de modelos if (model.objName == parent): self.selectedModel = model.modelId m_index = index break for group in self.sceneElements[m_index].groups: ##Identifica o indice do grupo selecionado if (group.groupName == item): self.selectedGroup = group.groupId break self.update() #def setDoc(self, doc): ## ******************************************************************************* ## * A deletar! Fun??es sobre o modelo de documenta??o descontinuado ## ******************************************************************************* #model, group = self.findSelections() #if (model != -1): # if (group != -1): # self.sceneElements[model].groups[group].groupText = doc # else: # self.sceneElements[model].objText = doc #def getCurrentDoc(self): ##******************************************************************************* ## * A deletar! Fun??es sobre o modelo de documenta??o descontinuado ## ******************************************************************************* #model, group = self.findSelections() #if (model != -1): # if (group != -1): # return self.sceneElements[model].groups[group].groupText # else: # return self.sceneElements[model].objText def textDoc(self, doc): #print "doc ", doc w, h = doc.size().width(), doc.size().height() docImage = QtGui.QImage(w, h, QtGui.QImage.Format_RGB32) docBounds = QtCore.QRectF(0, 0, w, h) painter = QtGui.QPainter() BGColor = QtGui.QColor(255,255,255) painter.begin(docImage) painter.fillRect(0, 0, w, h, BGColor) doc.drawContents(painter, docBounds) painter.end() if len(self.sceneElements): noteId = self.sceneElements[-1].modelId + len(self.sceneElements[-1].groups) + 1 else: noteId = 0 docImagePath = "docImage" + str(noteId) + ".jpeg" docImage.save(docImagePath, "JPEG", -1) print "docImage saved" newElement = visualElement(docImagePath, noteId, -1, None, True) #newElement.setRotate(45, 0, 0) newElement.setTranslate(0, 0.5, 0) self.sceneElements.append(newElement) #self.emit(QtCore.SIGNAL("modelLoaded"), (None, docImagePath)) del newElement """for noteId, note in enumerate(self.sceneNotes): if note.image == doc: newElem = visualElement( self.sceneElements.append( break if noteId == len(self.sceneNotes) newNote = visual self.sceneElements.append""" def textAnimation(self, doc): """ w, h = doc.size().width(), doc.size().height() docImage = QtGui.QImage(w, h, QtGui.QImage.Format_RGB32) docBounds = QtCore.QRectF(0, 0, w, h) painter = QtGui.QPainter() BGColor = QtGui.QColor(255,255,255) painter.begin(docImage) painter.fillRect(0, 0, w, h, BGColor) doc.drawContents(painter, docBounds) painter.end() if len(self.sceneElements): noteId = self.sceneElements[-1].modelId + len(self.sceneElements[-1].groups) + 1 else: noteId = 0 docImagePath = "docImage" + str(noteId) + ".jpeg" docImage.save(docImagePath, "JPEG", -1) print "docImage saved" """ #Tem que ter um elementVisual a mais para animacao?? Acho que nao """ docImagePath = doc if len(self.sceneElements): animId = self.sceneElements[-1].modelId + len(self.sceneElements[-1].groups) + 1 else: animId = 0 print "docImagePath, animId ", docImagePath, animId """ #Tem que ter um elementVisual a mais para animacao?? Acho que nao #newElement = visualElement(docImagePath, animId, -1, None, False) #newElement.setRotate(45, 0, 0) #newElement.setTranslate(0, 0.5, 0) ## Ver newElement 2008-05-02 #self.sceneElements.append(newElement) # Nao e um elemento visual. ## #print "*** animList = animType ",self.sceneElements[-1].animList # Incluir informação de animacao na arvore hierarquica #Nao e aqui self.sceneElements[-1].animList = [self.animType,self.initFrame, self.lastFrame] self.emit(QtCore.SIGNAL("animationLoaded"), (None, doc)) #del newElement """for noteId, note in enumerate(self.sceneNotes): if note.image == doc: newElem = visualElement( self.sceneElements.append( break if noteId == len(self.sceneNotes) newNote = visual self.sceneElements.append""" def findSelections(self): m_index = g_index = -1 for index1, model in enumerate(self.sceneElements): if (model.modelId == self.selectedModel): m_index = index1 for index2, group in enumerate(model.groups): if (group.groupId == self.selectedGroup): g_index = index2 break ##g_index = self.selectedGroup - self.selectedModel - 1 break return m_index, g_index ## Color edit dialog. def changeColor(self): white = QtGui.QColor(255,255,255) newColor = QtGui.QColorDialog.getColor(white, self) if newColor.isValid(): if self.selectedModel != -1: index_m, index_g = self.findSelections() if self.selectedGroup != -1: self.sceneElements[index_m].groups[index_g].setColor(newColor.red(), newColor.green(), newColor.blue()) else: self.sceneElements[index_m].setColor(newColor.red(), newColor.green(), newColor.blue()) def zoomOut(self): if -4.0 > self.eyeZ > -2.0: self.eyeZ -= 0.1 """ if self.selectedModel != -1: index_m, index_g = self.findSelections() if self.selectedGroup != -1: self.sceneElements[index_m].groups[index_g].setTranslate(0, 0, self.tz) self.sceneElements[index_m].groups[index_g].box = self.sceneElements[index_m].groups[index_g].box.transform(self.sceneElements[index_m].groups[index_g].getTransformationMatrix()) else: self.sceneElements[index_m].setTranslate(0, 0, self.tz) self.sceneElements[index_m].box = self.sceneElements[index_m].box.transform(self.sceneElements[index_m].getTransformationMatrix()) self.update() """ def zoomIn(self): if -4.0 > self.eyeZ > -2.0: self.eyeZ += 0.1 """ if self.selectedModel != -1: index_m, index_g = self.findSelections() if self.selectedGroup != -1: self.sceneElements[index_m].groups[index_g].setTranslate(0, 0, self.tz) self.sceneElements[index_m].groups[index_g].box = self.sceneElements[index_m].groups[index_g].box.transform(self.sceneElements[index_m].groups[index_g].getTransformationMatrix()) else: self.sceneElements[index_m].setTranslate(0, 0, self.tz) self.sceneElements[index_m].box = self.sceneElements[index_m].box.transform(self.sceneElements[index_m].getTransformationMatrix()) self.update() """ def scaleFactor(self, oper): ## Used to shortcut s and scale button either. if oper == 's': ## minus operation #self.sx = self.newpt[0] - self.lastpt[0] self.sx = self.sx * 0.9 self.sy = self.sy * 0.9 self.sz = self.sz * 0.9 else: ## add operation self.sx = self.sx * 1.1 self.sy = self.sy * 1.1 self.sz = self.sz * 1.1 self.scale() def scale(self): if self.selectedModel != -1: index_m, index_g = self.findSelections() if self.selectedGroup != -1: ## Scales selected group self.sceneElements[index_m].groups[index_g].setScale(self.sx, self.sy, self.sz) self.sceneElements[index_m].groups[index_g].box = self.sceneElements[index_m].groups[index_g].box.transform(self.sceneElements[index_m].groups[index_g].getTransformationMatrix()) else: ## Scales the hole selected object self.sceneElements[index_m].setScale(self.sx, self.sy, self.sz) self.sceneElements[index_m].box = self.sceneElements[index_m].box.transform(self.sceneElements[index_m].getTransformationMatrix()) self.update() #************************************************************************************************************** # Transformation routines #************************************************************************************************************** def translate(self): if self.selectedModel != -1: index_m, index_g = self.findSelections() if self.selectedGroup != -1: self.sceneElements[index_m].groups[index_g].setTranslate(self.tx, self.ty, 0.0) self.sceneElements[index_m].groups[index_g].box = self.sceneElements[index_m].groups[index_g].box.transform(self.sceneElements[index_m].groups[index_g].getTransformationMatrix()) else: print "self.sceneElements[0] ", self.sceneElements[0] self.sceneElements[index_m].setTranslate(self.tx, self.ty, 0.0) self.sceneElements[index_m].box = self.sceneElements[index_m].box.transform(self.sceneElements[index_m].getTransformationMatrix()) self.update() def translateObject (self,event): """Mouse drag callback when moving an object in the scene.""" global startx, starty #if self.selectedModel != -1: #print " translate object" if self.selectedModel != -1: index_m, index_g = self.findSelections() if self.selectedGroup != -1: #m = matrix.glinverse (self.getTransformationMatrix()) m = matrix.glinverse (self.sceneElements[index_m].groups[index_g].transformation) delta = gltransformvector (m,[event.x()-self.startx, self.starty-event.y(), 0]) self.sceneElements[index_m].groups[index_g].translate(*delta) self.sceneElements[index_m].groups[index_g].box = self.sceneElements[index_m].groups[index_g].box.transform(self.sceneElements[index_m].groups[index_g].getTransformationMatrix()) else: print "self.sceneElements[0] ", self.sceneElements[0] m = matrix.glinverse (self.sceneElements[index_m].transformation) delta = gltransformvector (m,[event.x()-self.startx, self.starty-event.y(), 0]) self.sceneElements[index_m].translate(*delta) self.sceneElements[index_m].box = self.sceneElements[index_m].box.transform(self.sceneElements[index_m].getTransformationMatrix()) self.update() #------------------------------------------------------------------------ self.startx,self.starty = event.x(),event.y() self.updateGL() #def addTranslate(self, tx, ty, tz): def translateScene(self, tx, ty, yz): for model in self.sceneElements: model.setTranslate(model.tx + tx, model.ty + ty, model.tz + tz) #def rotateScene(self, rx, ry, rz): def rotateScene(self, rx, ry, rz): for model in self.sceneElements: model.setRotate(model.rx + rx, model.ry + ry, model.rz + rz) def multScale(self, sx, sy, sz): for model in self.sceneElements: model.setScale(model.sx * sx, model.sy * sy, model.sz * sz) def setColor(self, r, g, b): for model in self.sceneElements: model.setColor(r, g, b) #******************************************************************************************** # Finding an'object position in 3D #******************************************************************************************** def pick(self,x,y): """Uses the OpenGL selection mechanism for figuring out which object lies at screen position (x,y). @param x,y: screen position. @return: the selection buffer, i.e., a list of tuples (mindepth, maxdepth, names), where names is a list of object names -- i.e., collection indices -- with the one on top of the stack last. Thus, if names==[3,10], then element 3 of this collection was hit and it was itself a collection whose element 10 was hit. """ # Prepare for picking glSelectBuffer(100) glRenderMode(GL_SELECT) viewport = glGetIntegerv (GL_VIEWPORT) projmatrix = glGetDoublev (GL_PROJECTION_MATRIX) glInitNames() glPushName(0) glMatrixMode (GL_MODELVIEW) glPushMatrix() glLoadIdentity () glMatrixMode (GL_PROJECTION) glPushMatrix () glLoadIdentity () # create 5x5 pixel picking region near cursor location gluPickMatrix (x, (viewport[3] - y), 5, 5, viewport); glMultMatrixd (projmatrix) self.drawScene(True) ## self.draw() glPopName() buffer = glRenderMode(GL_RENDER) # Restore modelview glMatrixMode (GL_MODELVIEW) glPopMatrix () # Restore projection glMatrixMode (GL_PROJECTION) glPopMatrix () # Process hits return list(buffer) def pickClosest (self, x, y): ## SEM USO?? """Uses the OpenGL selection mechanism for figuring out which object lies at screen position (x,y). Similar to pick, but returns only one object (the closest one). @param x,y: screen position. @return: A tuple (obj, z), where obj is the object and z is its z coordinate at the pick position. If no object lies at the given position, then obj is None.""" closest = None closestZ = 1.0 for hit in self.pick(x,y): print "hit" minz, maxz, name = hit z = 1.0 * minz / (2**32-1) if z < closestZ: closestZ,closest = z, self[name[0]] return (closest, closestZ) def renderPick(self, x, y): """Uses the OpenGL selection mechanism for figuring out which models were selected lies at screen position (x,y). Similar to pick, but returns only one object (the closest one). @param x,y: screen position. """ self.sceneRenderSetUp() ## Tem dentro do draw? mas precisa. Porque? ##Prepares for picking glSelectBuffer(100) glRenderMode(GL_SELECT) viewport = glGetIntegerv(GL_VIEWPORT) projMatrix = glGetDoublev(GL_PROJECTION_MATRIX) glInitNames() glPushName(0) glMatrixMode(GL_PROJECTION) glPushMatrix() glLoadIdentity() ##Creates 5x5 pixel picking region near cursor location gluPickMatrix (x, (viewport[3] - y), 5, 5, viewport); glMultMatrixd (projMatrix) self.drawScene(True) buffer = glRenderMode(GL_RENDER) ##Restores projection glMatrixMode(GL_PROJECTION) glPopMatrix() ##Processes hits picked = [] for hitRecord in buffer: minDepth, maxDepth, names = hitRecord picked.append(names[-1]-1) print "picked ", picked if (picked): self.selectedGroup = picked[-1] + 1 for model in self.sceneElements: if ((model.modelId + len(model.groups)) > self.selectedGroup): for group in range(0, len(model.groups)): if model.groups[group].groupId == self.selectedGroup: self.selectedModel = model.groups[group].parentId selectionName = model.groups[group].groupName #self.emit(QtCore.SIGNAL("objectSelected"), (selectionName)) COMENTADO PARA TESTES COM DOCUMENTAÇÃO self.update() return picked #************************************************************************************************************** # Mouse controls #************************************************************************************************************** def defaultMouseMoveEvent (self, event): """This mouse motion function does nothing.""" pass def mouseMoveEvent (self, event): """Calls an apropriate function to handle mouse move events""" self.motionfunc (event) ## Records the double click event def mouseDoubleClickEvent(self, event): print "recurso de interface nao definido para o duplo clique" ## Triggered by any mouse click event def mouseClickEvent(self, event): print "mover cursor 3D" self.Cursor3DPosition() ## Change 3DCursor Position def mousePressEvent (self, event): """Handles mouse button press events.""" def screencoords (obj): """Returns the screen coordinates of the center of an object of the scene.""" glMatrixMode (GL_MODELVIEW) glLoadIdentity() glMultMatrixd (self.scene.transformation) ##VER glMultMatrixd (obj.transformation) ##VER viewport = glGetIntegerv (GL_VIEWPORT) projmatrix = glGetDoublev (GL_PROJECTION_MATRIX) modelviewmatrix = glGetDoublev (GL_MODELVIEW_MATRIX) x,y,z = obj.box.center return gluProject (x,y,z,modelviewmatrix,projmatrix,viewport) self.startx, self.starty = x,y = event.x(), event.y() print "Mouse press - len(self.sceneElements)", len(self.sceneElements) if event.buttons() & Qt.LeftButton: # Associated with scene or object rotation self.rotacao = True if len(self.sceneElements): ##Se ha elemento 3D na cena, testa a selecao por clique. print "x, y ", x, y #self.picked = self.pickClosest(x,y)[0] #Esperanca self.picked = self.scene.pickClosest(x,y)[0] self.picked = self.renderPick(x,y) #print "self.picked ", self.picked print "self.picked ", self.picked #if self.picked is None: ## Transformation will be applied to all scene if not self.picked: ## Transformation will be applied to all scene #if self.picked is None: ## Transformation will be applied to all scene print "rotateScene" center = matrix.gltransformpoint (self.sceneElements.transformation, self.sceneElements.box.center) self.arcball = ArcBall (center, self.sceneElements.box.radius()) self.motionfunc = self.rotateScene else: ## Transformation will be applied to the selected object print "rotateObject" #Tirei self.arcball = ArcBall (screencoords(self), # self.picked.box.radius()) """ Obter center side do objeto selecionado. com modelId em self.picked """ self.arcball = ArcBall (self.coords, self.radius) self.motionfunc = self.rotateObject elif event.buttons() & Qt.RightButton: # Associated with scene or object translation #Esperanca self.picked = self.scene.pickClosest(x,y)[0] if len(self.sceneElements): ##Se ha elemento 3D na cena, testa a selecao por clique. #self.picked = self.pickClosest(x,y)[0] #self.picked = self.renderPick(x,y) #Esperanca self.picked = self.renderPick(x,y) #if self.picked is None: ## Transformation will be applied to all scene if not self.picked: ## Transformation will be applied to all scene print "translateScene" #self.motionfunc = self.addTranslate self.motionfunc = self.translateScene else: print "translateObject" self.motionfunc = self.translateObject elif event.buttons() & Qt.MidButton: # Associated with scene or object scale #Esperanca self.picked = self.scene.pickClosest(x,y)[0] if len(self.sceneElements): ##Se ha elemento 3D na cena, testa a selecao por clique. #self.picked = self.pickClosest(x,y)[0] #self.picked = self.renderPick(x,y) #Esperanca self.picked = self.renderPick(x,y) #if self.picked is None: ## Transformation will be applied to all scene if not self.picked: ## Transformation will be applied to all scene print "scaleScene" self.motionfunc = self.scaleScene else: print "scaleObject" self.motionfunc = self.scaleObject elif event.buttons() & Qt.RightButton: # Associated with scene or object translation if len(self.sceneElements): ##Se ha elemento 3D na cena, testa a selecao por clique. self.picked = self.renderPick(x,y) print "self.picked ", self.picked #Esperanca self.picked = self.scene.pickClosest(x,y)[0] #if self.picked is None: ## Transformation will be applied to all scene if self.picked == -1: ## Transformation will be applied to all scene #self.motionfunc = self.translateScene self.motionfunc = self.translateScene else: self.motionfunc = self.translateObject elif event.buttons() & Qt.MidButton: if len(self.sceneElements): ##Se ha elemento 3D na cena, testa a selecao por clique. self.picked = self.renderPick(x,y) print "self.picked ", self.picked #Esperanca self.picked = self.scene.pickClosest(x,y)[0] if self.picked is None: ## Transformation will be applied to all scene self.motionfunc = self.scaleScene else: self.motionfunc = self.scaleObject def mouseReleaseEvent (self, event): """Handles mouse button release events.""" self.motionfunc = self.defaultMouseMoveEvent ##Esperanca self.scene.computeBoundingBox() ##def computeBoundingBox(self): ## Ficava na classe graphicobjectcollection """Recomputes this collection's bounding box. Should be called before using the bounding box if it is not certain whether any of the elements' boxes have been modified. """ allPoints = [] from scene import matrix for obj in self.sceneElements: if isinstance(obj,GraphicObject): allPoints += map(lambda p: matrix.gltransformpoint (obj.transformation, p), obj.box.vertices()) self.box = BoundingBox.fromPoints(allPoints) """ if self.selectedModel != -1: ## computeBoundingBox index_m, index_g = self.findSelections() if self.selectedGroup != -1: self.sceneElements[index_m].groups[index_g].box = self.sceneElements[index_m].groups[index_g].box.transform(self.sceneElements[index_m].groups[index_g].transformation) else: self.sceneElements[index_m].box = self.sceneElements[index_m].box.transform(self.sceneElements[index_m].transformation) self.update() self.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) self.updateGL() """ # Escrever texto na tela com a rotina do Victor def drawText( self, value, x,y, windowHeight, windowWidth, step = 18 ): """Draw the given text at given 2D position in window""" print "value ", value glMatrixMode(GL_PROJECTION); # For some reason the GL_PROJECTION_MATRIX is overflowing with a single push! # glPushMatrix() matrix = glGetDouble( GL_PROJECTION_MATRIX ) glLoadIdentity(); glOrtho(0.0, windowHeight or 32, 0.0, windowWidth or 32, -1.0, 1.0) glMatrixMode(GL_MODELVIEW); #glPushMatrix(); glLoadIdentity(); glRasterPos2i(x, y); lines = 0 for character in value: print "character", character if character == '\n': glRasterPos2i(x, y-(lines*18)) else: glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, ord(character)) # Cmd nao funciona glPopMatrix() glMatrixMode(GL_PROJECTION) # For some reason the GL_PROJECTION_MATRIX is overflowing with a single push! #glPopMatrix() glLoadMatrixd( matrix ) # should have un-decorated alias for this... glMatrixMode(GL_MODELVIEW); def delSceneElement(self): if self.selectedModel == 0: ## 3D Cursor can't be deleted. print "3D Cursor can't be deleted." return if self.selectedModel != -1: index_m, index_g = self.findSelections() if self.selectedGroup != -1: self.emit(QtCore.SIGNAL("modelDeleted")) del self.sceneElements[index_m].groups[index_g] #self.emit(QtCore.SIGNAL("modelDeleted"), (index_m,index_g)) #self.sceneElements[index_m].groups[index_g].box = self.sceneElements[index_m].groups[index_g].box.transform(self.sceneElements[index_m].groups[index_g].getTransformationMatrix()) else: #self.sceneElements[index_m].box = self.sceneElements[index_m].box.transform(self.sceneElements[index_m].getTransformationMatrix()) #self.emit(QtCore.SIGNAL("modelDeleted"), (index_m,0)) del self.sceneElements[index_m] self.emit(QtCore.SIGNAL("modelDeleted")) def wheelControl(self): ## Controls increasing/decreasing of distance from screen commanded from mouse wheel. if self.selectedModel != -1: index_m, index_g = self.findSelections() if self.selectedGroup != -1: self.sceneElements[index_m].groups[index_g].setTranslate(0, 0, self.tz) self.sceneElements[index_m].groups[index_g].box = self.sceneElements[index_m].groups[index_g].box.transform(self.sceneElements[index_m].groups[index_g].getTransformationMatrix()) else: self.sceneElements[index_m].setTranslate(0, 0, self.tz) self.sceneElements[index_m].box = self.sceneElements[index_m].box.transform(self.sceneElements[index_m].getTransformationMatrix()) self.update() def wheelEvent(self, event): if event.delta() > 0: ## Wheel control - increase distance of the objects about the camera. self.eyeZ= self.eyeZ + 0.1 #self.wheelControl() elif event.delta() < 0: ## Wheel control - decrease distance of the objects about the camera. self.eyeZ= self.eyeZ - 0.1 #self.wheelControl() self.repaint() #self.update() #************************************************************************************************************* # Key controls #************************************************************************************************************* def copy(self): if os.name == "nt": ## Windows operation system. self.tempBuffer = cPickle.dumps(self.sceneElements) print "self.tempBuffer ", self.tempBuffer else: ## Grava o buffer em disco, permitindo restauracao em outra sessao do programa. self.fileName = "tempBuffer.step" output = open(unicode(self.fileName), 'wb') cPickle.dump(self.sceneElements,output) output.close() def cut(self): self.copy() ## Copia objetos selecionados para area temporaria self.delSceneElement() ## Retira objetos copiados da cena def paste(self): if os.name == "nt": ## Windows operation system. self.sceneElements =cPickle.loads(self.tempBuffer) print "self.tempBuffer ", self.tempBuffer else: ## Grava o buffer em disco, permitindo restauracao em outra sessao do programa. self.fileName = "tempBuffer.step" output = open(unicode(self.fileName), 'rb') self.sceneElements = cPickle.load(output) output.close() def keyMovement(self): ## Arrow movement (left or right) if self.selectedModel != -1: index_m, index_g = self.findSelections() if self.selectedGroup != -1: self.sceneElements[index_m].groups[index_g].setTranslate(self.tx, self.ty, self.tz) self.sceneElements[index_m].groups[index_g].box = self.sceneElements[index_m].groups[index_g].box.transform(self.sceneElements[index_m].groups[index_g].getTransformationMatrix()) else: self.sceneElements[index_m].setTranslate(self.tx, self.ty, self.tz) if self.selectedModel != 0: ## Create boundingBox to all selected objects, expect for 3D cursor self.sceneElements[index_m].box = self.sceneElements[index_m].box.transform(self.sceneElements[index_m].getTransformationMatrix()) self.update() def keyPressEvent(self, event): self.key = QString() if event.key() == Qt.Key_Delete: ##Delete selected object or group self.delSceneElement() elif event.key() == QtCore.Qt.Key_Left: self.tx += 0.1 self.keyMovement() elif event.key() == QtCore.Qt.Key_Right: self.tx -= 0.1 self.keyMovement() elif event.key() == QtCore.Qt.Key_Up: self.tz = self.tz + 0.1 self.wheelControl() ## Does the same procedure as event.mouse_wheel() > 0 elif event.key() == QtCore.Qt.Key_Down: self.tz = self.tz - 0.1 self.wheelControl() ## Does the same procedure as event.mouse_wheel() < 0: elif event.modifiers() & Qt.AltModifier: ## Keyboard shortcut to scaling print "alt key" if event.text() == 's': ## Diminishes selected objects self.scaleFactor('s') self.scale() elif event.text() == 'S': self.scaleFactor('S') ## Expands selected objects self.scale() elif event.key() == '+': ## Keyboard shortcut to wheel control - increase position along the Z axis self.tz = self.tz + 0.1 self.wheelControl() elif event.key() == '-': ## Keyboard shortcut to wheel control - decrease position along the Z axis self.tz = self.tz + 0.1 self.wheelControl() elif event.modifiers() & Qt.ControlModifier: print "control key" ## Evento sem funcionalidade ainda elif event.modifiers() & Qt.ShiftModifier: print "shift key" ## Shitf key pressed will be used to indicate multiple elections. elif event.text() == "a": ##Wait sceneTime time to display screen objects print "Keyboard shortcut a" elif event.text() == "d": ##Wait sceneTime time to hide screen objects print "Keyboard shortcut d" elif event.text() == "f": ##Move objects far from camera print "Keyboard shortcut f" elif event.text() == "c": ##Cut selected objects to clipboard print "Keyboard shortcut cut object" ## Futuro: Para o objeto / grupo selecionado self.cut() elif event.text() == "d": ##Duplicate selected objects from clipboard print "Keyboard shortcut to duplicate object" self.copy() elif event.text() == "p": ##Past clipboard content to scene print "Keyboard shortcut to past clipboard content to scene" self.paste() self.update()
Python
#!/usr/bin/env python """extremely simple demonstration playing a soundfile and waiting for it to finish. you'll need the pygame.mixer module for this to work. Note how in this simple example we don't even bother loading all of the pygame package. Just pick the mixer for sound and time for the delay function.""" import os.path import pygame.mixer, pygame.time mixer = pygame.mixer time = pygame.time def sound_music(): #choose a desired audio format mixer.init(11025) #raises exception on fail #load the sound file = 'music.wav' sound = mixer.Sound(file) #start playing print 'Playing Sound...' channel = sound.play() #poll until finished while channel.get_busy(): #still playing print ' ...still going...' time.wait(1000) print '...Finished'
Python
#!/usr/bin/env python """extremely simple demonstration playing a soundfile and waiting for it to finish. you'll need the pygame.mixer module for this to work. Note how in this simple example we don't even bother loading all of the pygame package. Just pick the mixer for sound and time for the delay function.""" import os.path import pygame.mixer, pygame.time mixer = pygame.mixer time = pygame.time #choose a desired audio format mixer.init(11025) #raises exception on fail #load the sound #file = 'som/music.wav' file = 'music.wav' sound = mixer.Sound(file) #start playing print 'Playing Sound...' channel = sound.play() #poll until finished while channel.get_busy(): #still playing print ' ...still going...' time.wait(1000) print '...Finished'
Python
#!/usr/bin/env python """extremely simple demonstration playing a soundfile and waiting for it to finish. you'll need the pygame.mixer module for this to work. Note how in this simple example we don't even bother loading all of the pygame package. Just pick the mixer for sound and time for the delay function.""" import os.path import pygame.mixer, pygame.time mixer = pygame.mixer time = pygame.time def sound_music(): #choose a desired audio format mixer.init(11025) #raises exception on fail #load the sound file = 'music.wav' sound = mixer.Sound(file) #start playing print 'Playing Sound...' channel = sound.play() #poll until finished while channel.get_busy(): #still playing print ' ...still going...' time.wait(1000) print '...Finished'
Python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'interfQtPrototipo.ui' # # Created: Tue Apr 15 21:47:42 2008 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! import sys from PyQt4 import QtCore, QtGui class Ui_MainWindow(object): ## __side - o anderscore duplo e' um recurso para tornar o atributo privado. #def __init__(self, MainWindow): #self.__side = side def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(QtCore.QSize(QtCore.QRect(0,0,800,600).size()).expandedTo(MainWindow.minimumSizeHint())) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(5),QtGui.QSizePolicy.Policy(5)) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setMinimumSize(QtCore.QSize(10,10)) MainWindow.setSizeIncrement(QtCore.QSize(1,1)) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") #-------------------------- self.gridlayout = QtGui.QGridLayout(self.centralwidget) self.gridlayout.setMargin(9) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.gridlayout1 = QtGui.QGridLayout() self.gridlayout1.setMargin(0) self.gridlayout1.setSpacing(6) self.gridlayout1.setObjectName("gridlayout1") self.hboxlayout = QtGui.QHBoxLayout() self.hboxlayout.setMargin(0) self.hboxlayout.setSpacing(6) self.hboxlayout.setObjectName("hboxlayout") self.gridlayout1.addLayout(self.hboxlayout,0,0,1,1) self.timeline = QtGui.QWidget(self.centralwidget) self.timeline.setObjectName("timeline") self.gridlayout1.addWidget(self.timeline,0,1,1,1) self.gridlayout.addLayout(self.gridlayout1,0,0,1,1) self.hboxlayout1 = QtGui.QHBoxLayout() self.hboxlayout1.setMargin(0) self.hboxlayout1.setSpacing(6) self.hboxlayout1.setObjectName("hboxlayout1") self.pauseButton = QtGui.QPushButton(self.centralwidget) self.pauseButton.setObjectName("pauseButton") self.hboxlayout1.addWidget(self.pauseButton) self.horizontalSlider = QtGui.QSlider(self.centralwidget) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setObjectName("horizontalSlider") self.hboxlayout1.addWidget(self.horizontalSlider) self.quitButton = QtGui.QPushButton(self.centralwidget) self.quitButton.setObjectName("quitButton") self.hboxlayout1.addWidget(self.quitButton) self.gridlayout.addLayout(self.hboxlayout1,1,0,1,1) MainWindow.setCentralWidget(self.centralwidget) #-------------------------- self.widget = glWidget(self.centralwidget) self.glWidgetArea = QtGui.QScrollArea() self.glWidgetArea.setWidget(self.widget) self.glWidgetArea.setGeometry(QtCore.QRect(20,30,300,211)) self.glWidgetArea.setObjectName("widget") self.glWidgetArea.setWidgetResizable(True) self.glWidgetArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.glWidgetArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.glWidgetArea.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored) self.glWidgetArea.setMinimumSize(50, 50) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(3),QtGui.QSizePolicy.Policy(3)) sizePolicy.setHorizontalStretch(3) sizePolicy.setVerticalStretch(1) self.glWidgetArea.setSizePolicy(sizePolicy) self.gridlayout.addWidget(self.glWidgetArea, 0, 0) #-------------------------- self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0,0,818,21)) self.menubar.setObjectName("menubar") self.menuHelp = QtGui.QMenu(self.menubar) self.menuHelp.setObjectName("menuHelp") self.menu_View = QtGui.QMenu(self.menubar) self.menu_View.setObjectName("menu_View") self.menu_Toolbar = QtGui.QMenu(self.menu_View) self.menu_Toolbar.setObjectName("menu_Toolbar") self.menu_Windows = QtGui.QMenu(self.menu_View) self.menu_Windows.setObjectName("menu_Windows") self.menuFile = QtGui.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.menuEdit = QtGui.QMenu(self.menubar) self.menuEdit.setObjectName("menuEdit") self.menuInsert = QtGui.QMenu(self.menubar) self.menuInsert.setObjectName("menuInsert") MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.createBar_Main(MainWindow) self.createBar_Content(MainWindow) self.createBar_Draw(MainWindow) self.createBar_Animation(MainWindow) self.createBar_Documentation(MainWindow) self.dockWidget = QtGui.QDockWidget(MainWindow) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(3),QtGui.QSizePolicy.Policy(3)) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.dockWidget.sizePolicy().hasHeightForWidth()) self.dockWidget.setSizePolicy(sizePolicy) self.dockWidget.setMinimumSize(QtCore.QSize(137,300)) self.dockWidget.setMaximumSize(QtCore.QSize(960,1280)) self.dockWidget.setSizeIncrement(QtCore.QSize(1,1)) self.dockWidget.setBaseSize(QtCore.QSize(80,100)) self.dockWidget.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) self.dockWidget.setAutoFillBackground(False) self.dockWidget.setFloating(False) self.dockWidget.setObjectName("dockWidget") self.dockWidgetContents = QtGui.QWidget(self.dockWidget) self.dockWidgetContents.setObjectName("dockWidgetContents") self.treeWidget = QtGui.QTreeWidget(self.dockWidgetContents) self.treeWidget.setWindowModality(QtCore.Qt.NonModal) self.treeWidget.setGeometry(QtCore.QRect(9,9,129,469)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(3),QtGui.QSizePolicy.Policy(3)) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.treeWidget.sizePolicy().hasHeightForWidth()) self.treeWidget.setSizePolicy(sizePolicy) self.treeWidget.setMinimumSize(QtCore.QSize(120,300)) self.treeWidget.setMaximumSize(QtCore.QSize(400,640)) self.treeWidget.setSizeIncrement(QtCore.QSize(1,1)) self.treeWidget.setBaseSize(QtCore.QSize(100,300)) self.treeWidget.setFrameShape(QtGui.QFrame.VLine) self.treeWidget.setFrameShadow(QtGui.QFrame.Raised) self.treeWidget.setMidLineWidth(1) self.treeWidget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.treeWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.treeWidget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) self.treeWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems) self.treeWidget.setObjectName("treeWidget") self.dockWidget.setWidget(self.dockWidgetContents) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1),self.dockWidget) self.actionScene = QtGui.QAction(MainWindow) self.actionScene.setObjectName("actionScene") self.actionNote_Editor = QtGui.QAction(MainWindow) self.actionNote_Editor.setObjectName("actionNote_Editor") self.action3D_Model = QtGui.QAction(MainWindow) self.action3D_Model.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_elemento_3D.png")) self.action3D_Model.setObjectName("action3D_Model") self.actionOpenfile = QtGui.QAction(MainWindow) self.actionOpenfile.setEnabled(False) self.actionOpenfile.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_open.png")) self.actionOpenfile.setObjectName("actionOpenfile") self.actionBasic_File_Functions = QtGui.QAction(MainWindow) self.actionBasic_File_Functions.setObjectName("actionBasic_File_Functions") self.actionAnimation = QtGui.QAction(MainWindow) self.actionAnimation.setObjectName("actionAnimation") self.actionDocumentation = QtGui.QAction(MainWindow) self.actionDocumentation.setObjectName("actionDocumentation") self.actionDraw = QtGui.QAction(MainWindow) self.actionDraw.setObjectName("actionDraw") self.action3DbyStep_Documentation = QtGui.QAction(MainWindow) self.action3DbyStep_Documentation.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_ajuda.png")) self.action3DbyStep_Documentation.setObjectName("action3DbyStep_Documentation") self.actionAbout = QtGui.QAction(MainWindow) self.actionAbout.setObjectName("actionAbout") self.action_Picture = QtGui.QAction(MainWindow) self.action_Picture.setIcon(QtGui.QIcon(":/new/prefix1/icones/picture.JPG")) self.action_Picture.setObjectName("action_Picture") self.actionPicture = QtGui.QAction(MainWindow) self.actionPicture.setIcon(QtGui.QIcon(":/new/prefix1/icones/picture.JPG")) self.actionPicture.setObjectName("actionPicture") self.action_3DModel1 = QtGui.QAction(MainWindow) self.action_3DModel1.setIcon(QtGui.QIcon(":/new/prefix1/icones/Fontes/elemento_3D.JPG")) self.action_3DModel1.setObjectName("action_3DModel1") self.actionSound = QtGui.QAction(MainWindow) self.actionSound.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_sound.png")) self.actionSound.setObjectName("actionSound") self.action_Cut = QtGui.QAction(MainWindow) self.action_Cut.setIcon(QtGui.QIcon(":/new/prefix1/icones/cut.PNG")) self.action_Cut.setObjectName("action_Cut") self.action_Paste = QtGui.QAction(MainWindow) self.action_Paste.setIcon(QtGui.QIcon(":/new/prefix1/icones/past.png")) self.action_Paste.setObjectName("action_Paste") self.action_Copy = QtGui.QAction(MainWindow) self.action_Copy.setIcon(QtGui.QIcon(":/new/prefix1/icones/copy.png")) self.action_Copy.setObjectName("action_Copy") self.action_Undo = QtGui.QAction(MainWindow) self.action_Undo.setIcon(QtGui.QIcon(":/new/prefix1/icones/undo2.png")) self.action_Undo.setObjectName("action_Undo") self.action_Redo = QtGui.QAction(MainWindow) self.action_Redo.setIcon(QtGui.QIcon(":/new/prefix1/icones/redo2.PNG")) self.action_Redo.setObjectName("action_Redo") self.actionOpen_Model = QtGui.QAction(MainWindow) self.actionOpen_Model.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_open_model.PNG")) self.actionOpen_Model.setObjectName("actionOpen_Model") self.actionDocumentation_2 = QtGui.QAction(MainWindow) self.actionDocumentation_2.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_incluir_documentacao.png")) self.actionDocumentation_2.setObjectName("actionDocumentation_2") self.menuHelp.addAction(self.action3DbyStep_Documentation) self.menuHelp.addAction(self.actionAbout) self.menu_Toolbar.addAction(self.actionBasic_File_Functions) self.menu_Toolbar.addAction(self.actionDocumentation) self.menu_Toolbar.addAction(self.actionDraw) self.menu_Toolbar.addAction(self.actionPresentation_Content) self.menu_Windows.addAction(self.actionStructure_Content) self.menu_Windows.addAction(self.actionScene) self.menu_Windows.addAction(self.actionNote_Editor) self.menu_Windows.addSeparator() self.menu_Windows.addAction(self.action3D_Model) self.menu_Windows.addAction(self.actionOpenfile) self.menu_View.addAction(self.menu_Windows.menuAction()) self.menu_View.addAction(self.menu_Toolbar.menuAction()) self.menu_View.addSeparator() self.menuFile.addAction(self.action_Presentation) self.menuFile.addSeparator() self.menuFile.addAction(self.action_New) self.menuFile.addAction(self.action_Import) self.menuFile.addAction(self.action_Export) self.menuFile.addSeparator() self.menuFile.addAction(self.action_Save) self.menuFile.addAction(self.actionSave_As) self.menuFile.addSeparator() self.menuFile.addSeparator() self.menuFile.addAction(self.action_Quit) self.menuEdit.addAction(self.action_Cut) self.menuEdit.addAction(self.action_Paste) self.menuEdit.addAction(self.action_Copy) self.menuEdit.addAction(self.action_Undo) self.menuEdit.addAction(self.action_Redo) self.menuInsert.addAction(self.actionPicture) self.menuInsert.addAction(self.action_3DModel) self.menuInsert.addAction(self.actionSound) self.menuInsert.addAction(self.actionDocumentation_2) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuEdit.menuAction()) self.menubar.addAction(self.menuInsert.menuAction()) self.menubar.addAction(self.menu_View.menuAction()) self.menubar.addAction(self.menuHelp.menuAction()) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) """self.gridlayout = QtGui.QGridLayout() #self.gridlayout.setMargin(0) #self.gridlayout.setSpacing(6) #self.gridlayout.setObjectName("gridlayout") # Inclui self.gridlayout.addWidget(self.dockWidget, 0, 0) self.gridlayout.addWidget(self.glWidgetArea, 0, 1) self.gridlayout.addWidget(self.timeline, 1, 0, 1, 2) """ #hboxlayout self.centralwidget.setLayout(self.gridlayout) self.retranslateUi(MainWindow) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "3DbyStep", None, QtGui.QApplication.UnicodeUTF8)) self.quitButton.setText(QtGui.QApplication.translate("MainWindow", "Quit", None, QtGui.QApplication.UnicodeUTF8)) self.pauseButton.setText(QtGui.QApplication.translate("MainWindow", "Resume", None, QtGui.QApplication.UnicodeUTF8)) self.menuHelp.setTitle(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8)) self.menu_View.setTitle(QtGui.QApplication.translate("MainWindow", "&View", None, QtGui.QApplication.UnicodeUTF8)) self.menu_Toolbar.setTitle(QtGui.QApplication.translate("MainWindow", "&Toolbar", None, QtGui.QApplication.UnicodeUTF8)) self.menu_Windows.setTitle(QtGui.QApplication.translate("MainWindow", "&Windows", None, QtGui.QApplication.UnicodeUTF8)) self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) self.menuEdit.setTitle(QtGui.QApplication.translate("MainWindow", "Edit", None, QtGui.QApplication.UnicodeUTF8)) self.menuInsert.setTitle(QtGui.QApplication.translate("MainWindow", "Insert", None, QtGui.QApplication.UnicodeUTF8)) self.toolBar_Main.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Main toolBar", None, QtGui.QApplication.UnicodeUTF8)) self.toolBar_Content.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Content toolBar", None, QtGui.QApplication.UnicodeUTF8)) self.toolBar_Draw.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Draw toolBar", None, QtGui.QApplication.UnicodeUTF8)) self.toolBar_Animation.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Animation toolBar", None, QtGui.QApplication.UnicodeUTF8)) self.toolBar_Documentation.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Documentation toolBar", None, QtGui.QApplication.UnicodeUTF8)) self.dockWidget.setToolTip(QtGui.QApplication.translate("MainWindow", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:8pt;\">Show Presentation Hierarchyl Structure</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) self.dockWidget.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Hierarchy", None, QtGui.QApplication.UnicodeUTF8)) self.treeWidget.setToolTip(QtGui.QApplication.translate("MainWindow", "Current Hierarchy Structure", None, QtGui.QApplication.UnicodeUTF8)) self.treeWidget.headerItem().setText(0,QtGui.QApplication.translate("MainWindow", "Presentation Name", None, QtGui.QApplication.UnicodeUTF8)) self.actionScene.setText(QtGui.QApplication.translate("MainWindow", "Scene", None, QtGui.QApplication.UnicodeUTF8)) self.actionNote_Editor.setText(QtGui.QApplication.translate("MainWindow", "Note Editor", None, QtGui.QApplication.UnicodeUTF8)) self.action3D_Model.setText(QtGui.QApplication.translate("MainWindow", "3D Model", None, QtGui.QApplication.UnicodeUTF8)) self.actionOpenfile.setText(QtGui.QApplication.translate("MainWindow", "Openfile", None, QtGui.QApplication.UnicodeUTF8)) self.actionBasic_File_Functions.setText(QtGui.QApplication.translate("MainWindow", "Basic File Functions", None, QtGui.QApplication.UnicodeUTF8)) self.actionDocumentation.setText(QtGui.QApplication.translate("MainWindow", "Documentation", None, QtGui.QApplication.UnicodeUTF8)) self.actionDraw.setText(QtGui.QApplication.translate("MainWindow", "Draw", None, QtGui.QApplication.UnicodeUTF8)) self.actionPresentation_Content.setText(QtGui.QApplication.translate("MainWindow", "Presentation_content", None, QtGui.QApplication.UnicodeUTF8)) self.action3DbyStep_Documentation.setText(QtGui.QApplication.translate("MainWindow", "&3DbyStep Documentation", None, QtGui.QApplication.UnicodeUTF8)) self.actionAbout.setText(QtGui.QApplication.translate("MainWindow", "&About", None, QtGui.QApplication.UnicodeUTF8)) self.action_Presentation.setText(QtGui.QApplication.translate("MainWindow", "Open &Presentation", None, QtGui.QApplication.UnicodeUTF8)) self.action_3DModel.setText(QtGui.QApplication.translate("MainWindow", "3D&Model", None, QtGui.QApplication.UnicodeUTF8)) self.action_Picture.setText(QtGui.QApplication.translate("MainWindow", "&Picture", None, QtGui.QApplication.UnicodeUTF8)) self.actionPicture.setText(QtGui.QApplication.translate("MainWindow", "Picture", None, QtGui.QApplication.UnicodeUTF8)) self.action_3DModel1.setText(QtGui.QApplication.translate("MainWindow", "3D&Model", None, QtGui.QApplication.UnicodeUTF8)) self.actionSound.setText(QtGui.QApplication.translate("MainWindow", "Sound", None, QtGui.QApplication.UnicodeUTF8)) self.action_Cut.setText(QtGui.QApplication.translate("MainWindow", "&Cut", None, QtGui.QApplication.UnicodeUTF8)) self.action_Paste.setText(QtGui.QApplication.translate("MainWindow", "&Paste", None, QtGui.QApplication.UnicodeUTF8)) self.action_Copy.setText(QtGui.QApplication.translate("MainWindow", "&Copy", None, QtGui.QApplication.UnicodeUTF8)) self.action_Undo.setText(QtGui.QApplication.translate("MainWindow", "&Undo", None, QtGui.QApplication.UnicodeUTF8)) self.action_Redo.setText(QtGui.QApplication.translate("MainWindow", "&Redo", None, QtGui.QApplication.UnicodeUTF8)) self.actionOpen_Model.setText(QtGui.QApplication.translate("MainWindow", "Model", None, QtGui.QApplication.UnicodeUTF8)) self.actionDocumentation_2.setText(QtGui.QApplication.translate("MainWindow", "Documentation", None, QtGui.QApplication.UnicodeUTF8)) def createBar_Main(self, MainWindow): #print "createBar_Main" self.toolBar_Main = QtGui.QToolBar(MainWindow) self.toolBar_Main.setOrientation(QtCore.Qt.Horizontal) self.toolBar_Main.setObjectName("toolBar_Main") MainWindow.addToolBar(self.toolBar_Main) self.action_New = QtGui.QAction(MainWindow) self.action_New.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_new.png")) self.action_New.setObjectName("action_New") self.action_Open = QtGui.QAction(MainWindow) self.action_Open.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_open.png")) self.action_Open.setObjectName("action_Open") self.action_Import = QtGui.QAction(MainWindow) self.action_Import.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_import.png")) self.action_Import.setObjectName("action_Import") self.action_Export = QtGui.QAction(MainWindow) self.action_Export.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_export.png")) self.action_Export.setObjectName("action_Export") self.action_Save = QtGui.QAction(MainWindow) self.action_Save.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_save.png")) self.action_Save.setObjectName("action_Save") self.actionSave_As = QtGui.QAction(MainWindow) self.actionSave_As.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_save_as.png")) self.actionSave_As.setObjectName("actionSave_As") self.action_Quit = QtGui.QAction(MainWindow) self.action_Quit.setIcon(QtGui.QIcon(":/new/prefix1/icones/exit.JPG")) self.action_Quit.setObjectName("action_Quit") self.action_3DModel = QtGui.QAction(MainWindow) self.action_3DModel.setIcon(QtGui.QIcon(":/new/prefix1/icones/Fontes/elemento_3D.JPG")) self.action_3DModel.setObjectName("action_3DModel") self.actionReload = QtGui.QAction(MainWindow) self.actionReload.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_reload.png")) self.actionReload.setObjectName("actionReload") self.toolBar_Main.addAction(self.action_New) self.toolBar_Main.addAction(self.action_Open) self.toolBar_Main.addAction(self.action_3DModel) self.toolBar_Main.addAction(self.action_Quit) self.toolBar_Main.addAction(self.actionReload) self.toolBar_Main.addSeparator() self.toolBar_Main.addAction(self.action_Import) self.toolBar_Main.addAction(self.action_Export) self.toolBar_Main.addSeparator() self.toolBar_Main.addAction(self.action_Save) self.toolBar_Main.addAction(self.actionSave_As) self.action_New.setText(QtGui.QApplication.translate("MainWindow", "&New", None, QtGui.QApplication.UnicodeUTF8)) self.action_Open.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) self.action_Quit.setText(QtGui.QApplication.translate("MainWindow", "Quit", None, QtGui.QApplication.UnicodeUTF8)) self.action_Quit.setToolTip(QtGui.QApplication.translate("MainWindow", "Quit Application", None, QtGui.QApplication.UnicodeUTF8)) self.actionReload.setText(QtGui.QApplication.translate("MainWindow", "Reload", None, QtGui.QApplication.UnicodeUTF8)) self.action_Import.setText(QtGui.QApplication.translate("MainWindow", "&Import", None, QtGui.QApplication.UnicodeUTF8)) self.action_Export.setText(QtGui.QApplication.translate("MainWindow", "&Export", None, QtGui.QApplication.UnicodeUTF8)) self.action_Save.setText(QtGui.QApplication.translate("MainWindow", "&Save", None, QtGui.QApplication.UnicodeUTF8)) self.actionSave_As.setText(QtGui.QApplication.translate("MainWindow", "Save &As", None, QtGui.QApplication.UnicodeUTF8)) def createBar_Content(self,MainWindow): self.toolBar_Content = QtGui.QToolBar(MainWindow) self.toolBar_Content.setOrientation(QtCore.Qt.Horizontal) self.toolBar_Content.setObjectName("toolBar_Content") MainWindow.addToolBar(QtCore.Qt.ToolBarArea(4),self.toolBar_Content) self.actionPresentation_Content = QtGui.QAction(MainWindow) self.actionPresentation_Content.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_apresentacao.png")) self.actionPresentation_Content.setObjectName("actionPresentation_Content") self.actionStructure_Content = QtGui.QAction(MainWindow) self.actionStructure_Content.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_pastas.png")) self.actionStructure_Content.setObjectName("actionStructure_Content") self.actionTransicao_Quadro = QtGui.QAction(MainWindow) self.actionTransicao_Quadro.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_transicao_quadros.png")) self.actionTransicao_Quadro.setObjectName("actionTransicao_Quadro") self.action_Presentation = QtGui.QAction(MainWindow) self.action_Presentation.setObjectName("action_Presentation") self.toolBar_Content.addAction(self.actionPresentation_Content) self.toolBar_Content.addAction(self.actionStructure_Content) self.toolBar_Content.addAction(self.actionTransicao_Quadro) self.actionTransicao_Quadro.setText(QtGui.QApplication.translate("MainWindow", "Transicao_Quadro", None, QtGui.QApplication.UnicodeUTF8)) self.actionStructure_Content.setText(QtGui.QApplication.translate("MainWindow", "Structure Contents", None, QtGui.QApplication.UnicodeUTF8)) def createBar_Draw(self,MainWindow): self.toolBar_Draw = QtGui.QToolBar(MainWindow) self.toolBar_Draw.setOrientation(QtCore.Qt.Vertical) self.toolBar_Draw.setObjectName("toolBar_Draw") MainWindow.addToolBar(QtCore.Qt.ToolBarArea(2),self.toolBar_Draw) self.actionZoom_In = QtGui.QAction(MainWindow) self.actionZoom_In.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_zoom_in.png")) self.actionZoom_In.setObjectName("actionZoom_In") self.actionZoom_Out = QtGui.QAction(MainWindow) self.actionZoom_Out.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_zoom_out.png")) self.actionZoom_Out.setObjectName("actionZoom_Out") self.action_Rotate = QtGui.QAction(MainWindow) self.action_Rotate.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_rotacao.png")) self.action_Rotate.setObjectName("action_Rotate") self.action_Translate = QtGui.QAction(MainWindow) self.action_Translate.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_transform.png")) self.action_Translate.setObjectName("action_Translate") self.action_Scale = QtGui.QAction(MainWindow) self.action_Scale.setIcon(QtGui.QIcon(":/new/prefix1/icones/scale_3D.PNG")) self.action_Scale.setObjectName("action_Scale") self.actionAction_ModelColor = QtGui.QAction(MainWindow) self.actionAction_ModelColor.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_model_color.PNG")) self.actionAction_ModelColor.setObjectName("actionAction_ModelColor") self.action_AnimAppear = QtGui.QAction(MainWindow) self.action_AnimAppear.setIcon(QtGui.QIcon(":/new/prefix1/icones/efeito_aparecer.PNG")) self.action_AnimAppear.setObjectName("action_AnimAppear") self.menu_Toolbar.addAction(self.action_AnimAppear) self.action_AnimAppear1 = QtGui.QAction(MainWindow) self.action_AnimAppear1.setIcon(QtGui.QIcon(":/new/prefix1/icones/efeito_aparecer.PNG")) self.action_AnimAppear1.setObjectName("action_AnimAppear1") self.action_AnimDesappear = QtGui.QAction(MainWindow) self.action_AnimDesappear.setIcon(QtGui.QIcon(":/new/prefix1/icones/efeito_saida.JPG")) self.action_AnimDesappear.setObjectName("action_AnimDesappear") self.actionModel_Color = QtGui.QAction(MainWindow) self.actionModel_Color.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_esquema_de_cores.png")) self.actionModel_Color.setObjectName("actionModel_Color") self.action_Arrow = QtGui.QAction(MainWindow) self.action_Arrow.setIcon(QtGui.QIcon(":/new/prefix1/icones/seta.png")) self.action_Arrow.setObjectName("action_Arrow") self.action_Sphere = QtGui.QAction(MainWindow) self.action_Sphere.setIcon(QtGui.QIcon(":/new/prefix1/icones/esfera.png")) self.action_Sphere.setObjectName("action_Sphere") self.action_Cube = QtGui.QAction(MainWindow) self.action_Cube.setIcon(QtGui.QIcon(":/new/prefix1/icones/cubo.png")) self.action_Cube.setObjectName("action_Cube") self.action_Cylinder = QtGui.QAction(MainWindow) self.action_Cylinder.setIcon(QtGui.QIcon(":/new/prefix1/icones/cilindro.png")) self.action_Cylinder.setObjectName("action_Cylinder") self.action_Gear = QtGui.QAction(MainWindow) self.action_Gear.setIcon(QtGui.QIcon(":/new/prefix1/icones/gear.png")) self.action_Gear.setObjectName("action_Gear") self.action_Star = QtGui.QAction(MainWindow) self.action_Star.setIcon(QtGui.QIcon(":/new/prefix1/icones/seta22.png")) self.action_Star.setObjectName("action_Star") self.action_Clasps = QtGui.QAction(MainWindow) self.action_Clasps.setObjectName("action_Clasps") self.toolBar_Draw.addAction(self.actionZoom_Out) self.toolBar_Draw.addAction(self.actionZoom_In) self.toolBar_Draw.addAction(self.action_Rotate) self.toolBar_Draw.addAction(self.action_Translate) self.toolBar_Draw.addAction(self.actionModel_Color) self.toolBar_Draw.addAction(self.action_Scale) self.toolBar_Draw.addAction(self.action_Arrow) self.toolBar_Draw.addAction(self.action_Sphere) self.toolBar_Draw.addAction(self.action_Cube) self.toolBar_Draw.addAction(self.action_Cylinder) self.toolBar_Draw.addAction(self.action_Gear) self.toolBar_Draw.addAction(self.action_Star) self.toolBar_Draw.addAction(self.action_Clasps) self.actionZoom_In.setText(QtGui.QApplication.translate("MainWindow", "Zoom_In", None, QtGui.QApplication.UnicodeUTF8)) self.actionZoom_Out.setText(QtGui.QApplication.translate("MainWindow", "Zoom_Out", None, QtGui.QApplication.UnicodeUTF8)) self.action_Rotate.setText(QtGui.QApplication.translate("MainWindow", "_Rotate", None, QtGui.QApplication.UnicodeUTF8)) self.action_Translate.setText(QtGui.QApplication.translate("MainWindow", "_Translate", None, QtGui.QApplication.UnicodeUTF8)) self.action_Scale.setText(QtGui.QApplication.translate("MainWindow", "action_Scale", None, QtGui.QApplication.UnicodeUTF8)) self.actionAction_ModelColor.setText(QtGui.QApplication.translate("MainWindow", "action_ModelColor", None, QtGui.QApplication.UnicodeUTF8)) self.actionModel_Color.setText(QtGui.QApplication.translate("MainWindow", "Model Color", None, QtGui.QApplication.UnicodeUTF8)) self.actionModel_Color.setIconText(QtGui.QApplication.translate("MainWindow", "Model Color", None, QtGui.QApplication.UnicodeUTF8)) self.actionModel_Color.setToolTip(QtGui.QApplication.translate("MainWindow", "Choose a different model piece color", None, QtGui.QApplication.UnicodeUTF8)) self.action_Arrow.setText(QtGui.QApplication.translate("MainWindow", "_Seta", None, QtGui.QApplication.UnicodeUTF8)) self.action_Sphere.setText(QtGui.QApplication.translate("MainWindow", "_Esfera", None, QtGui.QApplication.UnicodeUTF8)) self.action_Cube.setText(QtGui.QApplication.translate("MainWindow", "_Cubo", None, QtGui.QApplication.UnicodeUTF8)) self.action_Cylinder.setText(QtGui.QApplication.translate("MainWindow", "_Cilindro", None, QtGui.QApplication.UnicodeUTF8)) self.action_Gear.setText(QtGui.QApplication.translate("MainWindow", "_Gear", None, QtGui.QApplication.UnicodeUTF8)) self.action_Star.setText(QtGui.QApplication.translate("MainWindow", "_Star", None, QtGui.QApplication.UnicodeUTF8)) self.action_Clasps.setText(QtGui.QApplication.translate("MainWindow", "_Clasps", None, QtGui.QApplication.UnicodeUTF8)) def createBar_Animation(self,MainWindow): self.toolBar_Animation = QtGui.QToolBar(MainWindow) self.toolBar_Animation.setOrientation(QtCore.Qt.Vertical) self.toolBar_Animation.setObjectName("toolBar_Animation") MainWindow.addToolBar(QtCore.Qt.ToolBarArea(1),self.toolBar_Animation) self.actionView_Detail = QtGui.QAction(MainWindow) self.actionView_Detail.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_modemiter.png")) self.actionView_Detail.setObjectName("actionView_Detail") self.action_Play = QtGui.QAction(MainWindow) self.action_Play.setIcon(QtGui.QIcon(":/new/prefix1/icones/Play.jpg")) self.action_Play.setObjectName("action_Play") self.action_Transform = QtGui.QAction(MainWindow) self.action_Transform.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_translate_www_hoboes_com.png")) self.action_Transform.setObjectName("action_Transform") self.action_Group = QtGui.QAction(MainWindow) self.action_Group.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_agrupar.png")) self.action_Group.setObjectName("action_Group") self.action_Ungroup = QtGui.QAction(MainWindow) self.action_Ungroup.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_desagrupar.png")) self.action_Ungroup.setObjectName("action_Ungroup") self.action_Explode = QtGui.QAction(MainWindow) self.action_Explode.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_explodir.png")) self.action_Explode.setObjectName("action_Explode") self.toolBar_Animation.addAction(self.action_Transform) self.toolBar_Animation.addAction(self.action_Group) self.toolBar_Animation.addAction(self.action_Ungroup) self.toolBar_Animation.addAction(self.action_Explode) self.toolBar_Animation.addAction(self.actionView_Detail) self.toolBar_Animation.addSeparator() self.toolBar_Animation.addAction(self.action_Play) self.toolBar_Animation.addAction(self.action_AnimAppear) self.toolBar_Animation.addAction(self.action_AnimDesappear) self.action_Transform.setText(QtGui.QApplication.translate("MainWindow", "_Transform", None, QtGui.QApplication.UnicodeUTF8)) self.action_Group.setText(QtGui.QApplication.translate("MainWindow", "_Group", None, QtGui.QApplication.UnicodeUTF8)) self.action_Ungroup.setText(QtGui.QApplication.translate("MainWindow", "_Ungroup", None, QtGui.QApplication.UnicodeUTF8)) self.action_Explode.setText(QtGui.QApplication.translate("MainWindow", "_Explode", None, QtGui.QApplication.UnicodeUTF8)) self.actionView_Detail.setText(QtGui.QApplication.translate("MainWindow", "View_Detail", None, QtGui.QApplication.UnicodeUTF8)) self.action_Play.setText(QtGui.QApplication.translate("MainWindow", "_play", None, QtGui.QApplication.UnicodeUTF8)) self.action_AnimAppear.setText(QtGui.QApplication.translate("MainWindow", "Appear", None, QtGui.QApplication.UnicodeUTF8)) self.action_AnimAppear1.setText(QtGui.QApplication.translate("MainWindow", "Appear", None, QtGui.QApplication.UnicodeUTF8)) self.action_AnimDesappear.setText(QtGui.QApplication.translate("MainWindow", "Disappear", None, QtGui.QApplication.UnicodeUTF8)) def createBar_Documentation(self,MainWindow): self.toolBar_Documentation = QtGui.QToolBar(MainWindow) self.toolBar_Documentation.setOrientation(QtCore.Qt.Horizontal) self.toolBar_Documentation.setObjectName("toolBar_Documentation") MainWindow.addToolBar(QtCore.Qt.ToolBarArea(8),self.toolBar_Documentation) self.actionDoc_Include = QtGui.QAction(MainWindow) self.actionDoc_Include.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_incluir_documentacao.png")) self.actionDoc_Include.setObjectName("actionDoc_Include") self.actionDoc_Edit = QtGui.QAction(MainWindow) self.actionDoc_Edit.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_incluir_documentacao.png")) self.actionDoc_Edit.setObjectName("actionDoc_Edit") self.actionDoc_Exclude = QtGui.QAction(MainWindow) self.actionDoc_Exclude.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_excluir_comentario.png")) self.actionDoc_Exclude.setObjectName("actionDoc_Exclude") self.actionDoc_Hide = QtGui.QAction(MainWindow) self.actionDoc_Hide.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_ocultar_comentario.png")) self.actionDoc_Hide.setObjectName("actionDoc_Hide") self.actionDoc_bySound = QtGui.QAction(MainWindow) self.actionDoc_bySound.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_sound.png")) self.actionDoc_bySound.setObjectName("actionDoc_bySound") self.actionDoc_Metadata = QtGui.QAction(MainWindow) self.actionDoc_Metadata.setIcon(QtGui.QIcon(":/new/prefix1/icones/M_metadados.png")) self.actionDoc_Metadata.setObjectName("actionDoc_Metadata") self.toolBar_Documentation.addAction(self.actionDoc_Include) self.toolBar_Documentation.addAction(self.actionDoc_Edit) self.toolBar_Documentation.addAction(self.actionDoc_Exclude) self.toolBar_Documentation.addAction(self.actionDoc_Hide) self.toolBar_Documentation.addAction(self.actionDoc_bySound) self.toolBar_Documentation.addAction(self.actionDoc_Metadata) self.actionDoc_Include.setText(QtGui.QApplication.translate("MainWindow", "Doc_Include", None, QtGui.QApplication.UnicodeUTF8)) self.actionDoc_Edit.setText(QtGui.QApplication.translate("MainWindow", "Doc_Edit", None, QtGui.QApplication.UnicodeUTF8)) self.actionDoc_Exclude.setText(QtGui.QApplication.translate("MainWindow", "Doc_Exclude", None, QtGui.QApplication.UnicodeUTF8)) self.actionDoc_Hide.setText(QtGui.QApplication.translate("MainWindow", "Doc_Hide", None, QtGui.QApplication.UnicodeUTF8)) self.actionDoc_bySound.setText(QtGui.QApplication.translate("MainWindow", "Doc_bySound", None, QtGui.QApplication.UnicodeUTF8)) self.actionDoc_Metadata.setText(QtGui.QApplication.translate("MainWindow", "Doc_Metadata", None, QtGui.QApplication.UnicodeUTF8)) from glwidget import glWidget
Python
import scene.vector as vector from math import * __all__ = ["ArcBall"] class ArcBall(object): """Implements an arcball manipulator for specifying rotations.""" def __init__(self, center, radius): """Creates a new arcball manipulator. @param center: Triple of coordinates of center point of the sphere. @param radius: Radius of the sphere. """ self.center = center self.radius = radius def _rotby2vectors (self, startvector, endvector): """Given two unit vectors returns the rotation axis and rotation angle that maps the first onto the second. @param startvector: original vector. @param endvector: destination vector. @return: (angle,axis). """ r = vector.cross(startvector, endvector) l = vector.length (r) if l<1e-10: return 0,(0,0,1) angle = asin (l) axis = vector.scale(r,1.0/l) return (angle,axis) def _projvector (self, x, y): """Given a ray with origin (x,y,inf) and direction (0,0,-inf), translate it to the arcball's local coordinate system and return the intersection point with that sphere of unit radius and centered at the origin. If no intersection exists, intersect it with the plane z=0 and project that that point onto the unit sphere. @param x,y: coordinates for the ray. @return: projected vector. """ v = vector.scale ((x-self.center[0],y-self.center[1],0.0), 1.0/self.radius) l = vector.length(v) if l>=1.0: return vector.scale(v,1.0/l) z = sqrt (1.0 - l*l) return (v[0],v[1],z) def rot (self, x0, y0, x1, y1): """Given two screen points, returns the arcball rotation that maps the first onto the second. @param x0,y0: first point. @param x1,y1: second point. @return: (angle,axis). """ return self._rotby2vectors (self._projvector(x0,y0), self._projvector(x1,y1)) if __name__=="__main__": # A simple test from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from scene import * width,height = 500,500 def display (): glClear (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glLoadIdentity() scene.draw() glutSwapBuffers() def init(): glPolygonMode (GL_FRONT_AND_BACK, GL_LINE) glEnable(GL_CULL_FACE) def reshape (w, h): global width,height width,height = w,h glViewport (0, 0, w, h); glMatrixMode (GL_PROJECTION); glLoadIdentity() glOrtho (0, w, 0, h, -1000, 1000) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); def mousepress (button, state, x, y): if button == GLUT_LEFT_BUTTON: if state == GLUT_DOWN: global arcball arcball = ArcBall (scene.position(), scene.box.radius()) global startx, starty startx, starty = x,y glutMotionFunc (rotatecallback) else: glutMotionFunc (None) def rotatecallback (x, y): global startx,starty angle, axis = arcball.rot (startx, height - starty, x, height - y) dx,dy,dz = arcball.center scene.translate (-dx, -dy, -dz) scene.rotate (degrees(angle),*axis) scene.translate (dx, dy, dz) startx,starty = x,y glutPostRedisplay() glutInit([]) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL) glutInitWindowSize(width, height) glutCreateWindow("Test") glutDisplayFunc(display) glutReshapeFunc(reshape) glutMouseFunc(mousepress) scene = Sphere(100) scene.translate(width/2,height/2,0) init() glutMainLoop()
Python
# -*- coding: utf-8 -*- ## ****************************************************************** PROTOTIPO.PY ## * Description: ## * 3DbyStep main window calls. ## * The code bellow is very simplistic. It only shows a small window. ## ******************************************************************************* ## * Created in: 2007-01-07 ## * Last updated in: 2008-03-13 ## ******************************************************************************* ## * Authoring: Elisabete Thomaselli Nogueira and Victor S. Bursztyn ## * Orientation: Claudio Esperanca ## ******************************************************************************* import sys from PyQt4 import QtGui from interfBehavior import myMainBehavior class Prototype: def __init__(self): """ Constructor """ if __name__ == "__main__": ## Every PyQt4 application must create an application object. ## The application object is located in the QtGui module. ## The sys.argv parameter is a list of arguments from the command line. ## Python scripts can be run from the shell. It is a way, how we can control ## the startup of our scripts. self.app = QtGui.QApplication(sys.argv) self.window = myMainBehavior() ## The show() method displays the window on the screen. self.window.show() self.app.exec_() byStepApp = Prototype()
Python
# -*- coding: utf-8 -*- ## ************************************************************* INTERFBEHAVIOR.PY ## * Description: ## * This code is responsable for treat application buttons Behaviors. ## * (events, routines and classes) that exist in the glwidget canvas. ## ******************************************************************************* ## * Created in: 2007-01-07 ## * Last updated in: 2008-05-06 ## ******************************************************************************* ## * Authoring: Elisabete Thomaselli Nogueira and Victor S. Bursztyn ## * Orientation: Claudio Esperanca ## ******************************************************************************* from interfPrototipo import * ## Main interface Layout to Prototype from interfTextDoc import * ## Interface Layout to Documentation Window from animations import * ## Animation needs import sound ## Pygame wave sound player from PyQt4 import * from PyQt4.QtCore import * ## QtGui.QIcon used in interfPrototipo.py refers to some images .png reside in /icones/, by creating a .qrc file that ## lists it. After that, a Python module has to be created with command pyrcc4 on ## the .qrc file. import r_icones_rc ## Python module with interface image buttons. import os ## Verify current operation system def velocity(vel): """## Return a factor to calculate the quantity of keyframes. @param vel: Controls the frame rate by interface parameter velocity (Slow, Medium or High)""" if vel == "Slow": mult = 1 elif vel == "Medium": mult = 2 elif vel == "High": mult = 3 return mult class myTextDocDialog(Ui_Dialog_Doc): ## Restore interfTextDoc modal window parameters. ## If prototype object has text documentation stored, this text is retrieved. def changeCurrentColor(self): white = QtGui.QColor(255,255,255) newColor = QtGui.QColorDialog.getColor(white, self) if newColor.isValid(): self.setTextColor(newColor) def accept(self): """ OnDialogSubmition """ print os.name return self.textDocEdit.document() ## Return text documentation written. def initDoc(self, doc): """ OnDialogInitialization """ if (doc != None): self.textDocEdit.setDocument(doc) ## Retrieve text documentation stored previously. class myAnimParameterDialog(Ui_Dialog_Anim): ## Restore interfAnim modal window parameters. def accept(self): """ OnDialogSubmition """ return self.comboBox_Anim.currentText(), self.comboBox_Stop.currentText(), self.spinBox_Ini.value(), self.spinBox_Last.value(), self.comboBox_Vel.currentText() class myMainBehavior(QtGui.QMainWindow, Ui_MainWindow): ## Mainly behavior class. def __init__(self, parent=None): ## Constructor. QtGui.QMainWindow.__init__(self) self.setupUi(self) # Describe system majors ## ************************************************************************************** ## * Describes actions to signals emited in prototype functions. ## ************************************************************************************** self.connect(self.widget, QtCore.SIGNAL("modelLoaded"), self.updateTree_addModel) ## Include new model in hierarchy. self.connect(self.widget, QtCore.SIGNAL("animationLoaded"), self.updateTree_addAnim) ## Include new model in hierarchy. self.connect(self.widget, QtCore.SIGNAL("modelDeleted"), self.updateTree_delModel) ## Delete model from hierarchy. self.connect(self.widget, QtCore.SIGNAL("presentationLoaded"), self.updateTree_addModel) ## Include saved presentation in the current project. self.connect(self.widget, QtCore.SIGNAL("sceneCleared"), self.updateTree_clearScene) #Clear hierarchy structure scene self.connect(self.treeWidget, QtCore.SIGNAL("currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)"), self.updateScene) #Update scene according to hierarchy information. self.connect(self.widget, QtCore.SIGNAL("objectSelected"), self.updateTree_changeSelection) ## ************************************************************************************** ## * Describes action buttons from frame interfPrototipo.ui and their connects and signals ## ************************************************************************************** self.connect(self.action_New, QtCore.SIGNAL("triggered()"), self.widget.newProject) ## Open model from macchine directory self.connect(self.action_Open, QtCore.SIGNAL("triggered()"), self.widget.openPresentation) ## Apos rodar pyuic4, alterar para actionOpen_Model self.connect(self.action3D_Model, QtCore.SIGNAL("triggered()"), self.widget.openModel) self.connect(self.action_Import, QtCore.SIGNAL("triggered()"), self.widget.importSlide) #self.connect(self.action_Export self.connect(self.action_Save, QtCore.SIGNAL("triggered()"), self.widget.savePresentation) self.connect(self.actionSave_As, QtCore.SIGNAL("triggered()"), self.widget.save_As_Presentation) self.connect(self.action_Quit, QtCore.SIGNAL("triggered()"), QtGui.qApp, QtCore.SLOT("quit()")) ## Exit 3DbyStep application #self.connect(self.actionStructure_Content #self.connect(self.actionScene ## -- Actions related to toolBar self.connect(self.actionBasic_File_Functions, QtCore.SIGNAL("triggered()"), self.createB_Main) self.connect(self.actionDocumentation, QtCore.SIGNAL("triggered()"), self.createB_Doc) self.connect(self.actionAnimation, QtCore.SIGNAL("triggered()"), self.createB_Anim) self.connect(self.actionDraw, QtCore.SIGNAL("triggered()"), self.createB_Draw) self.connect(self.actionPresentation_Content, QtCore.SIGNAL("triggered()"), self.createB_Cont) self.connect(self.action3DbyStep_Documentation, QtCore.SIGNAL("triggered()"), QtGui.qApp, QtCore.SLOT("aboutQt()")) #self.connect(self.actionAbout #self.connect(self.actionReload #self.connect(self.actionTransicao_Quadro self.connect(self.actionZoom_Out, QtCore.SIGNAL("triggered()"), self.widget.zoomOut) self.connect(self.actionZoom_In, QtCore.SIGNAL("triggered()"), self.widget.zoomIn) #self.connect(self.action_Rotate #self.connect(self.action_Translate #self.connect(self.actionView_Detail, QtCore.SIGNAL("triggered()"), self. #self.connect(self.action_Transform ## self.connect(self.action_Group, QtCore.SIGNAL("triggered()"), #self.connect(self.action_Ungroup #self.connect(self.action_Explode ## Change existing model color self.connect(self.actionModel_Color, QtCore.SIGNAL("triggered()"), self.widget.changeColor) ##Action actionDoc_Include was used to input text documentation to determined object. Starts commentary form presentation self.connect(self.actionDoc_Include, QtCore.SIGNAL("triggered()"), self.displayTextDoc) #self.connect(self.actionDoc_Edit, QtCore.SIGNAL("triggered()"), self.slotFont) #self.connect(self.actionDoc_Exclude, QtCore.SIGNAL("triggered()"), #self.connect(self.actionDoc_Hide, QtCore.SIGNAL("triggered()"), self.connect(self.actionDoc_bySound, QtCore.SIGNAL("triggered()"), self.sound) ##Action actionDoc_Metadata was used to input text documentation to current slide. Starts commentary form presentation self.connect(self.actionDoc_Metadata, QtCore.SIGNAL("triggered()"), self.displayTextDoc) self.connect(self.action_Presentation,QtCore.SIGNAL("triggered()"), self.widget.openPresentation) ## Open model from macchine directory, Similarly to command connect(self.action_Open self.connect(self.action_3DModel, QtCore.SIGNAL("triggered()"), self.widget.openModel) #("circle.obj")) #self.connect(self.action_Picture self.connect(self.action_Scale, QtCore.SIGNAL("triggered()"), self.widget.scaleFactor) self.connect(self.action_Arrow, QtCore.SIGNAL("triggered()"), self.widget.newArrowModel) self.connect(self.action_Cube, QtCore.SIGNAL("triggered()"), self.widget.newCubeModel) self.connect(self.action_Sphere, QtCore.SIGNAL("triggered()"), self.widget.newSphereModel) self.connect(self.action_Cylinder, QtCore.SIGNAL("triggered()"), self.widget.newCylinderModel) #self.connect(self.action_Plano, QtCore.SIGNAL("triggered()"), self.widget.newPlaneModel) self.connect(self.action_Gear, QtCore.SIGNAL("triggered()"), self.widget.newGearModel) self.connect(self.action_Star, QtCore.SIGNAL("triggered()"), self.widget.newStarModel) ## ************************************************************************************** ## * Describes action buttons from frame interfAnim.ui and their connects and signals ## ************************************************************************************** self.connect(self.widget, QtCore.SIGNAL("modelMoved(int)"), self.updateSlider) #Include new model in hierarchy self.connect(self.action_Play, QtCore.SIGNAL("triggered()"), self.startAnimation) self.connect(self.action_AnimAppear, QtCore.SIGNAL("triggered()"), self.controlAnimation) ## Define object to appear in scene and previous time sleep. self.connect(self.action_AnimDesappear, QtCore.SIGNAL("triggered()"), self.widget.plotGraph) ## Define object to appear in scene and previous time sleep. self.connect(self.horizontalSlider, SIGNAL("valueChanged(int)"), self.move2Scene) self.connect(self.pauseButton, SIGNAL("clicked()"), self.pauseOrResume) self.connect(self.quitButton, SIGNAL("clicked()"), self.playQuit) self.connect(self, QtCore.SIGNAL("pauseResume(bool)"), self.widget.playHandler) self.connect(self.widget, QtCore.SIGNAL("quitPlayer(int)"), self.playQuit) ## Ticks count for the time-line self.animationTimer = QTimer() self.animationTimer.setSingleShot(False) ## snimationTimer will time out every 1000/fps milliseconds. self.connect(self.animationTimer, SIGNAL("timeout()"), self.widget.updateScene) self.horizontalSlider.setRange(1, 200) self.horizontalSlider.setValue(1) self.Running = False self.animType = None ## Inicia com as toolBars desativadas self.toolBar_B_Anim = True self.toolBar_B_Cont = True self.toolBar_B_Doc = True self.toolBar_B_Draw = True self.toolBar_B_Main = True #*********************************************************************************************** ## Define different procedures to "stop and go back" and "stop here" def playQuit(self): ## Quando forem varios objetos animados no mesmo periodo, o termino serᅢᄀ um comportamento individual self.playerExit = self.stopScript(self.Stop) if self.playerExit == 1: self.widget.playStop(1) else: self.widget.playStop(2) self.animationTimer.stop() ## Here we stop a timer which will time out every 1000/fps milliseconds. def updateSlider(self, args): """Updates slider position to reproduce current position in timeline. @param frameCount: groups related to this object.""" self.frameCount = args print "atualizar posicao corrente no controle de slider", self.frameCount self.horizontalSlider.setValue(self.frameCount) self.widget.repaint() def acceptStop(self): ## Tratar fim da animacao. self.emit(QtCore.SIGNAL("quitPlayer(int)"), self.playerExit) ## Se animacao toca e volta para o frame inicial, devolver valores passados para o startAnimation def pauseOrResume(self): self.Running = not self.Running self.pauseButton.setText("Pa&use" if self.Running else "Res&ume") self.emit(QtCore.SIGNAL("pauseResume(bool)"), self.Running) def changeValue(self, event): self.cw = self.slider.value() self.wid.repaint() def move2Scene(self): print "*** ", self.horizontalSlider.value() self.curFrame = self.horizontalSlider.value() print "frame ", self.curFrame self.widget.update2Scene(self.curFrame) def controlAnimation(self): """Open window with previously defined animation. @param Anim: animation routine text to be performed @param animType: animation routine to be performed @param Stop: procedure text to be performed when fisnishing an' animation @param playerExit: procedure to be performed when fisnishing an' animation @param initFrame: the first frame to be interpolated. @param lastFrame: the last frames to be displayed. @param Vel: velocity text associate to display (3 modes) @param vel: velocity associate to display (3 modes) @param index_m: selected object id number""" ## Defines parameters to animation self.Anim, self.Stop, self.initFrame, self.lastFrame, self.Vel = self.displayAnimParam() self.vel = velocity(self.Vel) self.animType = self.animScript(self.Anim) self.playerExit = self.stopScript(self.Stop) self.horizontalSlider.setValue(1) ## Always start player in frame one. """ def verifyAnimation(self): ## Test if exists some animation try: self.Anim except AttributeError: # x doesn't exist, do something QtGui.QMessageBox.about(self, self.tr("Player Application"), self.tr("There aren't pre-defined animations inside this slide. Create an'animation before using <b>player animations</b> control.")) else: # x exists, do something else self.startAnimation() """ def startAnimation(self): #def verifyAnimation(self): print "self.animType ", self.animType if self.animType != "None": ## Animation timeline self.frameCount = 1 ## Always start player with frameCount = 1. self.curFrame = 1 ## Always start player with curFrame = 1. self.lastFrame = 200 ## Always play from the first frame (1) until the last frame (200) self.connect(self.animationTimer, SIGNAL("timeout()"), self.widget.updateScene) fps = 20 #mult = 1 #fator de aceleracao #print "startAnimation ",self.Anim, self.Stop, self.initFrame, self.lastFrame, self.Vel, self.delayTime self.animationTimer.start(1000/fps) ## Here we create a timer which will time out every 1000/fps milliseconds. #self.Running = True self.frameCount = self.initFrame self.Running = True #myScene = glWidget(None, 20 * mult, self.initFrame, self.lastFrame, self.Running) # self.interpTrans = self.widget.animateObj(self.animType, self.playerExit, self.initFrame, self.lastFrame, self.vel, self.Running) def displayAnimParam(self): ## Inicialize the input dialog for text documentation. current = self.treeWidget.currentItem() self.parameterDialog = QtGui.QDialog(self) self.parameterDialog.setModal(True) animDocInterf = myAnimParameterDialog() animDocInterf.setupUi(self.parameterDialog) if (self.parameterDialog.exec_() == QtGui.QDialog.Accepted): self.Anim, self.Stop, self.initFrame, self.lastFrame, self.Vel = animDocInterf.accept() ## Por esse texto na arvore hierarquica, junto com o icone #(self.animType,",init=",self.initFrame,",last=", self.lastFrame) anim animListItem = [self.animType,self.initFrame, self.lastFrame] print "displayAnimParam ", animListItem self.widget.textAnimation(animListItem) ##VER current.setIcon(0, QtGui.QIcon(":/new/prefix1/icones/icones/apresentar_comentario.JPG")) #current.setIcon(0, QtGui.QIcon(":/new/prefix1/icones/icones/efeito_aparecer.png")) return self.Anim, self.Stop, self.initFrame, self.lastFrame, self.Vel def animScript(self, animText): """## Return a script name. @param anim: Controls animation script that will be execute""" print "animText ", animText if animText == "Translate and rotate": animType = "TransRot" elif animText == "Bring to front": animType = "bringObj" elif animText == "Go to the top right corner": animType = "topRight" elif animText == "Go to the bottom right corner": animType = "botRight" elif animText == "Go to the top left corner": animType = "topLeft" elif animText == "Go to the bottom left corner": animType = "botLeft" return animType def stopScript(self, stopText): """## Return a script name. @param playerExit: Controls animation exit procedure""" print "animText ", stopText if stopText == "and return to the first frame": ## = 1 -- Retorna ao frame inicial playerExit = 1 elif stopText == "and stay": ## = 2 -- Fica no frame corrente playerExit = 2 return playerExit #*********************************************************************************************** # Update Tree Presentation functions. #*********************************************************************************************** ## Clear slide scene and tree window either. def updateTree_clearScene(self): QtGui.QTreeWidget.clear(self.treeWidget) #self.treeWidget) def updateTree_addModel(self, *args): """Updates tree structure to reproduce informations relative to loaded elements #and defined animations. @param groups: groups related to this object. @param name: the name of the object to be inserted.""" groups = args[0][0] name = str(args[0][1]) modelitem = QtGui.QTreeWidgetItem(self.treeWidget) ## Update project hierarchy inputing current model. modelitem.setText(0,QtGui.QApplication.translate("MainWindow", name, None, QtGui.QApplication.UnicodeUTF8)) for group in range(1,len(groups)-1): ## Update project hierarchy including pieces of the current model, except for the first and last groups. ## These occurs, once the first and last groups importance are internal only. groupitem = QtGui.QTreeWidgetItem(modelitem) groupitem.setText(0,QtGui.QApplication.translate("MainWindow", str(groups[group].groupName), None, QtGui.QApplication.UnicodeUTF8)) def updateTree_addAnim(self, *args): """Updates tree structure to reproduce informations relative to the defined animations. #@param groups: groups related to this object. @param name: the name of the object to be inserted.""" groups = args[0][0] name = str(args[0][1]) current = self.treeWidget.currentItem() #modelitem = QtGui.QTreeWidgetItem(current) ## Update project hierarchy inputing current model. animationitem = QtGui.QTreeWidgetItem(current) animationitem.setText(0,QtGui.QApplication.translate("MainWindow", name, None, QtGui.QApplication.UnicodeUTF8)) def updateTree_delModel(self): #def updateTree_delModel(self, *args): ##m3 def updateTree_delModel(self, model, groups): """Deletes a defined model from tree structure. @param model: index of the selected object to be deleted. @param groups: index of specific groups to be deleted in the model.""" #model = args[0][0] #groups = args[0][1] items = QtGui.QTreeWidgetItem(self.treeWidget) selected = self.treeWidget.selectedItems() print "selected ",selected for item in selected: self.treeWidget.removeItemWidget(item, 0) ## RemoveItemWidget only exists after PyQt 4.3.3 # This is faster than using the Tree's removeItemWidget, which is really slow. ##parent = item.parent() ##parent.removeChild(item) #self.delete() def delete(self): #i=self.treeWidget.currentItem() i=self.treeWidget.selectedItems() if not i: return p=i.parent() if p: p.takeChild(p.indexOfChild(i)) ## def updateTree_changeSelection(self, *args): print "The selected object in glwidget will be selected in the tree either." selectionName = str(args[0][0]) selectedItem = self.treeWidget.findItems(selectionName, QtCore.Qt.MatchExactly, 1) # print selectedItem for item in selectedItem: # print str(item.text(0)) self.treeWidget.setItemSelected(item, True) #*********************************************************************************************** def updateScene(self): current = self.treeWidget.currentItem() #Whenever some item is selected in hierarchy window, #the corresponding group is shown in the glWidget, sending base (pai) and item names. if (current.parent() != None): self.widget.selectGroup(current.parent().text(0), current.text(0)) else: self.widget.selectGroup("", current.text(0)) ## Treat Text Dialog Modal Window def displayTextDoc(self): # Este bloco ainda diz respeito à forma antiga de documentação """ current = self.treeWidget.currentItem() if (current != None): #Inicialize the input dialog for text documentation. self.textDocDialog = QtGui.QDialog(self) self.textDocDialog.setModal(True) textDocInterf = myTextDocDialog() textDocInterf.setupUi(self.textDocDialog) #prevDoc = self.widget.getCurrentDoc() #print "prevDoc ",prevDoc #if (prevDoc != None): #Check if there is some associated documentation # textDocInterf.initDoc(prevDoc) if(self.textDocDialog.exec_() == QtGui.QDialog.Accepted): tempDoc = textDocInterf.accept() #print "tempDoc ", tempDoc self.widget.textDoc(tempDoc) #current.setIcon(0, QtGui.QIcon(":/new/prefix1/icones/icones/apresentar_comentario.JPG")) else: print "Document associated to slide" ## Text written describes metadata information """ self.textDocDialog = QtGui.QDialog(self) self.textDocDialog.setModal(True) textDocInterf = myTextDocDialog() textDocInterf.setupUi(self.textDocDialog) self.connect(textDocInterf.pushButton, SIGNAL("clicked()"), textDocInterf.changeCurrentColor) if(self.textDocDialog.exec_() == QtGui.QDialog.Accepted): tempDoc = textDocInterf.accept() self.widget.textDoc(tempDoc) def sound (self): sound.sound_music() def createB_Main(self): print "B_Main" self.toolBar_B_Main = not self.toolBar_B_Main if not self.toolBar_B_Main: self.createBar_Main(self) def createB_Doc(self): print "B_Doc" self.toolBar_B_Doc = not self.toolBar_B_Doc if not self.toolBar_B_Doc: self.createBar_Documentation(self) def createB_Anim(self): print "B_Anim" self.toolBar_B_Anim = not self.toolBar_B_Anim if not self.toolBar_B_Anim: self.createBar_Animation(self) def createB_Draw(self): print "B_Draw" self.toolBar_B_Draw = not self.toolBar_B_Draw if not self.toolBar_B_Draw: self.createBar_Draw(self) def createB_Cont(self): print "B_Cont" self.toolBar_B_Cont = not self.toolBar_B_Cont if not self.toolBar_B_Cont: self.createBar_Content(self) #****************************************************************************************** # Help and About #****************************************************************************************** def on_actionAbout_triggered (self): #def actionAbout(object): QtGui.QMessageBox.about(self, self.tr("About Application"), self.tr("The <b>Application</b> prototype demonstrates how to " "write modern authorize GUI applications using PyQt, OpenGL, with a menu bar, " "toolbars, and a status bar.")) def on_action3DbyStep_Documentation_triggered (self): print "document"
Python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'interfTextDoc.ui' # # Created: Tue May 6 08:09:59 2008 # by: PyQt4 UI code generator 4.3.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui class Ui_Dialog_Doc(object): def setupUi(self, Dialog_Doc): Dialog_Doc.setObjectName("Dialog_Doc") Dialog_Doc.resize(QtCore.QSize(QtCore.QRect(0,0,391,425).size()).expandedTo(Dialog_Doc.minimumSizeHint())) self.textDocEdit = QtGui.QTextEdit(Dialog_Doc) self.textDocEdit.setGeometry(QtCore.QRect(10,70,371,301)) self.textDocEdit.setObjectName("textDocEdit") self.fontComboBox = QtGui.QFontComboBox(Dialog_Doc) self.fontComboBox.setGeometry(QtCore.QRect(10,10,291,29)) self.fontComboBox.setObjectName("fontComboBox") self.spinBox = QtGui.QSpinBox(Dialog_Doc) self.spinBox.setGeometry(QtCore.QRect(310,10,61,31)) self.spinBox.setMinimum(7) self.spinBox.setMaximum(30) self.spinBox.setProperty("value",QtCore.QVariant(8)) self.spinBox.setObjectName("spinBox") self.buttonBox = QtGui.QDialogButtonBox(Dialog_Doc) self.buttonBox.setGeometry(QtCore.QRect(140,380,171,32)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.checkBox_2 = QtGui.QCheckBox(Dialog_Doc) self.checkBox_2.setGeometry(QtCore.QRect(10,40,83,23)) self.checkBox_2.setObjectName("checkBox_2") self.checkBox_3 = QtGui.QCheckBox(Dialog_Doc) self.checkBox_3.setGeometry(QtCore.QRect(70,40,83,23)) self.checkBox_3.setObjectName("checkBox_3") self.pushButton = QtGui.QPushButton(Dialog_Doc) self.pushButton.setGeometry(QtCore.QRect(160,40,80,27)) self.pushButton.setObjectName("pushButton") self.retranslateUi(Dialog_Doc) QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),Dialog_Doc.accept) QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),Dialog_Doc.reject) QtCore.QObject.connect(self.fontComboBox,QtCore.SIGNAL("currentFontChanged(QFont)"),self.textDocEdit.setCurrentFont) QtCore.QObject.connect(self.spinBox,QtCore.SIGNAL("valueChanged(int)"),self.spinBox.setValue) QtCore.QObject.connect(self.checkBox_2,QtCore.SIGNAL("toggled(bool)"),self.textDocEdit.setFontItalic) QtCore.QObject.connect(self.checkBox_3,QtCore.SIGNAL("toggled(bool)"),self.textDocEdit.setFontUnderline) QtCore.QMetaObject.connectSlotsByName(Dialog_Doc) def retranslateUi(self, Dialog_Doc): Dialog_Doc.setWindowTitle(QtGui.QApplication.translate("Dialog_Doc", "Dialog", None, QtGui.QApplication.UnicodeUTF8)) self.fontComboBox.setToolTip(QtGui.QApplication.translate("Dialog_Doc", "Font Family", None, QtGui.QApplication.UnicodeUTF8)) self.spinBox.setToolTip(QtGui.QApplication.translate("Dialog_Doc", "Font Weight", None, QtGui.QApplication.UnicodeUTF8)) self.spinBox.setAccessibleDescription(QtGui.QApplication.translate("Dialog_Doc", "Font Weight", None, QtGui.QApplication.UnicodeUTF8)) self.checkBox_2.setText(QtGui.QApplication.translate("Dialog_Doc", "Italic", None, QtGui.QApplication.UnicodeUTF8)) self.checkBox_3.setText(QtGui.QApplication.translate("Dialog_Doc", "Underline", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText(QtGui.QApplication.translate("Dialog_Doc", "Color", None, QtGui.QApplication.UnicodeUTF8))
Python
# -*- coding: utf-8 -*- ## This code is responsable for creating visual element structures to support other 3DbyStep routines. ## dispose a group of interations inside these environment. ## Master Research: Elisabete Thomaselli Nogueira ## Professor: Claudio Esperanca ## Graduate student: Victor Soares Bursztyn ## Created in: 07-11-07 ## Updated in: --- ## Last Update: --- ## Class EditableVisualElement defines all transformations and properties (rotation, translation, scale, color, etc) related to visual Elements. __all__=["EditableVisualElement", "visualElement"] from OpenGL.GL import * from OpenGL.GLU import * from math import sin, cos from numpy import array, dot from scene import * from bbox import * #class EditableVisualElement(object): class EditableVisualElement: "Base class for graphic objects." tx, ty, tz = 0, 0, 0 rx, ry, rz = 0, 0, 0 sx, sy, sz = 1.0, 1.0, 1.0 r = 0.3 g = 0.6 b = 0.8 #color = QtGui.QColor(r, g, b) def __init_lx__(self,box,material=None,transformation=None): """Constructor. @param box: A bounding box for this object. @param material: the material object (Material). If None, means that no material is attached to this object and thus it will be rendered with the current material. @param transformation: a transformation (16-float vector). If None, then an identity transformation is meant. """ """ self._box = box self.material = material self.transformation = transformation """ def _changed (self): """Hook for doing bookkeeping whenever a property of the object is modified. Derived classes should rewrite this method for its own purposes""" pass def _settransf (self, transformation): "Setter for transformation" if transformation is None: self._transformation = matrix.identity(4) else: self._transformation = transformation self._changed () def _gettransf (self): "Getter for transformation" return self._transformation def _setgrouptransf (self, grouptransformation): "Setter for groupo transformation" if grouptransformation is None: self._grouptransformation = matrix.identity(4) else: self._grouptransformation = grouptransformation self._changed () def _getgrouptransf (self): "Getter for group transformation" return self._grouptransformation def _getbox(self): "Getter for box" return self._box def _setbox(self,box): "Setter for box" self._box = box self._changed() transformation = property (_gettransf, _settransf) ##?? grouptransformation = property (_getgrouptransf, _setgrouptransf) grouptransformation = property (_gettransf, _settransf) box = property (_getbox, _setbox) def position(self): """Returns the translation part of this object's transformation. @return: position vector.""" if self._transformation is not None: return self._transformation[3][:3] return [0,0,0] def __gettransform (self,func,*args): """Finds the transformation obtained by composing the object's current transformation with the call to some function func which affects the current modelview matrix. The resulting transformation is stored in self.transformation. @param func: a function which affects the current modelview matrix (usually glTranslate, glRotate or some such). @param args: arguments to be passed to func. @return: None. """ glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() func(*args) if self._transformation is not None: glMultMatrixd(self._transformation) self.transformation = glGetDoublev(GL_MODELVIEW_MATRIX) glPopMatrix() def rotate (self,angle,x,y,z): """Alters the object's transformation with the given rotation. @param angle: rotation angle in degrees. @param x,y,z: rotation axis. @return: None. """ self.__gettransform (glRotatef,angle,x,y,z) def translate (self,dx,dy,dz): """Alters the object's transformation with the given translation. @param dx,dy,dz: offset vector. @return: None. """ self.__gettransform (glTranslatef,dx,dy,dz) ##? 2008-05-05 def grouptranslate (self,dx,dy,dz): """Alters the object's transformation with the given translation. @param dx,dy,dz: offset vector. @return: None. """ self.__getgrouptransform (glTranslatef,dx,dy,dz) def scale (self,dx,dy,dz): """Alters the object's transformation with the given scale. @param dx,dy,dz: scale factors. @return: None. """ self.__gettransform (glScalef,dx,dy,dz) #def draw(self): """Object's drawing code.""" #if self.material: # self.material.draw() #if self._transformation is not None: # glMultMatrixd(self._transformation) def setRotate(self, x, y, z): ## Errado self.rx, self.ry, self.rz = float(x), float(y), float(z) def setTranslate(self, x, y, z): self.tx, self.ty, self.tz = float(x), float(y), float(z) def setScale(self, x, y, z): self.sx, self.sy, self.sz = float(x), float(y), float(z) def setColor(self, r, g, b): self.r, self.g, self.b = float(r/255), float(g/255), float(b/255) def setListAnimations(self, animList): self.animList = animList def setAnimation(self, animType, playerExit, initFrame, lastFrame, vel, delayTime): self.animType = animType self.playerExit = playerExit self.initFrame = initFrame self.lastFrame = lastFrame self.vel = vel def getTransformation(self): transformation_list = [] transformation_list.append(self.tx) transformation_list.append(self.ty) transformation_list.append(self.tz) transformation_list.append(self.rx) transformation_list.append(self.ry) transformation_list.append(self.rz) transformation_list.append(self.sx) transformation_list.append(self.sy) transformation_list.append(self.sz) #print "teste transformation", tx, ty, tz return transformation_list def getTransformationMatrix(self): ## Confirmar como sera o getTransformationMatrix ou transformation sinx = sin(self.rx) siny = sin(self.ry) sinz = sin(self.rz) cosx = cos(self.rx) cosy = cos(self.ry) cosz = cos(self.rz) #ScTrMatrix = array([[self.sx, 0, 0, self.tx],[0, self.sy, 0, self.ty],[0, 0, self.sz, self.tz],[0,0,0,1]]) #RotMatrix = array([[cosy*cosz, cosy*sinz, -siny, 0],[cosz*sinx*siny - cosx*sinz, cosx*cosz + sinx*siny*sinz, cosy*sinx, 0],[cosx*cosz*siny + sinx*sinz, -cosz*sinx + cosx*siny*sinz, cosx*cosy, 0],[0,0,0,1]]) TMatrix = array([[1,0,0,0],[0,1,0,0],[0,0,1,0],[self.tx,self.ty,self.tz,1]]) SMatrix = array([[self.sx,0,0,0],[0,self.sy,0,0],[0,0,self.sz,0],[0,0,0,1]]) RMatrix = array([[cosy*cosz, -cosy*sinz, siny, 0],[sinx*siny*cosz + cosx*sinz, -sinx*siny*sinz + cosx*cosz, -sinx*cosy, 0],[-cosx*siny*cosz + sinx*sinz, cosx*siny*sinz + sinx*cosz, cosx*cosy, 0],[0,0,0,1]]) #RotMatrix = array([[cosy*cosz, cosz*sinx*siny - cosx*sinz, cosx*cosz*siny + sinx*sinz, 0],[cosy*sinz, cosx*cosz + sinx*siny*sinz, -cosz*sinx + cosx*siny*sinz, 0],[-siny, cosy*sinx, cosx*cosy, 0],[0,0,0,1]]) tempMatrix = dot(RMatrix,SMatrix) print "%r", TMatrix print "%r", SMatrix print "%r", RMatrix print "%r", tempMatrix transformationMatrix = dot(TMatrix,tempMatrix) print "%r", transformationMatrix return transformationMatrix def getRGB(self): RGB = [] RGB.append(self.r) RGB.append(self.g) RGB.append(self.b) return RGB def getCenter(self): return self.center + (self.tx, self.ty, self.tz) def getSide(self): return self.side * (self.sx, self.sy, self.sz) def __gettransform (self,func,*args): """Finds the transformation obtained by composing the object's current transformation with the call to some function func which affects the current modelview matrix. The resulting transformation is stored in self.transformation. @param func: a function which affects the current modelview matrix (usually glTranslate, glRotate or some such). @param args: arguments to be passed to func. @return: None. """ glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() func(*args) if self._transformation is not None: glMultMatrixd(self._transformation) self.transformation = glGetDoublev(GL_MODELVIEW_MATRIX) glPopMatrix() #************************************************************ # Group getters and setters #************************************************************ def getGroupNames(self): groupNames = [] for group in self.groups: groupNames.append(group.groupName) return groupNames def getGroupIds(self): groupIds = [] for group in self.groups: groupIds.append(group.groupId) return groupIds def getGroupTransformations(self): groupTransformations = [] for group in self.groups: groupTransformations.append(group.getTransformation()) return groupTransformations def getGroupRGBs(self): groupRGBs = [] for group in self.groups: groupRGBs.append(group.getRGB()) return groupRGBs def setColor(self, r, g, b): for group in self.groups: group.setColor(r, g, b) ## ******************************************************************************* ## * Calculate objects (or groups) bounding boxes center and site parameters. ## ******************************************************************************* def centersideValues(vet_x, vet_y, vet_z): ## Calculate box center and faces, considering object space coordinates to it. minx, miny, minz = min(vet_x), min(vet_y), min(vet_z) maxx, maxy, maxz = max(vet_x), max(vet_y), max(vet_z) if minx < 0: if maxx < 0: sidex = abs(minx) - abs(maxx) else: sidex = abs(minx) + maxx else: sidex = maxx - minx centerx = minx + sidex/2.0 #print "**** vetor em x ", vet_x, **** minx, maxx ", minx, maxx if miny < 0: if maxy < 0: sidey = abs(miny) - abs(maxy) else: sidey = abs(miny) + maxy else: sidey = maxy - miny centery = miny + sidey/2.0 #print "*************** vetor em y ", vet_y, **** miny, maxy ", miny, maxy if minz < 0: if maxz < 0: sidez = abs(minz) - abs(maxz) else: sidez = abs(minz) + maxz else: sidez = maxz - minz centerz = minz + sidez/2.0 #print "*************** vetor em z ", vet_z, **** minz, maxz ", minz, maxz center = (centerx, centery, centerz) side = (sidex, sidey, sidez) print "Center: " + str(center) print "Side: " + str(side) return center, side ## ******************************************************************************* # Define visual element (model, documentation, ...object defaults ## ******************************************************************************* class visualElement(EditableVisualElement): """ ************************************_INIT_****************************************** Sets up model data. @param modelPath: If the *.obj file indicated by "modelPath" is not yet allocated in any visualElement instance, loads the data from file. @param modelId: the new visualElement will receive an ID indicated by "modelId". @param copyId: if "copyId" differs to -1 it actually indicates the "modelId" that holds the already loaded geometry. @param groupNames: "groupNames" will indicate the already known group names contained in the file (in case "copyIndex" differs to -1). @param note: "note" will indicate if the element is a 3D canvas to a 2D content held in "modelPath". """ def __init__(self, modelPath, modelId, copyId = -1, groupNames = None, note = False): self.note = note if note == True: self.modelPath = self.objName = modelPath self.modelId = modelId self.copyId = copyId nameSplit = [] nameSplit = modelPath.split("/") self.objName = nameSplit[-1] #self.textureId, self.w, self.h = loadImage(modelPath) #abrir de modelPath a imagem im = Image.open(modelPath) im = im.transpose(Image.FLIP_TOP_BOTTOM) try: ## get image meta-data (dimensions) and data self.w, self.h, self.image = im.size[0], im.size[1], im.tostring() except SystemError: ## has no alpha channel, synthesize one, see the ## texture module for more realistic handling self.w, self.h, self.image = im.size[0], im.size[1], im.tostring() print "self.w, self.h ", self.w, " ", self.h self.groups = [] tempGroup = objGroup(self.modelId, self.modelId + 1, "NoteSingleGroup", 0) self.groups.append(tempGroup) del tempGroup else: ## Model file path self.modelPath = modelPath ## Model Id self.modelId = modelId ## Specifies if the geometry is already loaded, using the same source file; if it is true, ## what modelId contains this information. self.copyId = copyId ## Group List self.groups = [] ## Model Name nameSplit = [] nameSplit = modelPath.split("/") self.objName = nameSplit[-1] self.animList = [] ## Lanimista de controle de animações de um objeto. if self.copyId == -1: ## Vertex coordinates self.vx = [] self.vy = [] self.vz = [] ## Normal coordinates self.vnx = [] self.vny = [] self.vnz = [] ## Texture coordinates self.vtx = [] self.vty = [] ## Vertexes, textures and normals coordinates to each face (respectively): self.fv = [] self.fvt = [] self.fvn = [] ## Temporary group instance tempGroup = objGroup(self.modelId, self.modelId + 1, "3DbyStepBottomLimit", 0) ##Intern group created to ## assure that even models that were not divided into parts during modelling can be drawn group-by-group. self.groups.append(tempGroup) del tempGroup ## Model file objFile = open(modelPath, "r") line = [] for line in objFile: ## Reading each line... temp1 = [] ## Temporary variable to manipulate line split temp1 = line.split() if (len(temp1) == 0): continue if(temp1[0]=="v"): ## Reads a vertex coordinate self.vx.append(float(temp1[1])) self.vy.append(float(temp1[2])) self.vz.append(float(temp1[3])) elif(temp1[0]=="vt"): ## Reads a texture coordinate self.vtx.append(float(temp1[1])) self.vty.append(float(temp1[2])) elif(temp1[0]=="vn"): ## Reads a normal coordinate self.vnx.append(float(temp1[1])) self.vny.append(float(temp1[2])) self.vnz.append(float(temp1[3])) elif(temp1[0]=="f"): ## Reads a face self.fv.append([]) self.fvt.append([]) self.fvn.append([]) for i in range(1,len(temp1)): temp2 = [] ## Temporary to manipulate te second split (related to the face description) temp2 = temp1[i].split("/") if (len(temp2) == 2): ## Only one single / as separator? self.fv[len(self.fv)-1].append(int(temp2[0])-1) self.fvn[len(self.fvn)-1].append(int(temp2[1])-1) else: ## In case of double / ("//") as separator (either indicating no texture IDs or ## due to formatting preferences of the tool that generated the *.obj file) self.fv[len(self.fv)-1].append(int(temp2[0])-1) if (temp2[1] != ""): ## If there is a non empty texture ID self.fvt[len(self.fvt)-1].append(int(temp2[1])-1) self.fvn[len(self.fvn)-1].append(int(temp2[2])-1) del temp2 del temp1 elif(temp1[0]=="g"): ## Reads a group ## Temporary group instance tempGroup = objGroup(self.modelId, self.modelId + len(self.groups) + 1, str(temp1[1]), len(self.fv)) self.groups.append(tempGroup) del tempGroup print ":: Group "+self.groups[-1].groupName+" from face " + str(self.groups[-1].groupStart) print ":: groupId = "+str(self.groups[-1].groupId) else: ## If the line is empty, due to formatting preferences, continue ## then advances to the next iteration. objFile.close() ## Temporary group instance tempGroup = objGroup(self.modelId, self.modelId + len(self.groups) + 1, "3DbyStepTopLimit", len(self.fv)) ##Intern group created to ## assure that even models that were not divided into parts during modelling can be drawn group-by-group. self.groups.append(tempGroup) del tempGroup ## Calculate box center and faces, considering object space coordinates to it. #self.center, self.side = centersideValues(self.vx, self.vy, self.vz) self.center, self.side = centersideValues(self.vx, self.vy, self.vz) ## Create BoundingBox structure to current object self.box = BoundingBox(self.center, self.side) for group in range(len(self.groups)-1): ## Creates bounding boxes to parts, in particular. self.groups[group].createBox(self.vx[self.groups[group].groupStart : self.groups[group+1].groupStart], self.vy[self.groups[group].groupStart : self.groups[group+1].groupStart], self.vz[self.groups[group].groupStart : self.groups[group+1].groupStart]) else: for groupName in groupNames: tempGroup = objGroup(self.modelId, self.modelId + len(self.groups) + 1, groupName, 0) self.groups.append(tempGroup) del tempGroup self.objName = self.objName + "(" + str(self.modelId) + ")" """ ************************************_DRAW_****************************************** Draws visualElement. @param selected: "selected" is initially set to -1, which indicates that no group is being selected. However, if it differs to -1, it actually indicates that the model's group with ID equals to "selected" must be shown with more relevance (while the other ones will blend to create an inhibitive effect). @param testSelection: "testSelection" is set by default to False, which indicates not to do cursor selection testing. However, if it's set to True, it reutilizes the existing drawing routine to work with the selectionBuffer. @param modelTransformation: "modelTransformation" holds the transformations applied to the model, arranged by the form in .getTransformation() method (contained in EditableVisualElement). @param groupTransformations: "groupTransformations" holds the list of transformations applied to each model's group, in order and arranged by the form in .getTransformation() method (contained in EditableVisualElement). @param groupIds: "groupIds" holds all the model's groups IDs. @param groupRGBs: "groupRGBs" holds the list of extra RGB information applied to each model's group. """ #def draw(self, selected = -1, testSelection = False, modelTransformation = None, groupTransformations = None, groupIds = None, groupRGBs = None): ##Draws model with or without group selection handling def draw(self, selected = -1, testSelection = False, transformation = None, modelTransformation = None, groupTransformations = None, groupIds = None, groupRGBs = None): ##Draws model with or without group selection handling glEnable(GL_DEPTH_TEST) glDisable(GL_BLEND) ##*************************ModelTransformation*************************** glPushMatrix() glMultMatrixd(transformation) ## Tirar depois glScalef(modelTransformation[6], modelTransformation[7], modelTransformation[8]) """ glRotatef(modelTransformation[3], 1, 0, 0) glRotatef(modelTransformation[4], 0, 1, 0) glRotatef(modelTransformation[5], 0, 0, 1) """ ## Tirar depois glTranslatef(modelTransformation[0], modelTransformation[1], modelTransformation[2]) if self.note == False: for group in range(0, len(self.groups)-1): glColor3f(groupRGBs[group][0], groupRGBs[group][1], groupRGBs[group][2]) ##*************************GroupTransformations*************************** glPushMatrix() glMultMatrixd(transformation) glScalef(groupTransformations[group][6], groupTransformations[group][7], groupTransformations[group][8]) ## Tirar depois """ glRotatef(groupTransformations[group][3], 1, 0, 0) glRotatef(groupTransformations[group][4], 0, 1, 0) glRotatef(groupTransformations[group][5], 0, 0, 1) ## Tirar depois """ glTranslatef(groupTransformations[group][0], groupTransformations[group][1], groupTransformations[group][2]) if (testSelection == True): glPushName(groupIds[group]) if (selected != -1): if (groupIds[group] != selected): glEnable(GL_BLEND) glDisable(GL_DEPTH_TEST) else: glEnable(GL_DEPTH_TEST) glDisable(GL_BLEND) self.groups[group].box.draw() for i in range(self.groups[group].groupStart, self.groups[group+1].groupStart): ##From the beginning of the current group to the beginning of the next group. if(len(self.fv[i])==1): ## Obs: line and point drawing not yet implemented. continue elif(len(self.fv[i])==2): continue elif(len(self.fv[i])==3): glBegin(GL_TRIANGLES) glNormal3f(self.vnx[self.fvn[i][0]], self.vny[self.fvn[i][0]], self.vnz[self.fvn[i][0]]) glVertex3f(self.vx[self.fv[i][0]], self.vy[self.fv[i][0]], self.vz[self.fv[i][0]]) glNormal3f(self.vnx[self.fvn[i][1]], self.vny[self.fvn[i][1]], self.vnz[self.fvn[i][1]]) glVertex3f(self.vx[self.fv[i][1]], self.vy[self.fv[i][1]], self.vz[self.fv[i][1]]) glNormal3f(self.vnx[self.fvn[i][2]], self.vny[self.fvn[i][2]], self.vnz[self.fvn[i][2]]) glVertex3f(self.vx[self.fv[i][2]], self.vy[self.fv[i][2]], self.vz[self.fv[i][2]]) glEnd() elif(len(self.fv[i])==4): glBegin(GL_QUADS) glNormal3f(self.vnx[self.fvn[i][0]], self.vny[self.fvn[i][0]], self.vnz[self.fvn[i][0]]) glVertex3f(self.vx[self.fv[i][0]], self.vy[self.fv[i][0]], self.vz[self.fv[i][0]]) glNormal3f(self.vnx[self.fvn[i][1]], self.vny[self.fvn[i][1]], self.vnz[self.fvn[i][1]]) glVertex3f(self.vx[self.fv[i][1]], self.vy[self.fv[i][1]], self.vz[self.fv[i][1]]) glNormal3f(self.vnx[self.fvn[i][2]], self.vny[self.fvn[i][2]], self.vnz[self.fvn[i][2]]) glVertex3f(self.vx[self.fv[i][2]], self.vy[self.fv[i][2]], self.vz[self.fv[i][2]]) glNormal3f(self.vnx[self.fvn[i][3]], self.vny[self.fvn[i][3]], self.vnz[self.fvn[i][3]]) glVertex3f(self.vx[self.fv[i][3]], self.vy[self.fv[i][3]], self.vz[self.fv[i][3]]) glEnd() else: glBegin(GL_POLYGON) for j in range(0,len(self.fv[i])): glNormal3f(self.vnx[self.fvn[i][j]], self.vny[self.fvn[i][j]], self.vnz[self.fvn[i][j]]) glVertex3f(self.vx[self.fv[i][j]], self.vy[self.fv[i][j]], self.vz[self.fv[i][j]]) glEnd() glFlush() glPopMatrix() ##***********GroupTransformation************** if (testSelection == True): glPopName() else: #If note == True """ glBindTexture(GL_TEXTURE_2D, self.textureId) #glPixelStorei(GL_UNPACK_ALIGNMENT,1) glBegin(GL_QUADS) glTexCoord2f(0.0, 0.0) glVertex3f(-1.0, -1.0, 3.0) glTexCoord2f(1.0, 0.0) glVertex3f( 1.0, -1.0, 3.0) glTexCoord2f(1.0, 1.0) glVertex3f( 1.0, 1.0, 3.0) glTexCoord2f(0.0, 1.0) glVertex3f(-1.0, 1.0, 3.0) glEnd() """ glPixelStorei(GL_UNPACK_ALIGNMENT,1) glRasterPos2i(0, 0) glDrawPixels(self.w, self.h, GL_RGB, GL_UNSIGNED_BYTE, self.image) glFlush() glPopMatrix() ##**************ModelTransformation************** ## ************************************************************************************ class objGroup(EditableVisualElement): ## ************************************_INIT_****************************************** """ Sets up model's group data. @param pId: indicates the group's parent ID, which means basically the ID of the model that contains this group. @param gId: is an unique numeric identifier associated to this group. @param Name: it's the group's name. @param Start: is the index of the face (in the list of the parent's loaded faces) where the group starts. """ def __init__(self, pId, gId, Name, Start): self.parentId = pId self.groupId = gId self.groupName = Name self.groupStart = Start self.center = (0,0,0) self.side = (1,1,1) ## ******************************************************************************* ## * Create bounding boxes to each object group. ## ******************************************************************************* def createBox(self, groupvx, groupvy, groupvz): if (len(groupvx)): self.center, self.side = centersideValues(groupvx, groupvy, groupvz) print "*************Group**************" print self.groupName self.box = BoundingBox(self.center, self.side)
Python
""" Implementation of a very simple set of classes for representing objects in a given scene. Most of the attributes and properties model OpenGL primitives and state variables, so that their meaning is mostly self-documenting. The idea here is that objects may be passed around or maybe stored (using pickle or something like that). Rendering an object should be as simple as calling its draw method. """ #__all__=["EditableVisualElement","GraphicObject","GraphicObjectCollection"] __all__=["GraphicObject","GraphicObjectCollection"] from OpenGL.GL import * from OpenGL.GLU import * from material import * import matrix #from bbox import * from math import sqrt #from EditableVisualElement import * # -*- coding: utf-8 -*- ## This code is responsable for creating visual element structures to support other 3DbyStep routines. ## dispose a group of interations inside these environment. ## Master Research: Elisabete Thomaselli Nogueira ## Professor: Claudio Esperanca ## Graduate student: Victor Soares Bursztyn ## Created in: 07-11-07 ## Updated in: --- ## Last Update: --- ## Class EditableVisualElement defines all transformations and properties (rotation, translation, scale, color, etc) related to visual Elements. from numpy import * from math import sin, cos class EditableVisualElement(object): tx, ty, tz = 0, 0, 0 rx, ry, rz = 0, 0, 0 sx, sy, sz = 1.0, 1.0, 1.0 r = 0.3 g = 0.6 b = 0.8 #color = QtGui.QColor(r, g, b) def setRotate(self, x, y, z): self.rx, self.ry, self.rz = float(x), float(y), float(z) def setTranslate(self, x, y, z): self.tx, self.ty, self.tz = float(x), float(y), float(z) def setScale(self, x, y, z): self.sx, self.sy, self.sz = float(x), float(y), float(z) def setColor(self, r, g, b): self.r, self.g, self.b = float(r/255), float(g/255), float(b/255) def setListAnimations(self, animList): self.animList = animList def setAnimation(self, animType, playerExit, initFrame, lastFrame, vel, delayTime): self.animType = animType self.playerExit = playerExit self.initFrame = initFrame self.lastFrame = lastFrame self.vel = vel self.delayTime = delayTime ## Talvez nao se aplique def getTransformation(self): transformation = [] transformation.append(self.tx) transformation.append(self.ty) transformation.append(self.tz) transformation.append(self.rx) transformation.append(self.ry) transformation.append(self.rz) transformation.append(self.sx) transformation.append(self.sy) transformation.append(self.sz) #print "teste transformation", tx, ty, tz return transformation def setTransformationMatrix2(self, g_Transform): self.transformationMatrix = g_Transform def getTransformationMatrix2(self): transformationMatrix = [] transformationMatrix.append(self.transformationMatrix) return transformationMatrix def getTransformationMatrix(self): sinx = sin(self.rx) siny = sin(self.ry) sinz = sin(self.rz) cosx = cos(self.rx) cosy = cos(self.ry) cosz = cos(self.rz) #ScTrMatrix = array([[self.sx, 0, 0, self.tx],[0, self.sy, 0, self.ty],[0, 0, self.sz, self.tz],[0,0,0,1]]) #RotMatrix = array([[cosy*cosz, cosy*sinz, -siny, 0],[cosz*sinx*siny - cosx*sinz, cosx*cosz + sinx*siny*sinz, cosy*sinx, 0],[cosx*cosz*siny + sinx*sinz, -cosz*sinx + cosx*siny*sinz, cosx*cosy, 0],[0,0,0,1]]) TMatrix = array([[1,0,0,0],[0,1,0,0],[0,0,1,0],[self.tx,self.ty,self.tz,1]]) SMatrix = array([[self.sx,0,0,0],[0,self.sy,0,0],[0,0,self.sz,0],[0,0,0,1]]) RMatrix = array([[cosy*cosz, -cosy*sinz, siny, 0],[sinx*siny*cosz + cosx*sinz, -sinx*siny*sinz + cosx*cosz, -sinx*cosy, 0],[-cosx*siny*cosz + sinx*sinz, cosx*siny*sinz + sinx*cosz, cosx*cosy, 0],[0,0,0,1]]) #RotMatrix = array([[cosy*cosz, cosz*sinx*siny - cosx*sinz, cosx*cosz*siny + sinx*sinz, 0],[cosy*sinz, cosx*cosz + sinx*siny*sinz, -cosz*sinx + cosx*siny*sinz, 0],[-siny, cosy*sinx, cosx*cosy, 0],[0,0,0,1]]) tempMatrix = dot(RMatrix,SMatrix) print "%r", TMatrix print "%r", SMatrix print "%r", RMatrix print "%r", tempMatrix transformationMatrix = dot(TMatrix,tempMatrix) print "%r", transformationMatrix return transformationMatrix def getRGB(self): RGB = [] RGB.append(self.r) RGB.append(self.g) RGB.append(self.b) return RGB def getCenter(self): return self.center + (self.tx, self.ty, self.tz) def getSide(self): return self.side * (self.sx, self.sy, self.sz) def __gettransform (self,func,*args): """Finds the transformation obtained by composing the object's current transformation with the call to some function func which affects the current modelview matrix. The resulting transformation is stored in self.transformation. @param func: a function which affects the current modelview matrix (usually glTranslate, glRotate or some such). @param args: arguments to be passed to func. @return: None. """ glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() func(*args) if self._transformation is not None: glMultMatrixd(self._transformation) self.transformation = glGetDoublev(GL_MODELVIEW_MATRIX) glPopMatrix() class GraphicObject(object): "Base class for graphic objects." tx, ty, tz = 0, 0, 0 rx, ry, rz = 0, 0, 0 sx, sy, sz = 1.0, 1.0, 1.0 r = 0.3 g = 0.6 b = 0.8 #color = QtGui.QColor(r, g, b) def __init__(self,box,material=None,transformation=None): """Constructor. @param box: A bounding box for this object. @param material: the material object (Material). If None, means that no material is attached to this object and thus it will be rendered with the current material. @param transformation: a transformation (16-float vector). If None, then an identity transformation is meant. """ self._box = box self.material = material self.transformation = transformation def _changed (self): """Hook for doing bookkeeping whenever a property of the object is modified. Derived classes should rewrite this method for its own purposes""" pass def _settransf (self, transformation): "Setter for transformation" if transformation is None: self._transformation = matrix.identity(4) else: self._transformation = transformation self._changed () def _gettransf (self): "Getter for transformation" return self._transformation def _setgrouptransf (self, grouptransformation): "Setter for groupo transformation" if grouptransformation is None: self._grouptransformation = matrix.identity(4) else: self._grouptransformation = grouptransformation self._changed () def _getgrouptransf (self): "Getter for group transformation" return self._grouptransformation def _getbox(self): "Getter for box" return self._box def _setbox(self,box): "Setter for box" self._box = box self._changed() transformation = property (_gettransf, _settransf) ##?? grouptransformation = property (_getgrouptransf, _setgrouptransf) grouptransformation = property (_gettransf, _settransf) box = property (_getbox, _setbox) def setRotate(self, x, y, z): self.rx, self.ry, self.rz = float(x), float(y), float(z) def setTranslate(self, x, y, z): self.tx, self.ty, self.tz = float(x), float(y), float(z) def setScale(self, x, y, z): self.sx, self.sy, self.sz = float(x), float(y), float(z) def setColor(self, r, g, b): self.r, self.g, self.b = float(r/255), float(g/255), float(b/255) def position(self): """Returns the translation part of this object's transformation. @return: position vector.""" if self._transformation is not None: return self._transformation[3][:3] return [0,0,0] def __gettransform (self,func,*args): """Finds the transformation obtained by composing the object's current transformation with the call to some function func which affects the current modelview matrix. The resulting transformation is stored in self.transformation. @param func: a function which affects the current modelview matrix (usually glTranslate, glRotate or some such). @param args: arguments to be passed to func. @return: None. """ glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() func(*args) if self._transformation is not None: glMultMatrixd(self._transformation) self.transformation = glGetDoublev(GL_MODELVIEW_MATRIX) glPopMatrix() def rotate (self,angle,x,y,z): """Alters the object's transformation with the given rotation. @param angle: rotation angle in degrees. @param x,y,z: rotation axis. @return: None. """ self.__gettransform (glRotatef,angle,x,y,z) def translate (self,dx,dy,dz): """Alters the object's transformation with the given translation. @param dx,dy,dz: offset vector. @return: None. """ self.__gettransform (glTranslatef,dx,dy,dz) ##? 2008-05-05 def grouptranslate (self,dx,dy,dz): """Alters the object's transformation with the given translation. @param dx,dy,dz: offset vector. @return: None. """ self.__getgrouptransform (glTranslatef,dx,dy,dz) def scale (self,dx,dy,dz): """Alters the object's transformation with the given scale. @param dx,dy,dz: scale factors. @return: None. """ self.__gettransform (glScalef,dx,dy,dz) def draw(self): """Object's drawing code.""" if self.material: self.material.draw() if self._transformation is not None: glMultMatrixd(self._transformation) class GraphicObjectCollection(GraphicObject,list): """A Collection of Graphic Objects.""" def __init__(self, collection=[], material=None, transformation=None): """Constructor. @param material: the material object (Material). If None, means that no material is attached to this object and thus it will be rendered with the current material. @param transformation: a 4x4 matrix stored by column, i.e., according to the opengl standard. If None, then an identity transformation is meant. @param collection: a list of GraphicObjects or nothing at all. """ GraphicObject.__init__(self,BoundingBox(),material,transformation) list.__init__(self,collection) self.computeBoundingBox() def computeBoundingBox(self): """Recomputes this collection's bounding box. Should be called before using the bounding box if it is not certain whether any of the elements' boxes have been modified. """ allPoints = [] for obj in self: if isinstance(obj,GraphicObject): allPoints += map(lambda p: matrix.gltransformpoint (obj.transformation, p), obj.box.vertices()) self.box = BoundingBox.fromPoints(allPoints) def draw(self): """Draws every object in the list suitably preceded by a name (in the OpenGL sense) which is index of the object in the list so as to help during GL_SELECTION rendering mode.""" GraphicObject.draw(self) for i in range(len(self)): glPushMatrix() glLoadName (i) self[i].draw() glPopMatrix() """ Tinha pick e pickClosest aqui tambem """ def setRotate(self, x, y, z): self.rx, self.ry, self.rz = float(x), float(y), float(z) def setTranslate(self, x, y, z): self.tx, self.ty, self.tz = float(x), float(y), float(z) def setScale(self, x, y, z): self.sx, self.sy, self.sz = float(x), float(y), float(z) def setColor(self, r, g, b): self.r, self.g, self.b = float(r/255), float(g/255), float(b/255) def setListAnimations(self, animList): self.animList = animList def setAnimation(self, animType, playerExit, initFrame, lastFrame, vel, delayTime): self.animType = animType self.playerExit = playerExit self.initFrame = initFrame self.lastFrame = lastFrame self.vel = vel def getTransformation_lx(self): transformation = [] transformation.append(self.tx) transformation.append(self.ty) transformation.append(self.tz) transformation.append(self.rx) transformation.append(self.ry) transformation.append(self.rz) transformation.append(self.sx) transformation.append(self.sy) transformation.append(self.sz) #print "teste transformation", tx, ty, tz return transformation def setTransformationMatrix2(self, g_Transform): self.transformationMatrix = g_Transform def getTransformationMatrix2(self): transformationMatrix = [] transformationMatrix.append(self.transformationMatrix) return transformationMatrix def getTransformationMatrix(self): sinx = sin(self.rx) siny = sin(self.ry) sinz = sin(self.rz) cosx = cos(self.rx) cosy = cos(self.ry) cosz = cos(self.rz) #ScTrMatrix = array([[self.sx, 0, 0, self.tx],[0, self.sy, 0, self.ty],[0, 0, self.sz, self.tz],[0,0,0,1]]) #RotMatrix = array([[cosy*cosz, cosy*sinz, -siny, 0],[cosz*sinx*siny - cosx*sinz, cosx*cosz + sinx*siny*sinz, cosy*sinx, 0],[cosx*cosz*siny + sinx*sinz, -cosz*sinx + cosx*siny*sinz, cosx*cosy, 0],[0,0,0,1]]) TMatrix = array([[1,0,0,0],[0,1,0,0],[0,0,1,0],[self.tx,self.ty,self.tz,1]]) SMatrix = array([[self.sx,0,0,0],[0,self.sy,0,0],[0,0,self.sz,0],[0,0,0,1]]) RMatrix = array([[cosy*cosz, -cosy*sinz, siny, 0],[sinx*siny*cosz + cosx*sinz, -sinx*siny*sinz + cosx*cosz, -sinx*cosy, 0],[-cosx*siny*cosz + sinx*sinz, cosx*siny*sinz + sinx*cosz, cosx*cosy, 0],[0,0,0,1]]) #RotMatrix = array([[cosy*cosz, cosz*sinx*siny - cosx*sinz, cosx*cosz*siny + sinx*sinz, 0],[cosy*sinz, cosx*cosz + sinx*siny*sinz, -cosz*sinx + cosx*siny*sinz, 0],[-siny, cosy*sinx, cosx*cosy, 0],[0,0,0,1]]) tempMatrix = dot(RMatrix,SMatrix) print "%r", TMatrix print "%r", SMatrix print "%r", RMatrix print "%r", tempMatrix transformationMatrix = dot(TMatrix,tempMatrix) print "%r", transformationMatrix return transformationMatrix def getRGB(self): RGB = [] RGB.append(self.r) RGB.append(self.g) RGB.append(self.b) return RGB def getCenter(self): return self.center + (self.tx, self.ty, self.tz) def getSide(self): return self.side * (self.sx, self.sy, self.sz) def __gettransform (self,func,*args): """Finds the transformation obtained by composing the object's current transformation with the call to some function func which affects the current modelview matrix. The resulting transformation is stored in self.transformation. @param func: a function which affects the current modelview matrix (usually glTranslate, glRotate or some such). @param args: arguments to be passed to func. @return: None. """ glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() func(*args) if self._transformation is not None: glMultMatrixd(self._transformation) self.transformation = glGetDoublev(GL_MODELVIEW_MATRIX) glPopMatrix() class GraphicObject_Esperanca(object): "Base class for graphic objects." def __init__(self,box,material=None,transformation=None): """Constructor. @param box: A bounding box for this object. @param material: the material object (Material). If None, means that no material is attached to this object and thus it will be rendered with the current material. @param transformation: a transformation (16-float vector). If None, then an identity transformation is meant. """ self._box = box self.material = material self.transformation = transformation def _changed (self): """Hook for doing bookkeeping whenever a property of the object is modified. Derived classes should rewrite this method for its own purposes""" pass def _settransf (self, transformation): "Setter for transformation" if transformation is None: self._transformation = matrix.identity(4) else: self._transformation = transformation self._changed () def _gettransf (self): "Getter for transformation" return self._transformation def _getbox(self): "Getter for box" return self._box def _setbox(self,box): "Setter for box" self._box = box self._changed() transformation = property (_gettransf, _settransf) box = property (_getbox, _setbox) def position(self): """Returns the translation part of this object's transformation. @return: position vector.""" if self._transformation is not None: return self._transformation[3][:3] return [0,0,0] def __gettransform (self,func,*args): """Finds the transformation obtained by composing the object's current transformation with the call to some function func which affects the current modelview matrix. The resulting transformation is stored in self.transformation. @param func: a function which affects the current modelview matrix (usually glTranslate, glRotate or some such). @param args: arguments to be passed to func. @return: None. """ glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() func(*args) if self._transformation is not None: glMultMatrixd(self._transformation) self.transformation = glGetDoublev(GL_MODELVIEW_MATRIX) glPopMatrix() def rotate (self,angle,x,y,z): """Alters the object's transformation with the given rotation. @param angle: rotation angle in degrees. @param x,y,z: rotation axis. @return: None. """ self.__gettransform (glRotatef,angle,x,y,z) def translate (self,dx,dy,dz): """Alters the object's transformation with the given translation. @param dx,dy,dz: offset vector. @return: None. """ self.__gettransform (glTranslatef,dx,dy,dz) def scale (self,dx,dy,dz): """Alters the object's transformation with the given scale. @param dx,dy,dz: scale factors. @return: None. """ self.__gettransform (glScalef,dx,dy,dz) def draw(self): """Object's drawing code.""" if self.material: self.material.draw() if self._transformation is not None: glMultMatrixd(self._transformation) class GraphicObjectCollection(GraphicObject,list): """A Collection of Graphic Objects.""" def __init__(self, collection=[], material=None, transformation=None): """Constructor. @param material: the material object (Material). If None, means that no material is attached to this object and thus it will be rendered with the current material. @param transformation: a 4x4 matrix stored by column, i.e., according to the opengl standard. If None, then an identity transformation is meant. @param collection: a list of GraphicObjects or nothing at all. """ print "collection ", collection GraphicObject.__init__(self,BoundingBox(),material,transformation) list.__init__(self,collection) self.computeBoundingBox() def computeBoundingBox(self): """Recomputes this collection's bounding box. Should be called before using the bounding box if it is not certain whether any of the elements' boxes have been modified. """ allPoints = [] for obj in self: if isinstance(obj,GraphicObject): allPoints += map(lambda p: matrix.gltransformpoint (obj.transformation, p), obj.box.vertices()) self.box = BoundingBox.fromPoints(allPoints) def draw(self): """Draws every object in the list suitably preceded by a name (in the OpenGL sense) which is index of the object in the list so as to help during GL_SELECTION rendering mode.""" GraphicObject.draw(self) for i in range(len(self)): glPushMatrix() glLoadName (i) print "GraphicObject.draw entrada ", self[i] self[i].draw() glPopMatrix() def pick(self,x,y): """Uses the OpenGL selection mechanism for figuring out which object lies at screen position (x,y). @param x,y: screen position. @return: the selection buffer, i.e., a list of tuples (mindepth, maxdepth, names), where names is a list of object names -- i.e., collection indices -- with the one on top of the stack last. Thus, if names==[3,10], then element 3 of this collection was hit and it was itself a collection whose element 10 was hit. """ # Prepare for picking glSelectBuffer(100) glRenderMode(GL_SELECT) viewport = glGetIntegerv (GL_VIEWPORT) projmatrix = glGetDoublev (GL_PROJECTION_MATRIX) glInitNames() glPushName(0) glMatrixMode (GL_MODELVIEW) glPushMatrix() glLoadIdentity () glMatrixMode (GL_PROJECTION) glPushMatrix () glLoadIdentity () # create 5x5 pixel picking region near cursor location gluPickMatrix (x, (viewport[3] - y), 5, 5, viewport); glMultMatrixd (projmatrix) #meu self.drawScene(True) self.draw() glPopName() buffer = glRenderMode(GL_RENDER) # Restore modelview glMatrixMode (GL_MODELVIEW) glPopMatrix () # Restore projection glMatrixMode (GL_PROJECTION) glPopMatrix () # Process hits return list(buffer) def pickClosest (self, x, y): """Uses the OpenGL selection mechanism for figuring out which object lies at screen position (x,y). Similar to pick, but returns only one object (the closest one). @param x,y: screen position. @return: A tuple (obj, z), where obj is the object and z is its z coordinate at the pick position. If no object lies at the given position, then obj is None.""" closest = None closestZ = 1.0 for hit in self.pick(x,y): minz, maxz, name = hit z = 1.0 * minz / (2**32-1) if z < closestZ: closestZ,closest = z, self[name[0]] return (closest, closestZ)
Python
__all__=["Cube"] from mesh import Mesh import vector from bbox import * class Cube(Mesh): """A Cube of side length 2 centered at the origin.""" face = [[3, 2, 1, 0], [7, 6, 2, 3], [4, 5, 6, 7], [0, 1, 5, 4], [1, 2, 6, 5], [3, 0, 4, 7] ] vertex = [[-1, -1,1],[-1, -1,-1], [-1,1,-1], [-1,1,1], [1, -1,1],[1, -1,-1], [1, 1,-1], [1,1,1]] def __init__(self, size=1.0, drawmode="fill",normalmode="face", material=None,transformation=None): """Constructor. @param drawmode: may be either "fill", meaning that faces will be drawn filled, "line", meaning that only edges will be drawn, or "both", meaning both fill and line rendering. @param normalmode: may be either "face" meaning one normal per face, or "vertex", meaning that normals will be smoothed per vertex. @param material: the material object (Material). If None, means that no material is attached to this object and thus it will be rendered with the current material. @param transformation: a transformation (16-float vector). If None, then an identity transformation is meant. """ Mesh.__init__(self, self.face, [vector.scale (x, size) for x in self.vertex], drawmode, normalmode, material, transformation) if __name__=="__main__": # A simple test cube = Cube(3)
Python
__all__=["Sphere"] from OpenGL.GL import * from OpenGL.GLU import * from graphicobject import * from bbox import * class Sphere(GraphicObject): "A Sphere of a given radius." def __init__(self,radius=1, material=None, transformation=None): """Constructor. @param radius: sphere radius. @param material: the material object (Material). If None, means that no material is attached to this object and thus it will be rendered with the current material. @param transformation: a transformation (16-float vector). If None, then an identity transformation is meant. """ GraphicObject.__init__(self,BoundingBox((0,0,0),(radius*2,)*3), material,transformation) self.quadric = gluNewQuadric() self.radius = radius def draw(self): "Drawing code" GraphicObject.draw(self) print "desenha esfera " gluQuadricNormals(self.quadric, GLU_SMOOTH) gluSphere (self.quadric, self.radius, 32, 32) if __name__=="__main__": # A simple test sphere = Sphere()
Python
""" Various mesh loaders. Each function receives a filename which points to a file in some format and returns a Mesh object. """ __all__=["loadoff"] from graphicobject import * from mesh import * def loadoff (filename,invertCirculations=False): """Reads an off file and returns a corresponding Mesh object. @param filename: the name of a readable file in off format. @param invertCirculations: tells whether to take face circulations in inverse order than the one in the file. @return: a mesh object. """ f = open(filename) # Read first line s = f.readline().strip() assert(s=="OFF") # Read second line nvtx,nface,ntet=map(lambda i: int(i), f.readline().split()) assert(ntet==0) # Read vertices vtx = [] for ivtx in range(nvtx): x,y,z = map(lambda i: float(i), f.readline().split()) vtx.append((x,y,z)) # Read faces face = [] for iface in range(nface): vlist = map(lambda i: int(i), f.readline().split()) assert (len(vlist) == vlist[0]+1) face.append(vlist[1:]) if invertCirculations: face[-1].reverse() return Mesh(face,vtx) if __name__=="__main__": loadoff("ape.off")
Python
""" Light sources. """ __all__ = ["Light"] from OpenGL.GL import * from graphicobject import * # Some globals defaultLightAmbient = (0,0,0,1) defaultLightDiffuse = (1,1,1,1) defaultLightSpecular = (1,1,1,1) defaultLightPosition = (0,0,1,0) class Light(object): "Represents a positional or directional light source" def __init__(self, lightno=0, ambient=defaultLightAmbient, diffuse=defaultLightDiffuse, specular=defaultLightSpecular, position=defaultLightPosition, on=True): """Constructor. @param lightno: which light source is modeled by this object. May be an integer from 0 to 7 or from GL_LIGHT0 to GL_LIGHT7. @param ambient: ambient parameters (4-float vector) @param specular: specular parameters (4-float vector) @param diffuse: diffuse parameters (4-float vector) @param position: a point (w=1) for a positional source or a vector (w=0) for a directional source (4-float vector) @param on: Tells whether this light should be turned on or off (boolean). """ if lightno>=GL_LIGHT0: self.lightno = lightno else: self.lightno = lightno+GL_LIGHT0 self.ambient = ambient self.diffuse = diffuse self.specular = specular self.position = position self.on = on def draw(self): "Renders the light in the scene." if self.on: glEnable(self.lightno) glLightfv(self.lightno,GL_AMBIENT,self.ambient) glLightfv(self.lightno,GL_DIFFUSE,self.diffuse) glLightfv(self.lightno,GL_SPECULAR,self.specular) glLightfv(self.lightno,GL_POSITION,self.position) else: glDisable(self.lightno) if __name__=="__main__": # A simple test light = Light()
Python
from math import sqrt def sub(v1,v2): """Difference of two vectors. @param v1: first vector @param v2: second vector @return: v1 - v2 """ return [a-b for a,b in zip(v1,v2)] def add(v1,v2): """Sum of two vectors. @param v1: first vector @param v2: second vector @return: v1 - v2 """ return [a+b for a,b in zip(v1,v2)] def dot(v1,v2): """Dot product between two vectors. @param v1: first vector @param v2: second vector @return: v1 . v2 """ return sum([a*b for a,b in zip(v1,v2)]) def cross(v1,v2): """Cross product between two vectors (must be 3D) @param v1: first vector @param v2: second vector @return: v1 * v2 """ return [v1[1] * v2[2] - v2[1] * v1[2], v1[2] * v2[0] - v2[2] * v1[0], v1[0] * v2[1] - v2[0] * v1[1]] def scale(v,s): """Scales a vector by a constant. @param v: vector to be scaled @param s: scale factor @return: s v """ return [s*x for x in v] def squarelength(v): """Square of the length of a vector. @param v: input vector @return: |v|**2 """ return sum([x*x for x in v]) def combine(p0,p1,ratio): """Performs a linear combination between points. @param p0: first point. @param p1: second point. @return: p0 * ratio + p1 * (1-ratio) """ return add(scale(p0,ratio),scale(p1,1.0-ratio)) def length(v): """Length of a vector. @param v: input vector. @return: |v|. """ return sqrt(squarelength(v)) def normalize(v): """Vector of size 1. @param v: input vector. @return: v/|v|. """ return scale(v,1.0/length(v))
Python
__all__ = ["Mesh"] from graphicobject import * from halfedge import * from OpenGL.GL import * from bbox import * from math import sqrt class Mesh(GraphicObject): "A Mesh object" def __init__(self,face=[],vertex=[], drawmode="fill",normalmode="face", material=None,transformation=None): """Constructor. @param face: an array of lists of vertex indices. @param vertex: an array of 4-tuples, each representing the coordinates of a vertex. @param drawmode: may be either "fill", meaning that faces will be drawn filled, "line", meaning that only edges will be drawn, or "both", meaning both fill and line rendering. @param normalmode: may be either "face" meaning one normal per face, or "vertex", meaning that normals will be smoothed per vertex. @param material: the material object (Material). If None, means that no material is attached to this object and thus it will be rendered with the current material. @param transformation: a 4x4 transformation matrix stored by column. If None, then an identity transformation is meant. """ GraphicObject.__init__(self,BoundingBox.fromPoints(vertex), material,transformation) self.hds = HalfedgeDS(face,vertex) self.vertex = vertex self._drawmode = drawmode self._normalmode = normalmode self._displaylist = None self.faceNormal = [None]*len(face) self.vertexNormal = [None]*len(vertex) self.computeFaceNormals() self.computeVertexNormals() def _changed (self): """Invalidate display list.""" self._displaylist = None def _setDrawMode (self, drawmode): "Setter for drawmode" self._drawmode = drawmode self._changed () def _getDrawMode (self): "Getter for drawmode" return self._drawmode drawMode = property (_getDrawMode, _setDrawMode) def _setNormalMode (self, normalmode): "Setter for normalmode" self._normalmode = normalmode self._changed() def _getNormalMode (self): "Getter for normalmode" return self._normalmode normalMode = property (_getNormalMode, _setNormalMode) def computeFaceNormals(self): "For all faces f, stores in self.faceNormal[f] the normal of face f." for h in self.hds.allFaces(): a, b, c = 0.0, 0.0, 0.0 vtx = map(lambda hh: self.vertex[hh.vtx], self.hds.aroundFace(h.fac)) for i in range(len (vtx)): x0,y0,z0 = vtx[i-1] x1,y1,z1 = vtx[i] c += (y0+y1)*(x0-x1) b += (x0+x1)*(z0-z1) a += (z0+z1)*(y0-y1) sz = sqrt(a*a+b*b+c*c) self.faceNormal[h.fac] = (a/sz,b/sz,c/sz) def computeVertexNormals(self): "For all vertices v, stores in self.vertexNormal[v] a smoothed normal" for h in self.hds.allVertices(): a,b,c = 0.0, 0.0, 0.0 for hh in self.hds.aroundVertex(h.vtx): if hh.fac not in self.hds.borderface: # Consider only real faces, not "fake" border faces. x,y,z = self.faceNormal[hh.fac] a,b,c = a+x,b+y,c+z sz = sqrt(a*a+b*b+c*c) self.vertexNormal[h.vtx] = (a/sz,b/sz,c/sz) def draw(self): "Draws the mesh." GraphicObject.draw(self) if self._displaylist != None: glCallList (self._displaylist) else: self._displaylist = glGenLists (1) glNewList (self._displaylist, GL_COMPILE_AND_EXECUTE) if self._drawmode == "fill": self.drawFill() elif self._drawmode == "line": self.drawLine() else: self.drawFill() glPushAttrib(GL_POLYGON_BIT) glEnable (GL_POLYGON_OFFSET_LINE) self.drawLine() glPopAttrib() glEndList () def drawFill(self): """Draws the mesh in fill mode""" if self._normalmode == "face": for h in self.hds.allFaces(): glBegin(GL_POLYGON) glNormal3fv (self.faceNormal[h.fac]) for hh in self.hds.aroundFace(h.fac): glVertex3fv(self.vertex[hh.vtx]) glEnd() else: for h in self.hds.allFaces(): glBegin(GL_POLYGON) for hh in self.hds.aroundFace(h.fac): glNormal3fv (self.vertexNormal[hh.vtx]) glVertex3fv (self.vertex[hh.vtx]) glEnd() def drawLine(self): """"Draws the mesh in line mode.""" glPushAttrib (GL_LIGHTING_BIT) glDisable(GL_LIGHTING) glBegin (GL_LINES) for h in self.hds.allEdges(): glVertex3fv (self.vertex[h.vtx]) glVertex3fv (self.vertex[self.hds[h.prv].vtx]) glEnd () glPopAttrib () if __name__=="__main__": # A simple test mesh = Mesh([(0,1,2)],[(0,0,0),(1,0,0),(0,1,0)])
Python
__all__=["HandleBox"] from OpenGL.GL import * from OpenGL.GLU import * from graphicobject import * class HandleBox(GraphicObject): """This object is to be used as a manipulator for other graphicobjects. The idea is that each handlebox object is attached to some other object. Altering the transformation of this object also alters the attached object. """ def __init__(self, attached): """Constructor. @param attached: a slave object which will be transformed whenever this box is transformed. """ GraphicObject.__init__(self,None) self.attached = attached def drawAnchors (self): """Draw small square anchors at each vertex of the box.""" #Must first figure out a reasonable size for the squares modelview = glGetDoublev(GL_MODELVIEW_MATRIX) projection = glGetDoublev(GL_PROJECTION_MATRIX) viewport = glGetIntegerv(GL_VIEWPORT) c = gluProject (0,0,0,modelview,projection,viewport) x = gluProject (1,0,0,modelview,projection,viewport) y = gluProject (0,1,0,modelview,projection,viewport) z = gluProject (0,0,1,modelview,projection,viewport) d = 20.0 /max(abs(x[0]-c[0]),abs(y[0]-c[0]),abs(z[0]-c[0]), \ abs(x[1]-c[1]),abs(y[1]-c[1]),abs(z[1]-c[1])) # get the box vertices vtx = self.attached.box.vertices() edgeincr = ((d,d,d), (-d,d,d), (d,-d,d), (-d,-d,d), (d,d,-d), (-d,d,-d), (d,-d,-d), (-d,-d,-d)) i = 0 for v,e in zip(vtx,edgeincr): dx,dy,dz=e vx,vy,vz=v glLoadName(i) i += 1 glBegin(GL_TRIANGLE_FAN) glVertex3fv (v) glVertex3f (vx+dx,vy,vz) glVertex3f (vx+dx,vy+dy,vz) glVertex3f (vx,vy+dy,vz) glVertex3f (vx,vy+dy,vz+dz) glVertex3f (vx,vy,vz+dz) glVertex3f (vx+dx,vy,vz+dz) glVertex3f (vx+dx,vy,vz) glEnd() def draw(self): """Draws the box.""" glPushAttrib(GL_LIGHTING_BIT) glDisable(GL_LIGHTING) glMultMatrixd (self.attached.transformation) self.attached.box.draw() glPushName(0) self.drawAnchors() glPopName() glPopAttrib()
Python
"""Several matrix utilities.""" import vector from math import * def cofactor(m,irow,icol): """Returns the cofactor icol,irow of matrix m.""" def minor(): """Returns a minor matrix of m, where row irow and col icol were removed.""" return [row[:icol]+row[icol+1:] for row in m[:irow]+m[irow+1:]] if (irow+icol)%2==1: return -determinant(minor()) else: return determinant(minor()) def adjugate (m): """Returns the adjugate of m, i.e., a matrix of all cofactors of m.""" n = len (m) assert (n == len(m[0])) return [[cofactor(m,irow,icol) for irow in range(n)] for icol in range(n)] def determinant(m): """Computes the determinant of a matrix by its cofactor expansion.""" n = len (m) assert (n == len(m[0])) if n==2: a,b=m[0] c,d=m[1] return a*d-b*c else: return sum ([m[0][i]*cofactor(m,0,i) for i in range(n)]) def transpose(m): """Returns the transpose of m.""" return [column(m,i) for i in range(len(m[0]))] def column(m,i): """Returns the column i of matrix m.""" return [row[i] for row in m] def product(m,l): """Returns the product of two matrices.""" return [[vector.dot(row,column(l,j)) for j in range(len(l[0]))] for row in m] def scalarproduct (m, s): """Returns m where all elements were multiplied by scalar s.""" return [[x*s for x in row] for row in m] def add(m1,m2): """Returns the sum of two matrices m1 and m2, which must have the same size.""" assert(len(m1)==len(m2) and len(m1[0])==len(m2[0])) return [[a+b for a,b in zip(row1,row2)] for row1,row2 in zip(m1,m2)] def sub(m1,m2): """Returns the difference of two matrices m1 and m2, which must have the same size.""" assert(len(m1)==len(m2) and len(m1[0])==len(m2[0])) return [[a-b for a,b in zip(row1,row2)] for row1,row2 in zip(m1,m2)] def inverse(m): """Computes the inverse of m by cofactor expansion.""" det = 1.0/determinant(m) return [[det*x for x in row] for row in adjugate(m)] def identity(n): """Returns a square identity matrix of size n x n.""" return [[0]*i+[1]+[0]*(n-i-1) for i in range(n)] #=============================================================================== # Below, specific code for 4x4 matrices #=============================================================================== def transform(m,v): """Returns the product of matrix m by column vector v. v is assumed to be in homogeneous coordinates.""" assert (len(m[0])==len(v)) return [vector.dot(row,v) for row in m] def transformvector(m,v): """Just like transform, but v is assumed to be of length 3.""" return transform (m, [v[0],v[1],v[2],0])[:3] def transformpoint(m,p): """Transforms point p by matrix m, where p is assumed to be of length 3.""" return transform (m, [p[0],p[1],p[2],1])[:3] def translation(*v): """Returns a 4x4 matrix corresponding to translation by vector v. If v has only 2 coordinates, z=0 is assumed. If v has 4 coordinates, the homogenous (fourth) coordinate must be 0.""" m = identity(4) for i in range(min(len(v),3)): m [i][3] = v[i] assert(len(v)<4 or len(v)==4 and v[3]==0) return m def scale(*v): """Returns a 4x4 matrix corresponding to scale by vector v. If v has only 2 coordinates, z=1 is assumed. If v has 4 coordinates, the homogenous (fourth) coordinate must be 0.""" m = identity(4) for i in range(min(len(v),3)): m [i][i] = v[i] assert(len(v)<4 or len(v)==4 and v[3]==0) return m def rotation(angle,*v): """Returns a 4x4 matrix corresponding to a rotation of angle radians about axis v. If v has 4 coordinates, the homogenous (fourth) coordinate must be 0.""" x,y,z = vector.normalize(v[:3]) u = [[x],[y],[z]] ut = [[x,y,z]] s = [[0,-z,y],[z,0,-x],[-y,x,0]] uut = product(u,ut) sina,cosa = sin(angle),cos(angle) m = add(uut, add(scalarproduct(sub(identity(3),uut),cosa),scalarproduct(s,sina))) return [[m[0][0],m[0][1],m[0][2],0], [m[1][0],m[1][1],m[1][2],0], [m[2][0],m[2][1],m[2][2],0], [0,0,0,1]] def rotby2vectors (startvector, endvector): """Given two vectors returns the rotation matrix that maps the first onto the second. Both vectors must be of length 3 (cartesian) or 4 (homogeneous). @param startvector: original vector. @param endvector: destination vector. @return: rotation matrix. """ r = vector.cross(vector.normalize(startvector), vector.normalize(endvector)) l = vector.length (r) if l<1e-10: angle,axis = 0,(0,0,1) else: angle,axis = asin(l), vector.scale(r,1.0/l) return rotation (angle,*axis) #=============================================================================== # Below, specific code for 4x4 matrices as returned by opengl "get" functions, # i.e., stored by column, rather than by row #=============================================================================== def gltransformpoint (m,p): """Returns a transformed point. @param m: an opengl transformation matrix, a 4x4 matrix stored by column. @param p: a point (3-float array). @return: p transformed by m. """ newp = list(m [3][0:3]) for i in range(3): for j in range (3): newp [i] = newp [i] + p[j] * m [j][i] return newp def gltransformvector (m,p): """Returns a transformed vector. @param m: an opengl transformation matrix, a 4x4 matrix stored by column. @param p: a vector (3-float array). @return: p transformed by m. """ newp = [0,0,0] for i in range(3): for j in range (3): newp [i] = newp [i] + p[j] * m [j][i] return newp def glinverse (m): """Returns the inverse of an opengl transformation matrix. This is slightly different from the inverse function because opengl's matrices are not regular lists. @param m: an opengl transformation matrix, a 4x4 matrix stored by column. @return: the inverse of m. """ return inverse ([[x for x in row] for row in m])
Python
from EditableVisualElement import EditableVisualElement, visualElement from graphicobject import GraphicObject, GraphicObjectCollection from cube import Cube from sphere import Sphere from material import Material from mesh import Mesh from halfedge import Halfedge,HalfedgeDS from light import Light from bbox import BoundingBox from meshloaders import loadoff import vector import matrix
Python
""" An implementation of the halfedge data structure, sometimes known as the *DCEL* (double connected edge list). It is capable of storing the topology of (planar?) graphs, which makes it very useful for handling polyedra, for instance. """ __all__=["Halfedge","HalfedgeDS"] from managedlist import ManagedList class Halfedge: "A Half edge." def __init__(self, vtx, opp, nxt, prv, fac): """Constructor. All fields are integer numbers which are supposed to be used as indices or keys to other data structures which store related information. @param vtx: vertex field. @param opp: opposite halfedge field. @param nxt: next halfedge field. @param prv: previous halfedge field. @param fac: face field. """ self.vtx, self.opp, self.nxt, self.prv, self.fac = vtx, opp, nxt, prv, fac def __repr__(self): """Return a representation string for the object.""" return "vtx=%d, opp=%d, nxt=%d, prv=%d, fac=%d"%( self.vtx, self.opp, self.nxt, self.prv, self.fac) class HalfedgeDS: "A half edge Data Structure." def __init__ (self, face=[], vertex=[]): """Constructor. @param face: an array of lists of vertex indices. @param vertex: an array of vertex data (usually vertex coordinates). The input arrays are not stored directly in the data structure. Nevertheless, the length of the vertex array is used to allocate an auxiliary table of vertex info, and thus should be big enough to store any vertex index mentioned in the face array.""" # Create an array that contains one incident halfedge for each face self.faceh = ManagedList([None]*len(face)) # Create an array that contains one incident halfedge for each vertex self.vertexh = ManagedList([None]*len(vertex)) # Create an array for all halfedges of the model self.halfedge = ManagedList([]) # Create a dictionary that maps pairs of vertex indices to halfedges edgedic = {} # Iterate over all faces for iface in range(len(face)): f = face[iface] # Previous vertex of the first vertex is the last vertex vprev = f [-1] # Iterate over all vertices of face for iv in range(len(f)): v = f[iv] # The index of this halfedge ihe = len(self.halfedge) # See if the opposite halfedge was already entered if (v,vprev) in edgedic: opposite = edgedic[v,vprev] self.halfedge[opposite].opp = ihe else: opposite = None # This halfedge must not have been entered yet assert ((vprev,v) not in edgedic) # Register this halfedge in the edge dictionary edgedic[(vprev,v)] = ihe # Compute index of previous halfedge if iv == 0: previous = ihe + len(f)-1 else: previous = ihe - 1 # Compute index of next halfedge if iv == len(f)-1: next = ihe - len(f) + 1 else: next = ihe + 1 # Create halfedge he = Halfedge(v,opposite,next,previous,iface) # Place it in the halfedge array self.halfedge.append(he) # Place it in the vertex array self.vertexh [v] = ihe # This v will be the vprev for the next iteration vprev = v # Place last halfedge created for the face in the face array self.faceh [iface] = ihe # Clean up non-manifold models by finding border edges self.findBorders () def findBorders (self): """Performs a cleaning up procedure after loading a mesh with unpaired halfedges. Chase all loops and fix them by creating a "fake" face. If a face is fake, then its number is included in the self.borderface set. @return: None. """ def nextBorder(he): """ Traverse a vertex circulation starting from he and find the next halfedge whose opposite is None. @param he: a border halfedge, i.e., a halfedge for which opp is None. @return: the index of the next border halfedge around the vertex.""" while self[he.nxt].opp != None: he = self[self[he.nxt].opp] return he.nxt def borderLoop(ihe): """ Finds the border loop starting with halfedge[ihe]. @param ihe: the index of a border halfedge, i.e., a halfedge for which opp is None. @return: a list of border halfedge indices.""" loop = [ihe] while True: he = self[ihe] assert(he.opp == None) ihe = nextBorder(he) if ihe in loop: break loop.append(ihe) assert (loop[0]==ihe) return loop self.borderface=set([]) for ihe in range(len(self.halfedge)): he = self.halfedge[ihe] if he.opp == None: loop = borderLoop(ihe) loop.reverse() # Create fake face for loop for iloop in range(len(loop)): # Where this border edge twin will be put ihetwin = len(self.halfedge) if iloop == 0: previous = ihetwin + len(loop)-1 else: previous = ihetwin - 1 if iloop == len(loop)-1: next = ihetwin - len(loop)+1 else: next = ihetwin + 1 v = self[loop[(iloop+1) % len(loop)]].vtx opposite = loop[iloop] self[opposite].opp = ihetwin iface = len(self.faceh) hetwin = Halfedge(v,opposite,next,previous,iface) self.halfedge.append(hetwin) # Remember one border halfedge for each loop self.faceh.append(ihetwin) self.borderface.add (iface) def __getitem__(self, index): """Indexing magic method. @param index: the index of a halfedge. @return: the halfedge corresponding to index. """ return self.halfedge[index] def __repr__(self): """ Representation magic method. Returns a string with a dump from this data structure. """ l = ["halfedges:"] for ihe in range(len(self.halfedge)): he = self.halfedge[ihe] l.append("%4d:"%ihe + str(he)) l.append("faces:"+",".join([str(x) for x in self.faceh])) l.append("vertices:"+",".join([str(x) for x in self.vertexh])) l.append("borderfaces:"+str(self.borderface)) return "\n".join(l) def index(self, he): """The inverse of the __index__ method, i.e., given a halfedge object, returns its index. @param he: a halfedge. @return: the index of halfedge he.""" return self.halfedge[he.nxt].prv def invertCirculations(self): """Inverts all face and border circulations. This is necessary for some mesh models which use clockwise circulations pointing out. """ newvtx = {} for he in self.halfedge: if he is not None: newvtx [he] = self.halfedge[he.prv].vtx for he in self.halfedge: if he is not None: he.prv,he.nxt = he.nxt,he.prv he.vtx = newvtx[he] for ihe in range(len(self.halfedge)): he = self.halfedge [ihe] if he is not None: self.vertexh[he.vtx]=ihe def aroundFace (self, iface): """Generator for the circulation of halfedges of face iface. Each returned element is a halfedge. @param iface: the face index. """ assert (self.faceh[iface] is not None) ihe = lastihe = self.faceh[iface] while True: he = self.halfedge[ihe] yield he ihe = he.nxt if ihe == lastihe: break def aroundVertex (self,ivtx): """Generator for the circulation of halfedges incident on vertex ivtx. Each returned element is a halfedge. @param ivtx: a vertex index.""" assert (self.vertexh[ivtx] is not None) ihe = lastihe = self.vertexh[ivtx] while True: he = self.halfedge[ihe] yield he ihe = self.halfedge[he.opp].prv assert (self.halfedge[ihe].vtx == ivtx) if ihe == lastihe: break def allFaces (self): """Generates one halfedge incident on each face of the model.""" for i in self.faceh.usedindices(): if i not in self.borderface: yield self.halfedge[self.faceh[i]] def allVertices (self): """Generates one halfedge incident on each vertex of the model.""" for ihe in self.vertexh.usedvalues(): yield self.halfedge[ihe] def allEdges (self): """Generates one halfedge incident on each edge of the model.""" for he in self.halfedge.usedvalues(): if he.vtx < self.halfedge[he.opp].vtx: yield he def splitEdge(self, he): """Splits the edge referred to by halfedge he. Creates a new vertex and a new edge (two halfedges). @param he: one of the halfedges for the edge to be split. @return: a halfedge that points to the new vertex and whose nxt field points to the input halfedge.""" ihe1 = self.halfedge.insert (None) ihe2 = self.halfedge.insert (None) ivtx = self.vertexh.insert (ihe1) ihe = self.index(he) op = self.halfedge[he.opp] self.halfedge[ihe1] = Halfedge (vtx=ivtx,opp=he.opp,nxt=ihe,prv=he.prv,fac=he.fac) self.halfedge[ihe2] = Halfedge (vtx=ivtx,opp=ihe,nxt=he.opp,prv=op.prv,fac=op.fac) self.halfedge[he.prv].nxt = ihe1 he.prv = ihe1 self.halfedge[op.prv].nxt = ihe2 op.prv = ihe2 return self.halfedge[ihe1] def removeEdge(self,he): """Removes the edge referred to by halfedge he and vertex he.vtx. The vertex circulations of he.vtx and halfedge[he.prv].vtx are merged. @param he: one of the halfedges of the edge to be removed. @return: the previous value of he.nxt (before the removal).""" ihe = self.index(he) op = self.halfedge[he.opp] for h in list(self.aroundVertex(he.vtx)): # Notice that we must first gather all halfedges with list() before # altering the vtx field, otherwise the generator will break h.vtx = op.vtx self.halfedge[he.prv].nxt = he.nxt self.halfedge[he.nxt].prv = he.prv self.halfedge[op.prv].nxt = op.nxt self.halfedge[op.nxt].prv = op.prv del self.halfedge[ihe] del self.halfedge[he.opp] return he.nxt if __name__=="__main__": # A simple test for class HalfedgeDS hds = HalfedgeDS ([ [3, 2, 1, 0], [7, 6, 2, 3], [4, 5, 6, 7], [0, 1, 5, 4], [1, 2, 6, 5], [3, 0, 4, 7] ], [ [-1, -1,1],[-1, -1,-1], [-1,1,-1], [-1,1,1], [1, -1,1],[1, -1,-1], [1, 1,-1], [1,1,1]]) print "Incident on vertex 0" print list(hds.aroundVertex(0)) print "" for h in hds.aroundVertex(0): print h print "All Edges" for h in hds.allEdges(): print h.vtx, "-", hds[h.opp].vtx print "All Faces" for h in hds.allFaces(): print "Face",h.fac,":", for hh in hds.aroundFace(h.fac): print hh.vtx, "-", print "" hesplit = hds.splitEdge(hds[0]) print "All Faces after edge split" print hds for h in hds.allFaces(): print "Face",h.fac,":", for hh in hds.aroundFace(h.fac): print hh.vtx, "-", print "" hds.removeEdge(hesplit) print "All Faces after edge removal" print hds for h in hds.allFaces(): print "Face",h.fac,":", for hh in hds.aroundFace(h.fac): print hh.vtx, "-", print "" hds.invertCirculations() print "All Faces with inverted circulations" for h in hds.allFaces(): print "Face",h.fac,":", for hh in hds.aroundFace(h.fac): print hh.vtx, "-", print ""
Python
""" Stuff to do with bounding boxes. """ __all__ = ["BoundingBox"] from OpenGL.GL import * from math import * import matrix class BoundingBox(object): """A Bounding Box. Used to approximate the locus of a graphic object.""" def __init__ (self, center=(0,0,0), side=(0,0,0)): """Constructor @param center: Center of the box @param side: Side length for each of the coordinate axes """ self.center = center self.side = side def radius(self): """Returns the half the size of a diagonal of the box. @return: radius of the box's bounding sphere.""" return sqrt(sum([x*x/4.0 for x in self.side])) def vertices (self): """Computes the box vertices. @return: an array with 8 vertices. Assuming index i corresponds to binary digits bz,by,bx, where a bit bk is 0 for the min value in that coordinate or 1 for the max value. Thus, for instance, index 6 = 110 corresponds to vertex (zmax, ymax, xmin). """ halfx,halfy,halfz = map(lambda a: a/2.0, self.side) cx,cy,cz = self.center return ((cx-halfx,cy-halfy,cz-halfz), (cx+halfx,cy-halfy,cz-halfz), (cx-halfx,cy+halfy,cz-halfz), (cx+halfx,cy+halfy,cz-halfz), (cx-halfx,cy-halfy,cz+halfz), (cx+halfx,cy-halfy,cz+halfz), (cx-halfx,cy+halfy,cz+halfz), (cx+halfx,cy+halfy,cz+halfz)) def draw(self): """Draws the box in wireframe.""" print "desenhando bounding box" vtx = self.vertices() glBegin (GL_LINE_LOOP) for i in (0,1,3,2,0,4,5,7,6,4): glVertex3fv(vtx[i]) glEnd () glBegin (GL_LINES) for i,j in ((2,6),(3,7),(1,5)): glVertex3fv (vtx[i]) glVertex3fv (vtx[j]) glEnd() def __add__(self, box): """Computes the sum of two bounding boxes. i.e., the bounding box of the union of two bounding boxes.""" mina = map (lambda i: self.center[i]-self.side[i]/2.0, range(3)) minb = map (lambda i: box.center[i]-box.side[i]/2.0, range(3)) maxa = map (lambda i: self.center[i]+self.side[i]/2.0, range(3)) maxb = map (lambda i: box.center[i]+box.side[i]/2.0, range(3)) minvtx = map (min, mina,minb) maxvtx = map (max, maxa,maxb) return BoundingBox(map (lambda a,b: (a+b)/2.0, minvtx,maxvtx), map (lambda a,b: a-b, minvtx,maxvtx)) @staticmethod def fromPoints (pts): """Returns a bounding box for a collection of points. @param pts: a sequence of points (x,y,z). """ minvtx = reduce (lambda a,b: map(min, a, b), pts, (1e100,1e100,1e100)) maxvtx = reduce (lambda a,b: map(max, a, b), pts, (-1e100,-1e100,-1e100)) return BoundingBox (map (lambda a,b: (a+b)/2.0, minvtx,maxvtx), map (lambda a,b: b-a, minvtx,maxvtx)) def transform (self,m): """Returns a transformed version of this bounding box. @param m: an opengl transformation matrix stored as an array with 16 floats. @return: a BoundingBox. """ return BoundingBox.fromPoints ( map (lambda p: matrix.gltransformpoint (m, p), self.vertices())) if __name__=="__main__": # A simple test box = BoundingBox()
Python
""" Implementation of a very simple set of classes for representing objects in a given scene. Most of the attributes and properties model OpenGL primitives and state variables, so that their meaning is mostly self-documenting. The idea here is that objects may be passed around or maybe stored (using pickle or something like that). Rendering an object should be as simple as calling its draw method. """ __all__=["GraphicObject","GraphicObjectCollection"] from OpenGL.GL import * from OpenGL.GLU import * from material import * import matrix from bbox import * from math import sqrt class GraphicObject(object): "Base class for graphic objects." def __init__(self,box,material=None,transformation=None): """Constructor. @param box: A bounding box for this object. @param material: the material object (Material). If None, means that no material is attached to this object and thus it will be rendered with the current material. @param transformation: a transformation (16-float vector). If None, then an identity transformation is meant. """ self._box = box self.material = material self.transformation = transformation def _changed (self): """Hook for doing bookkeeping whenever a property of the object is modified. Derived classes should rewrite this method for its own purposes""" pass def _settransf (self, transformation): "Setter for transformation" if transformation is None: self._transformation = matrix.identity(4) else: self._transformation = transformation self._changed () def _gettransf (self): "Getter for transformation" return self._transformation def _getbox(self): "Getter for box" return self._box def _setbox(self,box): "Setter for box" self._box = box self._changed() transformation = property (_gettransf, _settransf) box = property (_getbox, _setbox) def position(self): """Returns the translation part of this object's transformation. @return: position vector.""" if self._transformation is not None: return self._transformation[3][:3] return [0,0,0] def __gettransform (self,func,*args): """Finds the transformation obtained by composing the object's current transformation with the call to some function func which affects the current modelview matrix. The resulting transformation is stored in self.transformation. @param func: a function which affects the current modelview matrix (usually glTranslate, glRotate or some such). @param args: arguments to be passed to func. @return: None. """ glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() func(*args) if self._transformation is not None: glMultMatrixd(self._transformation) self.transformation = glGetDoublev(GL_MODELVIEW_MATRIX) glPopMatrix() def rotate (self,angle,x,y,z): """Alters the object's transformation with the given rotation. @param angle: rotation angle in degrees. @param x,y,z: rotation axis. @return: None. """ self.__gettransform (glRotatef,angle,x,y,z) def translate (self,dx,dy,dz): """Alters the object's transformation with the given translation. @param dx,dy,dz: offset vector. @return: None. """ self.__gettransform (glTranslatef,dx,dy,dz) def scale (self,dx,dy,dz): """Alters the object's transformation with the given scale. @param dx,dy,dz: scale factors. @return: None. """ self.__gettransform (glScalef,dx,dy,dz) def draw(self): """Object's drawing code.""" if self.material: self.material.draw() if self._transformation is not None: glMultMatrixd(self._transformation) class GraphicObjectCollection(GraphicObject,list): """A Collection of Graphic Objects.""" def __init__(self, collection=[], material=None, transformation=None): """Constructor. @param material: the material object (Material). If None, means that no material is attached to this object and thus it will be rendered with the current material. @param transformation: a 4x4 matrix stored by column, i.e., according to the opengl standard. If None, then an identity transformation is meant. @param collection: a list of GraphicObjects or nothing at all. """ print "collection ", collection GraphicObject.__init__(self,BoundingBox(),material,transformation) list.__init__(self,collection) self.computeBoundingBox() def computeBoundingBox(self): """Recomputes this collection's bounding box. Should be called before using the bounding box if it is not certain whether any of the elements' boxes have been modified. """ allPoints = [] for obj in self: if isinstance(obj,GraphicObject): allPoints += map(lambda p: matrix.gltransformpoint (obj.transformation, p), obj.box.vertices()) self.box = BoundingBox.fromPoints(allPoints) def draw(self): """Draws every object in the list suitably preceded by a name (in the OpenGL sense) which is index of the object in the list so as to help during GL_SELECTION rendering mode.""" GraphicObject.draw(self) for i in range(len(self)): glPushMatrix() glLoadName (i) print "GraphicObject.draw entrada ", self[i] self[i].draw() glPopMatrix() def pick(self,x,y): """Uses the OpenGL selection mechanism for figuring out which object lies at screen position (x,y). @param x,y: screen position. @return: the selection buffer, i.e., a list of tuples (mindepth, maxdepth, names), where names is a list of object names -- i.e., collection indices -- with the one on top of the stack last. Thus, if names==[3,10], then element 3 of this collection was hit and it was itself a collection whose element 10 was hit. """ # Prepare for picking glSelectBuffer(100) glRenderMode(GL_SELECT) viewport = glGetIntegerv (GL_VIEWPORT) projmatrix = glGetDoublev (GL_PROJECTION_MATRIX) glInitNames() glPushName(0) glMatrixMode (GL_MODELVIEW) glPushMatrix() glLoadIdentity () glMatrixMode (GL_PROJECTION) glPushMatrix () glLoadIdentity () # create 5x5 pixel picking region near cursor location gluPickMatrix (x, (viewport[3] - y), 5, 5, viewport); glMultMatrixd (projmatrix) self.draw() glPopName() buffer = glRenderMode(GL_RENDER) # Restore modelview glMatrixMode (GL_MODELVIEW) glPopMatrix () # Restore projection glMatrixMode (GL_PROJECTION) glPopMatrix () # Process hits return list(buffer) def pickClosest (self, x, y): """Uses the OpenGL selection mechanism for figuring out which object lies at screen position (x,y). Similar to pick, but returns only one object (the closest one). @param x,y: screen position. @return: A tuple (obj, z), where obj is the object and z is its z coordinate at the pick position. If no object lies at the given position, then obj is None.""" closest = None closestZ = 1.0 for hit in self.pick(x,y): minz, maxz, name = hit z = 1.0 * minz / (2**32-1) if z < closestZ: closestZ,closest = z, self[name[0]] return (closest, closestZ)
Python
""" Implementation of a list with stable index positions. """ class ManagedList(list): """This is a list where index positions are stable, i.e, whenever an element is removed (with del), the array is not shrunk, but rather, the position is marked as free. On the other hand, rather than appending, one may insert a new value in order to reuse freed space""" def __init__(self, *args): "Creates a managed list" super(ManagedList, self).__init__(*args) self.freeslots = [] def __delitem__(self, key): "Marks the element as unused (rather than removing it)" self.freeslots.append(key) self[key] = None def insert(self, value): "Puts the value somewhere in the list. Returns the index used." if self.freeslots!=[]: index = self.freeslots.pop() else: index = len(self) self.append(None) self[index] = value return index def usedindices(self): "Generates all occupied indices, i.e., all positions which are not None" for i in range(len(self)): if self[i] is not None: yield i def usedvalues(self): "Generates all non-null values" for i in range(len(self)): if self[i] is not None: yield self[i] if __name__=="__main__": # A simple test program l = ManagedList([100,20,306,9]) print l del l [2] del l [0] print l print map(lambda i: l[i], l.usedindices()) print map(lambda v: v, l.usedvalues()) l.insert(25) l.insert(30) l.insert(35) print l
Python
""" Material properties of objects. """ __all__=["Material"] from OpenGL.GL import * defaultMaterialDiffuse = (0.8, 0.8, 0.8, 1.0) defaultMaterialAmbient = (0.2, 0.2, 0.2, 1.0) defaultMaterialSpecular = (0,0,0,1) defaultMaterialEmission = (0,0,0,1) defaultMaterialShininess = 0 class Material(object): "A Material Object with properties for the Phong Model." def __init__(self,face=GL_FRONT, diffuse=defaultMaterialDiffuse, ambient=defaultMaterialAmbient, specular=defaultMaterialSpecular, emission=defaultMaterialEmission, shininess=defaultMaterialShininess): """Constructor. @param face: which face side this material should be attached to (GL_FRONT, GL_BACK or GL_FRONT_AND_BACK) @param ambient: ambient parameters (4-float vector) @param specular: specular parameters (4-float vector) @param diffuse: diffuse parameters (4-float vector) @param emission: emission parameters (4-float vector) @param shininess: cosine power for specular highlights (int) """ self.diffuse = diffuse self.ambient = ambient self.specular = specular self.shininess = shininess self.emission = emission self.face = face def draw(self): "Renders the object." glMaterialfv (self.face, GL_DIFFUSE,self.diffuse) glMaterialfv (self.face, GL_AMBIENT,self.ambient) glMaterialfv (self.face, GL_SPECULAR,self.specular) glMaterialfv (self.face, GL_EMISSION,self.emission) glMaterialf (self.face, GL_SHININESS,self.shininess) if __name__=="__main__": # A simple test material = Material()
Python
""" ArcBall.py -- Math utilities, vector, matrix types and ArcBall quaternion rotation class Would not it be great to rotate your model at will, just by using the mouse? With an ArcBall you can do just that. This implementation of the ArcBall class based on Bretton Wade is, which is based on Ken Shoemake implementation from the Graphic Gems series of books. However, with a little bug fixing and optimization for our purposes. """ ## The ArcBall works by mapping click coordinates in a window directly into the ArcBalls sphere coordinates, ## as if it were directly in front of you. # Numeric is a discontinued extension to the Python programming language. ## It provides tools to manage large, multi-dimensional arrays and matrices with ## a large library of high-level mathematical functions. # The most recent, NumPy, is a merge between the two that builds on the code base # of Numeric and adds the features of Numarray. # http://en.wikipedia.org/wiki/NumPy import numpy ## 'copy' module has a function named 'copy' that duplicate any object. # Copy a object is a alternative to the use of 'alias'. import copy from math import sqrt # //assuming IEEE-754(GLfloat), which i believe has max precision of 7 bits Epsilon = 1.0e-5 def sum (seq): try: seq.__iter__() except: return seq return reduce(lambda x, y: x + y, seq) class ArcBallT: # The coordinates were scaled down to the range of [-1...1] to make the math simpler; # by coincidence this also lets the compiler do a little optimization. ## Next we calculate the length of the vector and determine whether or not it is ## inside or outside of the sphere bounds. If it is within the bounds of the sphere, ## we return a vector from within the inside the sphere, else we normalize the point ## and return the closest point to outside of the sphere. # Once we have both vectors, we can then calculate a vector perpendicular to the start # and end vectors with an angle, which turns out to be a quaternion. # With this in hand we have enough information to generate a rotation matrix from, # and we are home free. ## The ArcBall is instantiated using the following constructor. NewWidth and NewHeight ## are essentially the width and height of the window. def __init__ (self, NewWidth, NewHeight): self.m_StVec = Vector3fT () self.m_EnVec = Vector3fT () self.m_AdjustWidth = 1.0 self.m_AdjustHeight = 1.0 self.setBounds (NewWidth, NewHeight) def __str__ (self): str_rep = "" str_rep += "StVec = " + str (self.m_StVec) str_rep += "\nEnVec = " + str (self.m_EnVec) str_rep += "\n scale coords %f %f" % (self.m_AdjustWidth, self.m_AdjustHeight) return str_rep def setBounds (self, NewWidth, NewHeight): ## If the window size changes, we simply update the ArcBall with that information: setBounds # //Set new bounds assert (NewWidth > 1.0 and NewHeight > 1.0), "Invalid width or height for bounds." # //Set adjustment factor for width/height self.m_AdjustWidth = 1.0 / ((NewWidth - 1.0) * 0.5) self.m_AdjustHeight = 1.0 / ((NewHeight - 1.0) * 0.5) ## First we simply scale down the mouse coordinates from the range of [0...width), [0...height) ## to [minus1...1], [1...minus1] (Keep in mind that we flip the sign of Y so that we get the correct ## results in OpenGL.) And this essentially looks like: def _mapToSphere (self, NewPt): # Given a new window coordinate, will modify NewVec in place X = 0 Y = 1 Z = 2 NewVec = Vector3fT () # //Copy paramter into temp point TempPt = copy.copy (NewPt) # //Adjust point coords and scale down to range of [-1 ... 1] TempPt [X] = (NewPt [X] * self.m_AdjustWidth) - 1.0 TempPt [Y] = 1.0 - (NewPt [Y] * self.m_AdjustHeight) # //Compute the square of the length of the vector to the point from the center length = sum(TempPt * TempPt) print "length = ",length # //If the point is mapped outside of the sphere... (length > radius squared) if (length > 1.0): # //Compute a normalizing factor (radius / sqrt(length)) norm = 1.0 / sqrt (length); # //Return the "normalized" vector, a point on the sphere NewVec [X] = TempPt [X] * norm; NewVec [Y] = TempPt [Y] * norm; NewVec [Z] = 0.0; else: # //Else it's on the inside # //Return a vector to a point mapped inside the sphere sqrt(radius squared - length) NewVec [X] = TempPt [X] NewVec [Y] = TempPt [Y] NewVec [Z] = sqrt (1.0 - length) return NewVec def click (self, NewPt): ## When the user clicks the mouse, the start vector is calculated based on where the click occurred. # //Mouse down (Point2fT self.m_StVec = self._mapToSphere (NewPt) return def drag (self, NewPt): ## When the user drags the mouse, the end vector is updated via the drag method, and if a quaternion ## output parameter is provided, this is updated with the resultant rotation. # //Mouse drag, calculate rotation (Point2fT Quat4fT) """ drag (Point2fT mouse_coord) -> new_quaternion_rotation_vec """ X = 0 Y = 1 Z = 2 W = 3 self.m_EnVec = self._mapToSphere (NewPt) # //Compute the vector perpendicular to the begin and end vectors # Perp = Vector3fT () Perp = Vector3fCross(self.m_StVec, self.m_EnVec); NewRot = Quat4fT () # //Compute the length of the perpendicular vector if (Vector3fLength(Perp) > Epsilon): # //if its non-zero # //We're ok, so return the perpendicular vector as the transform after all NewRot[X] = Perp[X]; NewRot[Y] = Perp[Y]; NewRot[Z] = Perp[Z]; # //In the quaternion values, w is cosine (theta / 2), where theta is rotation angle NewRot[W] = Vector3fDot(self.m_StVec, self.m_EnVec); else: # //if its zero # //The begin and end vectors coincide, so return a quaternion of zero matrix (no rotation) NewRot[X] = NewRot[Y] = NewRot[Z] = NewRot[W] = 0.0; return NewRot # ##################### Math utility ########################################## def Matrix4fT (): return numpy.identity (4, 'f') def Matrix3fT (): return numpy.identity (3, 'f') def Quat4fT (): return numpy.zeros (4, 'f') def Vector3fT (): return numpy.zeros (3, 'f') def Point2fT (x = 0.0, y = 0.0): pt = numpy.zeros (2, 'f') pt [0] = x pt [1] = y return pt def Vector3fDot(u, v): # Dot product of two 3f vectors dotprod = numpy.dot (u,v) return dotprod def Vector3fCross(u, v): # Cross product of two 3f vectors X = 0 Y = 1 Z = 2 cross = numpy.zeros (3, 'f') cross [X] = (u[Y] * v[Z]) - (u[Z] * v[Y]) cross [Y] = (u[Z] * v[X]) - (u[X] * v[Z]) cross [Z] = (u[X] * v[Y]) - (u[Y] * v[X]) return cross def Vector3fLength (u): # Teste 17-09 mag_squared = sum(u * u) mag = sqrt (mag_squared) return mag def Matrix3fSetIdentity (): return numpy.identity (3, 'f') def Matrix3fMulMatrix3f (matrix_a, matrix_b): #return numpy.matrixmultiply (matrix_a, matrix_b) return numpy.dot(matrix_a, matrix_b) def Matrix4fSVD (NewObj): X = 0 Y = 1 Z = 2 s = sqrt ( ( (NewObj [X][X] * NewObj [X][X]) + (NewObj [X][Y] * NewObj [X][Y]) + (NewObj [X][Z] * NewObj [X][Z]) + (NewObj [Y][X] * NewObj [Y][X]) + (NewObj [Y][Y] * NewObj [Y][Y]) + (NewObj [Y][Z] * NewObj [Y][Z]) + (NewObj [Z][X] * NewObj [Z][X]) + (NewObj [Z][Y] * NewObj [Z][Y]) + (NewObj [Z][Z] * NewObj [Z][Z]) ) / 3.0 ) return s def Matrix4fSetRotationScaleFromMatrix3f(NewObj, three_by_three_matrix): # Modifies NewObj in-place by replacing its upper 3x3 portion from the # passed in 3x3 matrix. # NewObj = Matrix4fT () NewObj [0:3,0:3] = three_by_three_matrix return NewObj # /** # * Sets the rotational component (upper 3x3) of this matrix to the matrix # * values in the T precision Matrix3d argument; the other elements of # * this matrix are unchanged; a singular value decomposition is performed # * on this object's upper 3x3 matrix to factor out the scale, then this # * object's upper 3x3 matrix components are replaced by the passed rotation # * components, and then the scale is reapplied to the rotational # * components. # * @param three_by_three_matrix T precision 3x3 matrix # */ def Matrix4fSetRotationFromMatrix3f (NewObj, three_by_three_matrix): scale = Matrix4fSVD (NewObj) NewObj = Matrix4fSetRotationScaleFromMatrix3f(NewObj, three_by_three_matrix); scaled_NewObj = NewObj * scale # Matrix4fMulRotationScale(NewObj, scale); return scaled_NewObj def Matrix3fSetRotationFromQuat4f (q1): # Converts the H quaternion q1 into a new equivalent 3x3 rotation matrix. X = 0 Y = 1 Z = 2 W = 3 NewObj = Matrix3fT () # Teste 17-09 n = sum (q1 * q1) s = 0.0 if (n > 0.0): s = 2.0 / n xs = q1 [X] * s; ys = q1 [Y] * s; zs = q1 [Z] * s wx = q1 [W] * xs; wy = q1 [W] * ys; wz = q1 [W] * zs xx = q1 [X] * xs; xy = q1 [X] * ys; xz = q1 [X] * zs yy = q1 [Y] * ys; yz = q1 [Y] * zs; zz = q1 [Z] * zs # This math all comes about by way of algebra, complex math, and trig identities. # See Lengyel pages 88-92 NewObj [X][X] = 1.0 - (yy + zz); NewObj [Y][X] = xy - wz; NewObj [Z][X] = xz + wy; NewObj [X][Y] = xy + wz; NewObj [Y][Y] = 1.0 - (xx + zz); NewObj [Z][Y] = yz - wx; NewObj [X][Z] = xz - wy; NewObj [Y][Z] = yz + wx; NewObj [Z][Z] = 1.0 - (xx + yy) return NewObj def unit_test_ArcBall_module (): # Unit testing of the ArcBall calss and the real math behind it. # Simulates a click and drag followed by another click and drag. print "unit testing ArcBall" Transform = Matrix4fT () LastRot = Matrix3fT () ThisRot = Matrix3fT () ArcBall = ArcBallT (640, 480) # print "The ArcBall with NO click" # print ArcBall # First click LastRot = copy.copy (ThisRot) mouse_pt = Point2fT (500,250) ArcBall.click (mouse_pt) # print "The ArcBall with first click" # print ArcBall # First drag mouse_pt = Point2fT (475, 275) ThisQuat = ArcBall.drag (mouse_pt) # print "The ArcBall after first drag" # print ArcBall # print # print print "Quat for first drag" print ThisQuat ThisRot = Matrix3fSetRotationFromQuat4f (ThisQuat) # Linear Algebra matrix multiplication A = old, B = New : C = A * B ThisRot = Matrix3fMulMatrix3f (LastRot, ThisRot) Transform = Matrix4fSetRotationFromMatrix3f (Transform, ThisRot) print "First transform" print Transform # Done with first drag # second click LastRot = copy.copy (ThisRot) print "LastRot at end of first drag" print LastRot mouse_pt = Point2fT (350,260) ArcBall.click (mouse_pt) # second drag mouse_pt = Point2fT (450, 260) ThisQuat = ArcBall.drag (mouse_pt) # print "The ArcBall" # print ArcBall print "Quat for second drag" print ThisQuat ThisRot = Matrix3fSetRotationFromQuat4f (ThisQuat) ThisRot = Matrix3fMulMatrix3f (LastRot, ThisRot) # print ThisRot Transform = Matrix4fSetRotationFromMatrix3f (Transform, ThisRot) print "Second transform" print Transform # Done with second drag LastRot = copy.copy (ThisRot) def _test (): # This will run doctest's unit testing capability. # see http://www.python.org/doc/current/lib/module-doctest.html # # doctest introspects the ArcBall module for all docstrings # that look like interactive python sessions and invokes # the same commands then and there as unit tests to compare # the output generated. Very nice for unit testing and # documentation. import doctest, ArcBall return doctest.testmod (ArcBall) if __name__ == "__main__": # Invoke our function that runs python's doctest unit testing tool. _test () # unit_test ()
Python
import wx from wx import glcanvas from OpenGL.GLUT import * from OpenGL.GLU import * from OpenGL.GL import * import sys,math name = 'ball_glut' class myGLCanvas(glcanvas.GLCanvas): def __init__(self, parent): #wx.EvtHandler.__init__(self) glcanvas.GLCanvas.__init__(self, parent,-1) wx.EVT_PAINT(self, self.OnPaint) self.init = 0 self.Bind(wx.EVT_KEY_DOWN, self.onKeyPress) return def onKeyPress(self, event): assert(event, wx.KeyEvent) print 'Keycode :', event.KeyCode print 'Modifiers :', event.Modifiers print 'RawKeycode :', event.RawKeyCode print 'RawKeyflags :', event.RawKeyFlags print 'Unicode :', event.UnicodeKey print 'X :', event.X print 'Y :', event.Y print '' def OnPaint(self,event): dc = wx.PaintDC(self) self.SetCurrent() if not self.init: glutInit() self.InitGL() self.init = 1 self.OnDraw() return def OnDraw(self): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glPushMatrix() color = [1.0,0.,0.,1.] glMaterialfv(GL_FRONT,GL_DIFFUSE,color) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) glutSolidSphere(2,20,20) glPopMatrix() self.SwapBuffers() return def InitGL(self): # set viewing projection #light_diffuse = [1.0, 1.0, 1.0, 1.0] #light_position = [1.0, 1.0, 1.0, 0.0] #glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse) #glLightfv(GL_LIGHT0, GL_POSITION, light_position) #glEnable(GL_LIGHTING) #glEnable(GL_LIGHT0) glEnable(GL_DEPTH_TEST) glClearColor(0.0, 0.0, 0.0, 1.0) glClearDepth(1.0) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(40.0, 1.0, 1.0, 30.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() gluLookAt(0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0) return def main(): app = wx.PySimpleApp() frame = wx.Frame(None,-1,'ball_wx',wx.DefaultPosition,wx.Size(400,400)) canvas = myGLCanvas(frame) frame.Show() app.MainLoop() if __name__ == '__main__': main()
Python
class CanvasSettings: nearZ = 1.0 farZ = 1000.0 fov = 40.0 class Settings: canvas = CanvasSettings() settings = Settings()
Python
class ObjectRegistry(object): def __init__(self): self.oidGObjectmap = {} self.count = 0 def register(self, gobject): self.count += 1 self.oidGObjectmap[self.count] = gobject return self.count def getGObject(self, oid): return self.oidGObjectmap.get(oid, None) objectRegistry = ObjectRegistry()
Python
import logging BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8) #The background is set with 40 plus the number of the color, and the foreground with 30 #These are the sequences need to get colored ouput RESET_SEQ = "\033[0m" COLOR_SEQ = "\033[1;%dm" BOLD_SEQ = "\033[1m" def formatter_message(message, use_color = True): if use_color: message = message.replace("$RESET", RESET_SEQ).replace("$BOLD", BOLD_SEQ) else: message = message.replace("$RESET", "").replace("$BOLD", "") return message COLORS = { 'WARNING': YELLOW, 'INFO': WHITE, 'DEBUG': BLUE, 'CRITICAL': YELLOW, 'ERROR': RED } class ColoredFormatter(logging.Formatter): def __init__(self, msg, use_color = True): logging.Formatter.__init__(self, msg) self.use_color = use_color def format(self, record): levelname = record.levelname if self.use_color and levelname in COLORS: levelname_color = COLOR_SEQ % (30 + COLORS[levelname]) + levelname + RESET_SEQ #levelname_color = levelname record.levelname = levelname_color return logging.Formatter.format(self, record) # Custom logger class with multiple destinations class ColoredLogger(logging.Logger): #FORMAT = "[$BOLD%(name)-14s$RESET][%(levelname)-8s] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)" FORMAT = "[$BOLD%(name)-14s$RESET][%(levelname)-8s] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)" COLOR_FORMAT = formatter_message(FORMAT, False) def __init__(self, name): logging.Logger.__init__(self, name, logging.DEBUG) color_formatter = ColoredFormatter(self.COLOR_FORMAT) console = logging.StreamHandler() console.setFormatter(color_formatter) self.addHandler(console) return logging.setLoggerClass(ColoredLogger) def getLogger(name): return logging.getLogger(name) log = getLogger('Canvas Logger') log.setLevel(logging.DEBUG)
Python
from math import sin, cos, sqrt, atan2 dotp = lambda u, v: sum([u[i]*v[i] for i in range(3)]) scalarp = lambda s, v: tuple([s*v[i] for i in range(3)]) vsum = lambda u, v: tuple([u[i] + v[i] for i in range(3)]) vdiff = lambda u, v: tuple([u[i] - v[i] for i in range(3)]) mag = lambda v: sqrt(sum([v[i]*v[i] for i in range(3)])) magsq = lambda v: sum([v[i]*v[i] for i in range(3)]) crossp = lambda u, v: (u[1]*v[2] - u[2]*v[1], -(u[0]*v[2] - u[2]*v[0]), u[0]*v[1] - u[1]*v[0]) def norm(v): m = 1.0/mag(v) return tuple([v[i]*m for i in range(3)]) def rotx(v, th): ct = cos(th) st = sin(th) return (v[0], ct*v[1] - st*v[2], st*v[1] + ct*v[2]) def roty(v, th): ct = cos(th) st = sin(th) return (ct*v[0] + st*v[2], v[1], -st*v[0] + ct*v[2]) def rotz(v, th): ct = cos(th) st = sin(th) return (ct*v[0] - st*v[1], st*v[0] + ct*v[1], v[2]) def findTPAngles(v): x, y, z = v m = sqrt(x*x + z*z) t = -atan2(y, m) p = atan2(x, z) return t, p
Python
from time import time class TimeStat(object): def __init__(self): self.tsdata = {} def __call__(self, func, name=None): name = func.__name__ if not name else name self.tsdata[name] = (0, 0, 0, 0) def wrapper(*args, **kw): ts = time() try: func(*args, **kw) except: from canvas3d import log log.exception("Error in calling func from time stat wrapper") telapsed = time() - ts num, mn, tot, mx = self.tsdata[name] mn = min(mn, telapsed) tot += telapsed mx = max(mx, telapsed) num += 1 self.tsdata[name] = (num, mn, tot, mx) return wrapper def printStats(self): width = (5*11 + 38) patternd = '# %-34s # %8d # %8.5f # %8.5f # %8.5f # %8.3f #' patternh = '# %-34s # %8s # %8s # %8s # %8s # %8s #' headers = ('Function name', 'calls', 'min', 'avg', 'max', 'total') print '#' + '-' * (width - 2) + '#' print patternh%headers print '#' + '-' * (width - 2) + '#' for key in sorted(self.tsdata.keys()): data = self.tsdata[key] key = key[:30] num, mn, tot, mx = data avg = tot/num if num > 0 else 0 mn *= 1000 avg *= 1000 mx *= 1000 print patternd%(key, num, mn, avg, mx, tot) print '#' + '-' * (width - 2) + '#' timestat = TimeStat()
Python
import FTGL import os from logger import log class Fonts(object): def __init__(self): self.fontRef = {} self.uiFonts = [] def __call__(self, fontfilename, fonttype, size): f = self.fontRef.get((fontfilename, fonttype, size), None) if f: return f try: assert os.path.isfile(fontfilename) except: log.error('Font file path not correct. Failed to load fonts') return None f = fonttype(fontfilename) f.FaceSize(size) self.fontRef[(fontfilename, fonttype, size)] = f self.uiFonts.append(f) return f fonts = Fonts() regularFont = fonts('Courier_New.ttf', FTGL.TextureFont, 14) tooltipFont = fonts('Verdana.ttf', FTGL.TextureFont, 14) assert isinstance(tooltipFont, FTGL.TextureFont) assert isinstance(regularFont, FTGL.TextureFont) fontData = []
Python
from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from random import random, randint from gobjects import Sphere, GObject, Tetrahedron, \ Cylinder, Scene, Arrow from fonts import regularFont, tooltipFont class TestSceneGenerator(object): def __init__(self): pass def get3DScene(self, canvas): self.scene3d = TestScene(canvas) return self.scene3d def getOverlayScene(self, canvas): self.overlay = TestOverlay(canvas) return self.overlay class TestScene(Scene): def __init__(self, canvas): Scene.__init__(self, canvas) nSpheres = 10 self.nSpheres = nSpheres self.col = [(random(), random(), random(), 1.0) for x in range(nSpheres)] self.pos = [(randint(-30, 30), randint(2, 20), randint(-30,30)) for i in range(nSpheres)] self.radii = [random()*2 + 0.5 for x in range(nSpheres)] self.spheres = map(self.addChild, [Sphere(self, self.pos[x][0], self.pos[x][1], self.pos[x][2], self.radii[x], color=self.col[x], tooltip='Sphere %04d'%x) for x in range(nSpheres)]) nCylinders = 10 self.nCyls = nCylinders self.col = [(random(), random(), random(), 1.0) for x in range(nCylinders)] self.pos = [(randint(-30, 30), randint(2, 20), randint(-30,30)) for i in range(nCylinders)] self.radii = [random()*2 + 0.5 for x in range(nCylinders)] self.cylinders = map(self.addChild, [Cylinder(self, self.pos[x][0], self.pos[x][1], self.pos[x][2], self.pos[x][0], self.pos[x][1]+3, self.pos[x][2]+7, self.radii[x], color=self.col[x], tooltip='Cylinder %04d'%x) for x in range(nCylinders)]) nTdrons = 10 color = [(random(), random(), random(), 1.0) for x in range(nTdrons)] pos = [(randint(-50, 50), randint(2, 20), randint(-50,50)) for i in range(nTdrons)] tDrons = map(self.addChild, [Tetrahedron(self, pos[x][0], pos[x][1], pos[x][2], color=color[x], tooltip='TetraHedron %04d'%x).scale(5,5,5) for x in range(nTdrons)]) class TestOverlay(Scene): def __init__(self, canvas): Scene.__init__(self, canvas) self.axes = Arrow(self, 0, 0, 0, tooltip='Axes').scale(5, 5, 5) def render(self): glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() glMatrixMode(GL_PROJECTION) glPushMatrix() glLoadIdentity() w, h = self.canvas.windowSize size = max(w, h) / 2.0 aspect = float(w) / float(h) if w <= h: aspect = float(h) / float(w) glOrtho(-size, size, -size*aspect, size*aspect, -100000.0, 100000.0) else: glOrtho(-size*aspect, size*aspect, -size, size, -100000.0, 100000.0) glScaled(aspect, aspect, 1.0) glMatrixMode(GL_MODELVIEW) glPushAttrib(GL_LIGHTING_BIT| GL_DEPTH_BITS) glTranslate(-w/2 + 40, -h/2 + 40, 99950) self.canvas.camera.applyRotations() self.axes.render() glDisable(GL_LIGHTING) glDisable(GL_DEPTH_TEST) glShadeModel(GL_SMOOTH) glLoadIdentity() self.showCameraCoordinates() glPopAttrib() glPopMatrix() glMatrixMode(GL_PROJECTION) glPopMatrix() for child in self.children: child.render() def showCameraCoordinates(self): # draw children cc = self.canvas.camera.getState() labels = ('x', 'y', 'z', 'tilt', 'pan') args = [] for i in range(len(cc)): args.append(labels[i]) args.append(cc[i]) msg = ("%5s %8.2f\n"*5).strip() msg = msg%tuple(args) self.showMessage(msg, 20) def showMessage(self, msg, padding): if not msg: return lines = msg.split('\n') bbxs = [regularFont.BBox(line) for line in lines] ipadding = 5 wpadding = padding mHeight = max([b[4] for b in bbxs]) height = mHeight*len(lines) + ipadding*(len(lines) + 1) width = max([b[3] for b in bbxs]) + ipadding*2 w, h = self.canvas.windowSize r = w/2 - wpadding b = wpadding - h/2 t = b + height l = r - width cx = (r + l)/2 cy = (b + t)/2 glTranslate(l, b, 0) glColor4f(0, 0, 0, 0.4) glBegin(GL_TRIANGLE_STRIP) glVertex3f(0, 0, 0) glVertex3f(width, 0, 0) glVertex3f(0, height, 0) glVertex3f(width, height, 0) glEnd() glColor4f(1, 1, 1, 1) for i, line in enumerate(reversed(lines)): glPushMatrix() glTranslate(ipadding, ipadding*(i+1) + mHeight*i, 0) regularFont.Render(line) glPopMatrix() def main(): import wx from canvas3d import Canvas3D from timestat import timestat from wx.glcanvas import WX_GL_RGBA, WX_GL_DOUBLEBUFFER app = wx.App() frame3D = wx.Frame(None, -1, "Canvas 3D", wx.Point(1100, 50), wx.Size(800,400)) canvas = Canvas3D(frame3D, WX_GL_RGBA, WX_GL_DOUBLEBUFFER) frame3D.Show() app.MainLoop() print "Exiting main loop\n" timestat.printStats() if __name__ == '__main__': main()
Python
#!/usr/bin/python import sys from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * import FTGL fonts = [] width = 600 height = 600 def do_ortho(): w, h = width, height glViewport(0, 0, w, h) glMatrixMode(GL_PROJECTION) glLoadIdentity() size = max(w, h) / 2.0 aspect = float(w) / float(h) if w <= h: aspect = float(h) / float(w) glOrtho(-size, size, -size*aspect, size*aspect, -100000.0, 100000.0) else: glOrtho(-size*aspect, size*aspect, -size, size, -100000.0, 100000.0) glScaled(aspect, aspect, 1.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() def draw_scene(): string = [] chars = [] chars[:] = [] for i in range(1, 32): chars.append(chr(i)) string.append("".join(chars)) chars[:] = [] for i in range(32, 64): chars.append(chr(i)) string.append("".join(chars)) chars[:] = [] for i in range(64, 96): chars.append(chr(i)) string.append("".join(chars)) chars[:] = [] for i in range(96, 128): chars.append(chr(i)) string.append("".join(chars)) chars[:] = [] for i in range(128, 160): chars.append(chr(i)) string.append("".join(chars)) chars[:] = [] for i in range(160, 192): chars.append(chr(i)) string.append("".join(chars)) chars[:] = [] for i in range(192, 224): chars.append(chr(i)) string.append("".join(chars)) chars[:] = [] for i in range(224, 256): chars.append(chr(i)) string.append("".join(chars)) glColor3f(1.0, 1.0, 1.0) for i, font in enumerate(fonts): x = -250.0 yild = 20.0 for j in range(0, 4): y = 275.0 - i * 120.0 - j * yild if i >= 3: glRasterPos(x, y) font.Render(string[j]) elif i == 2: glEnable(GL_TEXTURE_2D) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glPushMatrix() glTranslatef(x, y, 0.0) font.Render(string[j]) glPopMatrix() glDisable(GL_TEXTURE_2D) glDisable(GL_BLEND) else: glPushMatrix() glTranslatef(x, y, 0.0) font.Render(string[j]) glPopMatrix() def on_display(): glClear(GL_COLOR_BUFFER_BIT) do_ortho() draw_scene() glutSwapBuffers() def on_reshape(w, h): width, height = w, h def on_key(key, x, y): if key == '\x1b': sys.exit(1) if __name__ == '__main__': glutInitWindowSize(width, height) glutInit(sys.argv) glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE) glutCreateWindow("PyFTGL Demo") glClearColor(0.0, 0.0, 0.0, 0.0) try: fonts = [ FTGL.OutlineFont(sys.argv[1]), FTGL.PolygonFont(sys.argv[1]), FTGL.TextureFont(sys.argv[1]), FTGL.BitmapFont(sys.argv[1]), FTGL.PixmapFont(sys.argv[1]), ] for font in fonts: font.FaceSize(24, 72) except: print "usage:", sys.argv[0], "font_filename.ttf" sys.exit(0) glutDisplayFunc(on_display) glutReshapeFunc(on_reshape) glutKeyboardUpFunc(on_key) glutMainLoop()
Python
COLOR_GREY = (0.6, 0.6, 0.6, 1.0) COLOR_BLACK = (0.0, 0.0, 0.0, 1.0) COLOR_WHITE = (1.0, 1.0, 1.0, 1.0) GEN_GREY = lambda x: (x, x, x, 1.0)
Python
######################################################### ## ## ## OpenGl Canvas for drawing stereo 3D images and ## handling mouse and keyboard control ## ## ######################################################### import wx import traceback from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from wx.glcanvas import GLCanvas as wxGLCanvas from wx.glcanvas import WX_GL_RGBA, WX_GL_DOUBLEBUFFER from math import pi, exp from random import random, randint from time import time from colors import COLOR_BLACK, COLOR_GREY, COLOR_WHITE, GEN_GREY from timestat import timestat from logger import log from logging import DEBUG, INFO, WARN, ERROR, CRITICAL from camera import Camera from objectregistry import objectRegistry from gobjects import Sphere, GObject, Ground from fonts import fonts, tooltipFont from testscene import TestSceneGenerator, TestScene, TestOverlay from settings import settings ######################################################### ## ## ## Constants ## ## ######################################################### BACKGROUNDCOLOR = (1, 1, 1, 1) GROUND_TRANSPARENCY = (0.8,) logLevels = [DEBUG, INFO, WARN, ERROR, CRITICAL] ######################################################### ## ## ## Classes ## ## ######################################################### class Canvas3D(wxGLCanvas): def __init__(self, parent, colorMode, doubleBuffer, sceneGenerator=None): wxGLCanvas.__init__(self, parent, attribList=(colorMode, doubleBuffer,)) self.initBindings() self.initVariables(parent, sceneGenerator) @timestat def initBindings(self): self.Bind(wx.EVT_PAINT, self.onPaint) self.Bind(wx.EVT_SIZE, self.onResize) self.Bind(wx.EVT_KEY_DOWN, self.onKeyDown) self.Bind(wx.EVT_CLOSE, self.onClose) self.Bind(wx.EVT_MOTION, self.onMouseMotion) self.Bind(wx.EVT_LEFT_DOWN, self.onLeftDown) self.Bind(wx.EVT_LEFT_UP, self.onLeftUp) self.Bind(wx.EVT_LEFT_DCLICK, self.onLeftDClick) self.Bind(wx.EVT_RIGHT_DOWN, self.onRightDown) self.Bind(wx.EVT_RIGHT_UP, self.onRightUp) self.Bind(wx.EVT_MIDDLE_DOWN, self.onMiddleDown) self.Bind(wx.EVT_MIDDLE_UP, self.onMiddleUp) self.Bind(wx.EVT_MOUSEWHEEL, self.onMouseWheel) self.renderPickingTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.onDrawPicking, self.renderPickingTimer) self.renderPickingTimer.Stop() self.SetFocus() @timestat def initVariables(self, parent, sceneGenerator): self.settings = settings.canvas self.initialCameraState = (0,100,0,-pi/2,0) self.camera = Camera(self, self.initialCameraState) self.camera.subscribe(self.onCameraChanged) self.init = 0 self.parent = parent if sceneGenerator: self.scene = sceneGenerator.get3DScene(self) self.overlay = sceneGenerator.getOverlayScene(self) else: testSG = TestSceneGenerator() self.scene = testSG.get3DScene(self) self.overlay = testSG.getOverlayScene(self) self.ground = Ground(None, l=2000, w=2000, color=(COLOR_WHITE[:3] + (0.8,)), selectable=False) self.fovChanged = False self._leftDown = False self._leftDownx = None self._leftDowny = None self._middleDown = False self._middleDownx = None self._middleDowny = None self._rightDown = False self._rightDownx = None self._rightDowny = None self.leftMouseDragStart = False self.middleMouseDragStart = False self.rightMouseDragStart = False self.lastMouseWheelTime = time() self.latchedObject = None self.oldLatchedObject = None self.lastMouseMotionPosition = None self.highlightCallDelay = 30 self.cameraChanged = False self.logLevel = DEBUG log.setLevel(self.logLevel) self.pickingEnabled = False self.keyBindings = {('W',):[self.camera.moveForward], ('S',):[self.camera.moveBackward], ('A',):[self.camera.moveLeft], ('D',):[self.camera.moveRight], ('Q',):[self.camera.moveUp], ('Z',):[self.camera.moveDown], ('R',):[(lambda:self.camera.resetState(self.initialCameraState))], ('G',):[self.camera.incMoveDistance], ('F',):[self.incFov], ('V',):[self.decFov], ('B',):[self.camera.decMoveDistance], ('1',):[self.changeLogLevel], ('CTRL', 314,):[lambda : self.camera.orbit(-1, 0)], # Left arrow ('CTRL', 315,):[lambda : self.camera.orbit( 0, 1)], # Up arrow ('CTRL', 316,):[lambda : self.camera.orbit( 1, 0)], # Right arrow ('CTRL', 317,):[lambda : self.camera.orbit( 0,-1)], # Down arrow ('F',):[self.incFov], } def changeLogLevel(self): i = (logLevels.index(self.logLevel) + 1)%len(logLevels) self.logLevel = logLevels[i] log.setLevel(self.logLevel) log.critical('Changing log level to %d'%self.logLevel) def onLeftDown(self, event): assert isinstance(event, wx.MouseEvent) if self._middleDown: self.onMiddleUp(event) if self._rightDown: self.onRightUp(event) self._leftDown = True self._leftDownx, self._leftDowny = event.GetPositionTuple() ctrlDown = 1 if event.ControlDown() else 0 if ctrlDown: if self.latchedObject and self.latchedObject.selectable: log.debug('selecting latched object') self.selectedObject = self.latchedObject pass def onLeftUp(self, event): self._leftDown = False if self.leftMouseDragStart: self.leftMouseDragStart = False self.camera.leftDragEnd() wx.CallLater(self.highlightCallDelay, self.OnPickAndRefresh) else: # select object below #if self.latchedObject and self.latchedObject.selectable: #print 'selecting latched object' #self.selectedObject = self.latchedObject pass def onLeftDClick(self, event): assert isinstance(event, wx.MouseEvent) def onRightDown(self, event): assert isinstance(event, wx.MouseEvent) if self._middleDown: self.onMiddleUp(event) if self._leftDown: self.onLeftUp(event) self._rightDown = True self._rightDownx, self._rightDowny = event.GetPositionTuple() def onRightUp(self, event): self._rightDown = False if self.rightMouseDragStart: self.rightMouseDragStart = False self.camera.rightDragEnd() wx.CallLater(self.highlightCallDelay, self.OnPickAndRefresh) def onMiddleDown(self, event): assert isinstance(event, wx.MouseEvent) if self._leftDown: self.onLeftUp(event) if self._rightDown: self.onRightUp(event) self._middleDown = True self._middleDownx, self._middleDowny = event.GetPositionTuple() def onMiddleUp(self, event): self._middleDown = False if self.middleMouseDragStart: self.middleMouseDragStart = False self.camera.middleDragEnd() wx.CallLater(self.highlightCallDelay, self.OnPickAndRefresh) @timestat def onMouseMotion(self, event): assert isinstance(event, wx.MouseEvent) posx, posy = event.GetPositionTuple() self.lastMouseMotionPosition = posx, posy, 0 self.latchedObject = None ctrlDown = 1 if event.ControlDown() else 0 altDown = 1 if event.AltDown() else 0 shiftDown = 1 if event.ShiftDown() else 0 metaDown = 1 if event.MetaDown() else 0 modifiers = (ctrlDown << 3) | (altDown << 2) | (shiftDown << 1) | (metaDown) if self._leftDown and not modifiers: dx, dy = posx - self._leftDownx, posy - self._leftDowny if (abs(dx) > 2) or (abs(dy) > 2): self.leftMouseDragStart = True self.camera.rotate(dx, dy) elif self._leftDown and (modifiers & 0x8): dx, dy = posx - self._leftDownx, posy - self._leftDowny if self.selectedObject: self.selectedObject.move(dx, dy, 0) elif self._middleDown: dx, dy = posx - self._middleDownx, posy - self._middleDowny if (abs(dx) > 2) or (abs(dy) > 2): self.middleMouseDragStart = True self.camera.orbit(dx, dy, self.latchedCoordinates) elif self._rightDown: dx, dy = posx - self._rightDownx, posy - self._rightDowny if (abs(dx) > 2) or (abs(dy) > 2): self.rightMouseDragStart = True self.camera.strafe(posx, self.windowSize[1] - posy, self.pickDepth, self.latchedCoordinates, self.latchedMVMatrix) elif self.pickingEnabled: sizey = self.windowSize[1] #log.debug('Mouse position = %d %d'%(posx, sizey - posy)) oid, coords = self.pick(posx, sizey - posy) self.latchedObject = objectRegistry.getGObject(oid) if self.latchedObject == self.oldLatchedObject: if self.latchedObject: self.latchedCoordinates = coords else: self.latchedCoordinates = None return self.oldLatchedObject = self.latchedObject self.latchedMVMatrix = glGetDoublev(GL_MODELVIEW_MATRIX) log.debug('tooltip = %s'%(self.latchedObject.tooltip if self.latchedObject else 'NA')) if self.latchedObject: self.latchedCoordinates = coords else: self.latchedCoordinates = None self.Refresh() def OnPickAndRefresh(self): if self.pickingEnabled: posx , posy, dummy = self.lastMouseMotionPosition sizey = self.windowSize[1] #log.debug('Mouse position = %d %d'%(posx, sizey - posy)) oid, coords = self.pick(posx, sizey - posy) self.latchedObject = objectRegistry.getGObject(oid) if self.latchedObject: self.latchedCoordinates = coords if self.latchedObject == self.oldLatchedObject: return self.oldLatchedObject = self.latchedObject self.latchedMVMatrix = glGetDoublev(GL_MODELVIEW_MATRIX) log.debug('tooltip = %s'%(self.latchedObject.tooltip if self.latchedObject else 'NA')) self.Refresh() def onMouseWheel(self, event): wheelRotation = event.WheelRotation tnow = time() tdiff = tnow - self.lastMouseWheelTime self.lastMouseWheelTime = tnow scale = 40*exp(-20*tdiff) + 0.1 log.info('wheel rotation scale: %4.2f'%scale) if wheelRotation > 0: self.camera.zoomIn(self.latchedCoordinates) else: self.camera.zoomOut(self.latchedCoordinates) def incFov(self): # method goes in here self.settings.fov *= 1.1 log.info('Fov = %f'%self.settings.fov) self.fovChanged = True self.Refresh() pass def decFov(self): # method goes in here self.settings.fov /= 1.1 log.info('Fov = %f'%self.settings.fov) self.fovChanged = True self.Refresh() pass def onKeyDown(self, event): assert isinstance(event, wx.KeyEvent) keycode = event.KeyCode key = None if event.m_controlDown: key = ('CTRL', ) + key try: try: key = chr(keycode) except ValueError: key = keycode log.info("Key, Keycode = %s, %d"%(key, keycode)) key = (key, ) if event.m_metaDown: key = ('META', ) + key if event.m_altDown: key = ('ALT', ) + key if event.m_shiftDown: key = ('SHIFT', ) + key if event.m_controlDown: key = ('CTRL', ) + key if key in self.keyBindings: for cb in self.keyBindings[key]: cb() except: log.debug('keycode = %d'%keycode) if keycode == 27: # ESC key self.Close() def updateScene(self): self.scene.update() def Refresh(self): if not self.refreshAlreadyScheduled: wx.CallAfter(super(Canvas3D, self).Refresh) self.refreshAlreadyScheduled = True def onPaint(self,event): try: dc = wx.PaintDC(self) self.refreshAlreadyScheduled = False self.SetCurrent() if not self.init: glutInit() self.InitGL() self.init = 1 self.renderStart = time() self.nFrames = 0 self.updateScene() self.onDraw() except: traceback.print_exc(10) #self.onDrawPicking('dummy') #self.SwapBuffers() def onClose(self, event): log.info('Closing application') if not self.Unbind(wx.EVT_PAINT): log.error("Failed in unbind") if not self.Unbind(wx.EVT_SIZE): log.error("Failed in unbind") if not self.Unbind(wx.EVT_KEY_DOWN): log.error("Failed in unbind") self.parent.Close() def addSourceLight(self): glPushMatrix() glLoadIdentity() glLightfv(GL_LIGHT2, GL_DIFFUSE, (0.3, 0.3, 0.3, 1.0)) glLightfv(GL_LIGHT2, GL_POSITION, (0, 0, 0, 0)) glEnable(GL_LIGHT2) glPopMatrix() @timestat def onDraw(self): self.renderPickingTimer.Stop() self.pickingEnabled = False glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) if self.fovChanged: self.fovChanged = False self.onResize('ignore') if self.cameraChanged: self.cameraChanged = False glMatrixMode(GL_MODELVIEW) glLoadIdentity() self.camera.applyTransformation() # various lights to use in the scene light_diffuse = [0.8, 0.8, 0.8, 1.0] light_ambient = [0.2, 0.2, 0.2, 1.0] light0_position = [1.0, 1.0, 1.0, 0.0] light2_position = [-1.0, 0.0, 0.0, 0.0] glMatrixMode(GL_MODELVIEW) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glLightfv(GL_LIGHT0, GL_DIFFUSE, COLOR_WHITE) glLightfv(GL_LIGHT0, GL_POSITION, light0_position) glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient) glLightfv(GL_LIGHT2, GL_DIFFUSE, COLOR_WHITE) glLightfv(GL_LIGHT2, GL_POSITION, light2_position) glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) glEnable(GL_LIGHT1) glEnable(GL_LIGHT2) glEnable(GL_LINE_SMOOTH) glEnable(GL_POINT_SMOOTH) glEnable(GL_MULTISAMPLE) #self.addSourceLight() glPushMatrix() glScalef(1.0, -1.0, 1.0) self.scene.render() glPopMatrix() # Draw the ground glDisable (GL_LIGHTING) glColor4fv(COLOR_BLACK) glBegin(GL_LINES) for x in range(-200, 210, 10): glVertex3f(x, -0.55, 200.0) glVertex3f(x, -0.55, -200.0) glVertex3f(200.0, -0.55, x) glVertex3f(-200.0, -0.55, x) glEnd() self.ground.render() glEnable (GL_LIGHTING) self.scene.render() self.highlightLatchedObject() self.overlay.render() self.SwapBuffers() td = time() - self.renderStart self.nFrames += 1 if td > 5: log.info('Rendering %f fps'%(self.nFrames/td)) self.renderStart = time() self.nFrames = 0 self.renderPickingTimer.Start(10) def highlightLatchedObject(self): if self.latchedObject and self.latchedObject.selectable: glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() scale = 0.999 glScalef(scale, scale, scale) self.camera.applyTransformation() glPushAttrib( GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_LIGHTING_BIT | GL_CURRENT_BIT | GL_MULTISAMPLE_BIT | GL_SCISSOR_BIT | GL_POLYGON_BIT) #glPolygonOffset(1.0,1.0) #glEnable(GL_POLYGON_OFFSET_FILL) #glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) glDisable(GL_LIGHTING) glShadeModel(GL_FLAT) glColor4f(1.0, 1.0, 1.0, 0.7) def makeHierarchy(ob): h = [ob] while hasattr(ob, 'parent'): if ob.parent: ob = ob.parent h.append(ob) else: break h.reverse() return h[1:] objHierarchy = makeHierarchy(self.latchedObject) if objHierarchy: for obj in objHierarchy[:-1]: if hasattr(obj, 'transforms'): for t in obj.transforms: t.apply() # draw the highlight self.latchedObject.highlightRender() #glDisable(GL_POLYGON_OFFSET_FILL) glPopAttrib() glPopMatrix() if self.latchedObject.tooltip: log.debug('Drawing tooltip: %s'%self.latchedObject.tooltip) self.drawTooltip() def drawTooltip(self): # draw the black border glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() glMatrixMode(GL_PROJECTION) glPushMatrix() glLoadIdentity() w, h = self.windowSize size = max(w, h) / 2.0 aspect = float(w) / float(h) if w <= h: aspect = float(h) / float(w) glOrtho(-size, size, -size*aspect, size*aspect, -100000.0, 100000.0) else: glOrtho(-size*aspect, size*aspect, -size, size, -100000.0, 100000.0) glScaled(aspect, aspect, 1.0) glPushAttrib(GL_LIGHTING_BIT| GL_DEPTH_BITS) glDisable(GL_LIGHTING) glDisable(GL_DEPTH_TEST) pos = self.lastMouseMotionPosition glTranslate(pos[0] - w/2, h/2 - pos[1], pos[2]) bbox = tooltipFont.BBox(str(self.latchedObject.tooltip)) ipadding = 6 opadding = 10 glColor4f(0, 0, 0, 0.6) glBegin(GL_TRIANGLE_STRIP) glVertex3f(opadding, opadding, 0) glVertex3f(bbox[3] + 2*ipadding + opadding, opadding, 0) glVertex3f(opadding, bbox[4] + 2*ipadding + opadding, 0) glVertex3f(bbox[3] + 2*ipadding + opadding, bbox[4] + 2*ipadding + opadding, 0) glEnd() glTranslate(ipadding + opadding, ipadding + opadding, 0) glColor4f(1, 1, 1, 1) tooltipFont.Render(self.latchedObject.tooltip) glPopAttrib() glMatrixMode(GL_MODELVIEW) glPopMatrix() glMatrixMode(GL_PROJECTION) glPopMatrix() # draw the text pass def onDrawPicking(self, event): self.renderPickingTimer.Stop() glPushAttrib( GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_LIGHTING_BIT | GL_CURRENT_BIT | GL_MULTISAMPLE_BIT | GL_SCISSOR_BIT) glDisable(GL_LIGHTING) glDisable(GL_BLEND) glDisable(GL_LINE_SMOOTH) glDisable(GL_POINT_SMOOTH) glDisable(GL_COLOR_MATERIAL) glDisable(GL_MULTISAMPLE) glShadeModel(GL_FLAT) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glPushMatrix() self.ground.renderPicking() self.scene.renderPicking() glPopMatrix() glPopAttrib() self.pickingEnabled = True def pick(self, x, y): rgb = glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, outputType=None) rgb = rgb[0][0] val = rgb[0]*256*256 + rgb[1]*256 + rgb[2] depth = glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT) depth = depth[0][0] self.pickDepth = depth coords = gluUnProject(x, y, depth) log.debug('Pick val, coords = 0x%06x, %5.4f, %5.4f, %5.4f'%( val, coords[0], coords[1], coords[2])) return val, coords def onResize(self, event): self.setProjection() def setProjection(self, size=None): if not size: size = self.windowSize = self.GetClientSizeTuple() glViewport(0, 0, size[0], size[1]) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(self.settings.fov, float(size[0])/size[1], self.settings.nearZ, self.settings.farZ) self.camera.PMatrix = glGetDoublev(GL_PROJECTION_MATRIX) def onCameraChanged(self): self.cameraChanged = True self.latchedObject = self.oldLatchedObject = None self.Refresh() def InitGL(self): self.InitFonts() glEnable(GL_DEPTH_TEST) glClearColor(*BACKGROUNDCOLOR) glClearDepth(1.0) self.setProjection() glMatrixMode(GL_MODELVIEW) glLoadIdentity() self.camera.applyTransformation() def InitFonts(self): log.info('Initializing fonts information') # TODO - gui to change settings # TODO - specular lighting effects and simulate window pane # TODO - make gears, pipes, etc # TODO - implement selecting objects # TODO - add capability for stereo view # TODO - add capability for dynamic objects based on distance # TODO - overlay items def main(): app = wx.App() frame3D = wx.Frame(None, -1, "Canvas 3D", wx.Point(1100, 50), wx.Size(800,400)) canvas = Canvas3D(frame3D, WX_GL_RGBA, WX_GL_DOUBLEBUFFER) frame3D.Show() app.MainLoop() print "Exiting main loop\n" timestat.printStats() if __name__ == '__main__': main()
Python
from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from math import sin, cos, pi, exp, floor, sqrt, atan2 from logger import log from timestat import timestat from vector import dotp, scalarp, vsum, vdiff, mag, magsq,\ rotx, roty, rotz from time import time moveScale = 5 class Dummy(object): pass def changesCamera(func): """ Decorator which calls onCameraChanged after calling the decorated function """ def wrapper(*args, **kw): func(*args, **kw) args[0].onCameraChanged() # args[0] is self = Camera object return wrapper class Camera(object): def __init__(self, parent, state=(0,0,0,0,0)): self.canvas = parent s = self s.x, s.y, s.z, s.t, s.p = state s.dt, s.dp, s.dx, s.dy, s.dz = 0, 0, 0, 0, 0 # scaling factors for camera moves self.d = 1 self.rotFactor = 1.0/150.0 self.MVMatrix = None self.PMatrix = None self.initVariables() self.subscriptions = [] def initVariables(self): self.frontVector = lambda s=self: (-sin(s.p + s.dp)*cos(s.t + s.dt), sin(s.t + s.dt), -cos(s.p + s.dp)*cos(s.t + s.dt)) self.leftVector = lambda s=self: (-cos(s.p + s.dp), 0, sin(s.p + s.dp)) self.upVector = lambda s=self: (sin(s.p + s.dp)*sin(s.t + s.dt), cos(s.t + s.dt), cos(s.p + s.dp)*sin(s.t + s.dt)) self.lastZoomOutTime = self.lastZoomInTime = time() self.oldDT = None def subscribe(self, callback): if not (callback in self.subscriptions): self.subscriptions.append(callback) def onCameraChanged(self): self.runSubscribedCallbacks() def runSubscribedCallbacks(self): for callback in self.subscriptions: callback() def applyRotations(self): # Applies camera rotations to current ModelView Matrix f = self.frontVector() u = self.upVector() l = self.leftVector() fl = mag(f) ul = mag(u) ll = mag(l) glMatrixMode(GL_MODELVIEW) glRotatef(-(self.t + self.dt)*180/pi, 1, 0, 0) glRotatef(-(self.p + self.dp)*180/pi, 0, 1, 0) def applyTransformation(self): # Applies camera transformation, but destroys # old MV matrix log.debug('Camera state: %4.2f %4.2f %4.2f, %4.2f %4.2f'%( self.x + self.dx, self.y + self.dy, self.z + self.dz, self.t + self.dt, self.p + self.dp)) f = self.frontVector() u = self.upVector() l = self.leftVector() fl = mag(f) ul = mag(u) ll = mag(l) #log.debug('Camera front %s, %s'%(str(fl), str(f))) #log.debug('Camera up %s, %s'%(str(ul), str(u))) #log.debug('Camera left %s, %s'%(str(ll), str(l))) glMatrixMode(GL_MODELVIEW) #glLoadIdentity() glRotatef(-(self.t + self.dt)*180/pi, 1, 0, 0) glRotatef(-(self.p + self.dp)*180/pi, 0, 1, 0) glTranslatef(-(self.x + self.dx), -(self.y + self.dy), -(self.z + self.dz)) self.MVMatrix = glGetDoublev(GL_MODELVIEW_MATRIX) @timestat @changesCamera def orbit(self, dx, dy, center): # orbits around a given center point if not center: center = 50*self.frontVector() c = center s = self dp = self.rotFactor*dx dt = -self.rotFactor*dy cc = (s.x, s.y, s.z) # first do the pan around xz plane at the camera's y coordinate relc = vdiff(cc, c) rxz = mag((relc[0], 0, relc[2])) r = mag(relc) phi = atan2(relc[2], relc[0]) th = phi + dp nc = (rxz*cos(th), relc[1], rxz*sin(th)) s.dx, s.dy, s.dz = vdiff(nc, relc) s.dp = -dp # now do the tilt in the front / up plane of the camera # - find camera position relative to center of rotation for tilt f = self.frontVector() u = self.upVector() l = self.leftVector() relc = ((s.x + s.dx) - c[0], (s.y + s.dy) - c[1], (s.z + s.dz) - c[2]) camP = vsum(scalarp(dotp(f, relc), f), scalarp( dotp(u, relc), u)) # pan back the vector to bring it in yz plane tempv1 = roty(camP, -(s.p + s.dp)) # rotate tempv1 wrt x axis by dt angle tempv2 = rotx(tempv1, dt) # pan it again tempv3 = roty(tempv2, (s.p + s.dp)) dc = vdiff(tempv3, camP) # check if tilt is within bounds and y > 0 if (-pi/2 <= (s.t + dt) <= pi/2) and (s.y + dc[1] > 0): s.dx += dc[0] s.dy += dc[1] s.dz += dc[2] s.dt = dt # save the last good value of tilt that worked self.oldDT = dt else: # use the last good value of tilt in the else block # rotate tempv1 wrt x axis by dt angle if self.oldDT: tempv2 = rotx(tempv1, self.oldDT) # pan it again tempv3 = roty(tempv2, (s.p + s.dp)) dc = vdiff(tempv3, camP) s.dx += dc[0] s.dy += dc[1] s.dz += dc[2] s.dt = self.oldDT @changesCamera def zoomIn(self, center): ct = time() s = self cc = (s.x, s.y, s.z) if not center: dv = scalarp(100, self.frontVector()) else: dv = vdiff(center, cc) d = pow((mag(dv)), 0.25) escale = lambda x: 0.02*exp(-x) + 0.00001 speed = d*escale(ct - self.lastZoomInTime) + 0.1 offset = scalarp(speed, dv) s.x, s.y, s.z = vsum(cc, offset) if s.y < 0: s.y = 0 self.lastZoomInTime = ct @changesCamera def zoomOut(self, center): ct = time() s = self cc = (s.x, s.y, s.z) if not center: dv = scalarp(100, self.frontVector()) else: dv = vdiff(center, cc) d = pow((mag(dv)), 0.25) #d = (2*sqrt(d) - 1) if d > 1 else d escale = lambda x: 0.02*exp(-x) + 0.00001 speed = d*escale(ct - self.lastZoomOutTime) + 0.1 offset = scalarp(-speed, dv) s.x, s.y, s.z = vsum(cc, offset) if s.y < 0: s.y = 0 self.lastZoomOutTime = ct @changesCamera def strafe(self, x, y, d, center, MVMat): s = self pos = gluUnProject(x, y, d, MVMat, self.PMatrix) diff = vdiff(center, pos) log.debug('x,y,d = %09.6f, %09.6f, %09.6f'%(x,y,d)) log.debug('pos = %09.6f, %09.6f, %09.6f'%(pos)) log.debug('diff = %09.6f, %09.6f, %09.6f'%(diff)) s.dx, s.dy, s.dz = diff if (s.y + s.dy) < 0: s.dy = -s.y @changesCamera def moveForward(self, d=moveScale): vx, vy, vz = self.frontVector() log.debug('v Vector = %4.2f, %4.2f, %4.2f,'%(vx, vy, vz)) self.x += vx*d*self.d self.y += vy*d*self.d self.z += vz*d*self.d if self.y < 0: self.y = 0 @changesCamera def moveBackward(self, d=moveScale): vx, vy, vz = self.frontVector() log.debug('v Vector = %4.2f, %4.2f, %4.2f,'%(vx, vy, vz)) self.x -= vx*d*self.d self.y -= vy*d*self.d self.z -= vz*d*self.d if self.y < 0: self.y = 0 @changesCamera def moveLeft(self, d=moveScale): vx, vy, vz = self.leftVector() log.debug('v Vector = %4.2f, %4.2f, %4.2f,'%(vx, vy, vz)) self.x += vx*d*self.d self.y += vy*d*self.d self.z += vz*d*self.d @changesCamera def moveRight(self, d=moveScale): vx, vy, vz = self.leftVector() log.debug('v Vector = %4.2f, %4.2f, %4.2f,'%(vx, vy, vz)) self.x -= vx*d*self.d self.y -= vy*d*self.d self.z -= vz*d*self.d @changesCamera def moveUp(self, d=moveScale): vx, vy, vz = self.upVector() log.debug('v Vector = %4.2f, %4.2f, %4.2f,'%(vx, vy, vz)) self.x += vx*d*self.d self.y += vy*d*self.d self.z += vz*d*self.d if self.y < 0: self.y = 0 @changesCamera def moveDown(self, d=moveScale): vx, vy, vz = self.upVector() log.debug('v Vector = %4.2f, %4.2f, %4.2f,'%(vx, vy, vz)) self.x -= vx*d*self.d self.y -= vy*d*self.d self.z -= vz*d*self.d if self.y < 0: self.y = 0 @changesCamera def rotate(self, dx, dy): if -pi/2 <= (self.t - self.rotFactor*dy) <= pi/2: self.dt = -self.rotFactor*dy self.dp = -self.rotFactor*dx log.debug('Rotation: %4.2f %4.2f'%(self.dp, self.dt)) def leftDragEnd(self): self.t += self.dt self.p += self.dp self.p = self.p - floor(self.p/2/pi)*2*pi self.dt = 0 self.dp = 0 def middleDragEnd(self): self.t += self.dt self.p += self.dp self.p = self.p - floor(self.p/2/pi)*2*pi self.x += self.dx self.y += self.dy self.z += self.dz self.dt = 0 self.dp = 0 self.dx = 0 self.dy = 0 self.dz = 0 def rightDragEnd(self): self.x += self.dx self.y += self.dy self.z += self.dz self.dx = 0 self.dy = 0 self.dz = 0 def incMoveDistance(self): self.d *= 1.1 def decMoveDistance(self): self.d /= 1.1 @changesCamera def resetState(self, state): s = self s.x, s.y, s.z, s.t, s.p = state s.dx, s.dy, s.dz, s.dt, s.dp = (0,0,0,0,0) def getState(self): s = self return (s.x + s.dx, s.y + s.dy, s.z + s.dz, s.t + s.dt, s.p + s.dp)
Python
from gobjects import GObject from fonts import regularFont class Text(GObject): def __init__(self, x=0, y=0, z=0, text='', **kw): GObject.__init__(self, x, y, z, **kw) self.text = text def render(self): glPushMatrix() glTranslatef(*self.translation) glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, COLOR_WHITE) glColor4fv(self.color) self._render() glPopMatrix() def _render(self): regularFont.render(self.text)
Python
from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from colors import COLOR_BLACK, COLOR_GREY, COLOR_WHITE, GEN_GREY from objectregistry import objectRegistry from logger import log from math import sqrt, pi from vector import mag, findTPAngles, crossp, vdiff class Translation(object): def __init__(self, x, y, z): self.translation = (x, y, z) def apply(self): glTranslatef(*self.translation) class Rotation(object): def __init__(self, angle, x, y, z): self.rotation = (angle, x, y, z) def apply(self): glRotatef(*self.rotation) class Scaling(object): def __init__(self, x, y, z): self.scaling = (x, y, z) def apply(self): glScalef(*self.scaling) class GObject(object): def __init__(self, parent, x=0, y=0, z=0, color=COLOR_BLACK, tooltip='', selectable=True, anonymous=False, oid=None): self.oid = oid if oid else objectRegistry.register(self) self.tooltip = tooltip self.matcolor = color self.pickColor = ((self.oid >> 16)&255, (self.oid >> 8)&255, (self.oid)&255) self.selectable = selectable self.transforms = [] self.transforms.append(Translation(x, y, z)) self.parent = parent self.children = [] def move(self, x, y, z): log.debug('called move on %s'%self.tooltip) return self def moveTo(self, x, y, z): log.debug('called moveTo on %s'%self.tooltip) def translate(self, x, y, z): self.transforms.append(Translation(x, y, z)) return self def rotate(self, angle, x, y, z): self.transforms.append(Rotation(angle, x, y, z)) return self def scale(self, x, y, z): self.transforms.append(Scaling(x, y, z)) return self def color(self, r, g, b, a): self.matcolor = (r, g, b, a) return self def undoTransform(self): self.transforms = self.transforms[:-1] return self def addChild(self, ch): assert isinstance(ch, GObject) self.children.append(ch) return self def deleteChild(self, ch): self.children.remove(ch) return self def prerender(self): glPushMatrix() for t in self.transforms: t.apply() def render(self): self.prerender() for ch in self.children: ch.render() glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, self.matcolor) self._render() self.postrender() pass def renderPicking(self): self.prerender() for ch in self.children: ch.renderPicking() glColor3ubv(self.pickColor) self._render() self.postrender() pass def highlightRender(self): self.prerender() for ch in self.children: ch.highlightRender() self._render() self.postrender() def postrender(self): glPopMatrix() pass def _render(self): pass class Sphere(GObject): def __init__(self, parent, x=0, y=0, z=0, radius=1, lats=17, longs=17, **kw): super(Sphere, self).__init__(parent, x, y, z, **kw) self.radius = radius self.lats = lats self.longs = longs def _render(self): glutSolidSphere(self.radius, self.lats, self.longs) class Cylinder(GObject): def __init__(self, parent, x1=0, y1=0, z1=0, x2=0, y2=0, z2=0, radius=1, lats=17, longs=1, **kw): super(Cylinder, self).__init__(parent, x1, y1, z1, **kw) v = (x2 - x1, y2-y1, z2-z1) self.t, self.p = findTPAngles(v) self.length = mag(v) self.radius = radius self.lats = lats self.longs = longs def _render(self): glRotate(self.p*180/pi, 0, 1, 0) glRotate(self.t*180/pi, 1, 0, 0) glutSolidCylinder(self.radius, self.length, self.lats, self.longs) class Cone(GObject): def __init__(self, parent, x=0, y=0, z=0, radius=1, height=2, lats=17, longs=1, **kw): super(Cone, self).__init__(parent, x, y, z, **kw) self.radius = radius self.height = height self.lats = lats self.longs = longs def _render(self): glutSolidCone(self.radius, self.height, self.lats, self.longs) class Ground(GObject): def __init__(self, parent, x=0, y=-0.01, z=0, l=1000, w=1000, color=COLOR_WHITE, **kw): GObject.__init__(self, parent, x, y, z, color=color, **kw) self.l, self.w = l, w def render(self): self.prerender() for ch in self.children: ch.render() glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, self.matcolor) glColor4fv(self.matcolor) self._render() self.postrender() pass def _render(self): l = self.l/2 w = self.w/2 glBegin(GL_TRIANGLE_FAN) glVertex3f(0, 0, 0) glVertex3f(l, 0, w) glVertex3f(-l, 0, w) glVertex3f(-l, 0, -w) glVertex3f(l, 0, -w) glVertex3f(l, 0, w) glEnd() class BackWall(GObject): def __init__(self, parent, x=0, y=0, z=-1000, l=10000, w=10000, **kw): GObject.__init__(self, parent, x, y, z, **kw) self.l, self.w = l, w # no render method for the backwall #def render(self): #glPushMatrix() #glTranslatef(*self.translation) #glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, COLOR_WHITE) #glColor4fv(self.color) #self._render() #glPopMatrix() def renderPicking(self): glPushMatrix() glTranslatef(*self.translation) glColor3ubv(self.pickColor) self._render() glPopMatrix() def _render(self): l = self.l/2 w = self.w/2 glBegin(GL_TRIANGLE_FAN) glVertex3f( 0, 0, 0) glVertex3f( l, w, 0) glVertex3f( l, -w, 0) glVertex3f(-l, -w, 0) glVertex3f(-l, w, 0) glVertex3f( l, w, 0) glEnd() class Scene(object): def __init__(self, canvas): self.children = [] self.canvas = canvas def addChild(self, ch): assert isinstance(ch, GObject) self.children.append(ch) return self def removeChild(self, ch): self.children.remove(ch) return self def render(self): # draw children for child in self.children: child.render() def renderPicking(self): for child in self.children: child.renderPicking() def update(self): pass class OverlayScene(object): def __init__(self, canvas): self.children = [] self.canvas = canvas def addChild(self, ch): assert isinstance(ch, GObject) self.children.append(ch) return self def removeChild(self, ch): self.children.remove(ch) return ch def render(self): # draw children for child in self.children: child.render() def renderPicking(self): for child in self.children: child.renderPicking() def update(self): pass class Arrow(GObject): def __init__(self, parent, x=0, y=0, z=0, rs=0.2, ls=5, rc=1, hc=2, color=COLOR_WHITE, **kw): GObject.__init__(self, parent, x, y, z, color=color, **kw) alpha = color[3] stemCol = (0.4, 0.4, 0.4, alpha) cylx = Cylinder(self, 0, 0, 0, ls, 0, 0, radius=rs, oid=self.oid).color(*stemCol) conex = Cone(self, 0, 0, 0, rc, hc, oid=self.oid).rotate(90, 0, 1, 0).translate(0, 0, ls).color(1, 0, 0, alpha) cyly = Cylinder(self, 0, 0, 0, 0, ls, 0, radius=rs, oid=self.oid).color(*stemCol) coney = Cone(self, 0, 0, 0, rc, hc, oid=self.oid).rotate(270, 1, 0, 0).translate(0, 0, ls).color(0, 1, 0, alpha) cylz = Cylinder(self, 0, 0, 0, 0, 0, ls, radius=rs, oid=self.oid).color(*stemCol) conez = Cone(self, 0, 0, 0, rc, hc, oid=self.oid).translate(0, 0, ls).color(0, 0, 1, alpha) self.addChild(cylx).addChild(cyly).addChild(cylz) self.addChild(conex).addChild(coney).addChild(conez) class SimpleGear(GObject): def __init__(self, parent, x=0, y=0, z=0, rad1=1, rad2=2, rad3=5, rad4=6, rad5=8, width1=1, width2=2, nTeeth=20, **kw): super(SimpleGear, self).__init__(parent, x, y, z, **kw) self.radii = (rad1, rad2, rad3, rad4, rad5) self.widths = (width1, width2) self.nTeeth = nTeeth def _render(self): pass class Tetrahedron(GObject): def __init__(self, parent, x=0, y=0, z=0, **kw): super(Tetrahedron, self).__init__(parent, x, y, z, **kw) self.vertexColor = (0.8, 0.8, 0.8, 1) self.faceColor = ( 1, 0, 0, 1) self.vertexRadius = 0.025 edgeRadius = 0.01 edgeColor = (0.9, 0.9, 0.9, 1) p1 = (-0.5, -1.0/sqrt(3)/sqrt(8), -1.0/2/sqrt(3)) p2 = (0, -1.0/sqrt(3)/sqrt(8), 1.0/sqrt(3)) p3 = (0, sqrt(3)/sqrt(8), 0) p4 = (0.5, -1.0/sqrt(3)/sqrt(8), -1.0/2/sqrt(3)) p = self.points = (p1, p2, p3, p4) edges = ((0,1), (0,2), (0,3), (1,2), (1,3), (2,3)) for e in edges: self.addChild(Cylinder(self, p[e[0]][0], p[e[0]][1], p[e[0]][2], p[e[1]][0], p[e[1]][1], p[e[1]][2], edgeRadius, color=edgeColor, oid=self.oid)) faces = ((0,1,2), (2,1,3), (2,3,0), (0,3,1), ) self.faces = tuple([tuple([p[i] for i in f]) for f in faces]) def _render(self): glMatrixMode(GL_MODELVIEW) glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, self.faceColor) glBegin(GL_TRIANGLES) for f in self.faces: glNormal(*crossp(vdiff(f[1], f[0]), vdiff(f[2], f[1]))) glVertex(*f[0]) glVertex(*f[1]) glVertex(*f[2]) glEnd() p = self.points glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, self.vertexColor) for i in range(4): glPushMatrix() glTranslate(*p[i]) glutSolidSphere(self.vertexRadius, 20, 20) glPopMatrix()
Python
# # Program to find new coordinates when the angle of a point is compressed # to half original value in the negative z direction # import math def compressAngle(x,y,z): r = math.sqrt(x*x + y*y + z*z) zn = - math.sqrt(0.5*(r*(r - z) )) xn = r*(math.sqrt((1+math.sqrt(1 - x*x/(r*r)))/2)) yn = r*(math.sqrt((1+math.sqrt(1 - y*y/(r*r)))/2)) return xn, yn, zn print compressAngle(0, 1, 1)
Python
# Utils (c) 2002, 2004, 2007, 2008 David Turner <david@freetype.org> # import string, sys, os, glob # current output directory # output_dir = None # This function is used to sort the index. It is a simple lexicographical # sort, except that it places capital letters before lowercase ones. # def index_sort( s1, s2 ): if not s1: return -1 if not s2: return 1 l1 = len( s1 ) l2 = len( s2 ) m1 = string.lower( s1 ) m2 = string.lower( s2 ) for i in range( l1 ): if i >= l2 or m1[i] > m2[i]: return 1 if m1[i] < m2[i]: return -1 if s1[i] < s2[i]: return -1 if s1[i] > s2[i]: return 1 if l2 > l1: return -1 return 0 # Sort input_list, placing the elements of order_list in front. # def sort_order_list( input_list, order_list ): new_list = order_list[:] for id in input_list: if not id in order_list: new_list.append( id ) return new_list # Open the standard output to a given project documentation file. Use # "output_dir" to determine the filename location if necessary and save the # old stdout in a tuple that is returned by this function. # def open_output( filename ): global output_dir if output_dir and output_dir != "": filename = output_dir + os.sep + filename old_stdout = sys.stdout new_file = open( filename, "w" ) sys.stdout = new_file return ( new_file, old_stdout ) # Close the output that was returned by "close_output". # def close_output( output ): output[0].close() sys.stdout = output[1] # Check output directory. # def check_output(): global output_dir if output_dir: if output_dir != "": if not os.path.isdir( output_dir ): sys.stderr.write( "argument" + " '" + output_dir + "' " + \ "is not a valid directory" ) sys.exit( 2 ) else: output_dir = None def file_exists( pathname ): """checks that a given file exists""" result = 1 try: file = open( pathname, "r" ) file.close() except: result = None sys.stderr.write( pathname + " couldn't be accessed\n" ) return result def make_file_list( args = None ): """builds a list of input files from command-line arguments""" file_list = [] # sys.stderr.write( repr( sys.argv[1 :] ) + '\n' ) if not args: args = sys.argv[1 :] for pathname in args: if string.find( pathname, '*' ) >= 0: newpath = glob.glob( pathname ) newpath.sort() # sort files -- this is important because # of the order of files else: newpath = [pathname] file_list.extend( newpath ) if len( file_list ) == 0: file_list = None else: # now filter the file list to remove non-existing ones file_list = filter( file_exists, file_list ) return file_list # eof
Python
# ToHTML (c) 2002, 2003, 2005, 2006, 2007, 2008 # David Turner <david@freetype.org> from sources import * from content import * from formatter import * import time # The following defines the HTML header used by all generated pages. html_header_1 = """\ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>\ """ html_header_2 = """\ API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; background: #FFFFFF; } p { text-align: justify; } h1 { text-align: center; } li { text-align: justify; } td { padding: 0 0.5em 0 0.5em; } td.left { padding: 0 0.5em 0 0.5em; text-align: left; } a:link { color: #0000EF; } a:visited { color: #51188E; } a:hover { color: #FF0000; } span.keyword { font-family: monospace; text-align: left; white-space: pre; color: darkblue; } pre.colored { color: blue; } ul.empty { list-style-type: none; } </style> </head> <body> """ html_header_3 = """ <table align=center><tr><td><font size=-1>[<a href="\ """ html_header_3i = """ <table align=center><tr><td width="100%"></td> <td><font size=-1>[<a href="\ """ html_header_4 = """\ ">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="\ """ html_header_5 = """\ ">TOC</a>]</font></td></tr></table> <center><h1>\ """ html_header_5t = """\ ">Index</a>]</font></td> <td width="100%"></td></tr></table> <center><h1>\ """ html_header_6 = """\ API Reference</h1></center> """ # The HTML footer used by all generated pages. html_footer = """\ </body> </html>\ """ # The header and footer used for each section. section_title_header = "<center><h1>" section_title_footer = "</h1></center>" # The header and footer used for code segments. code_header = '<pre class="colored">' code_footer = '</pre>' # Paragraph header and footer. para_header = "<p>" para_footer = "</p>" # Block header and footer. block_header = '<table align=center width="75%"><tr><td>' block_footer_start = """\ </td></tr></table> <hr width="75%"> <table align=center width="75%"><tr><td><font size=-2>[<a href="\ """ block_footer_middle = """\ ">Index</a>]</font></td> <td width="100%"></td> <td><font size=-2>[<a href="\ """ block_footer_end = """\ ">TOC</a>]</font></td></tr></table> """ # Description header/footer. description_header = '<table align=center width="87%"><tr><td>' description_footer = "</td></tr></table><br>" # Marker header/inter/footer combination. marker_header = '<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>' marker_inter = "</b></em></td></tr><tr><td>" marker_footer = "</td></tr></table>" # Header location header/footer. header_location_header = '<table align=center width="87%"><tr><td>' header_location_footer = "</td></tr></table><br>" # Source code extracts header/footer. source_header = '<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>\n' source_footer = "\n</pre></table><br>" # Chapter header/inter/footer. chapter_header = '<br><table align=center width="75%"><tr><td><h2>' chapter_inter = '</h2><ul class="empty"><li>' chapter_footer = '</li></ul></td></tr></table>' # Index footer. index_footer_start = """\ <hr> <table><tr><td width="100%"></td> <td><font size=-2>[<a href="\ """ index_footer_end = """\ ">TOC</a>]</font></td></tr></table> """ # TOC footer. toc_footer_start = """\ <hr> <table><tr><td><font size=-2>[<a href="\ """ toc_footer_end = """\ ">Index</a>]</font></td> <td width="100%"></td> </tr></table> """ # source language keyword coloration/styling keyword_prefix = '<span class="keyword">' keyword_suffix = '</span>' section_synopsis_header = '<h2>Synopsis</h2>' section_synopsis_footer = '' # Translate a single line of source to HTML. This will convert # a "<" into "&lt.", ">" into "&gt.", etc. def html_quote( line ): result = string.replace( line, "&", "&amp;" ) result = string.replace( result, "<", "&lt;" ) result = string.replace( result, ">", "&gt;" ) return result # same as 'html_quote', but ignores left and right brackets def html_quote0( line ): return string.replace( line, "&", "&amp;" ) def dump_html_code( lines, prefix = "" ): # clean the last empty lines l = len( self.lines ) while l > 0 and string.strip( self.lines[l - 1] ) == "": l = l - 1 # The code footer should be directly appended to the last code # line to avoid an additional blank line. print prefix + code_header, for line in self.lines[0 : l + 1]: print '\n' + prefix + html_quote( line ), print prefix + code_footer, class HtmlFormatter( Formatter ): def __init__( self, processor, project_title, file_prefix ): Formatter.__init__( self, processor ) global html_header_1, html_header_2, html_header_3 global html_header_4, html_header_5, html_footer if file_prefix: file_prefix = file_prefix + "-" else: file_prefix = "" self.headers = processor.headers self.project_title = project_title self.file_prefix = file_prefix self.html_header = html_header_1 + project_title + \ html_header_2 + \ html_header_3 + file_prefix + "index.html" + \ html_header_4 + file_prefix + "toc.html" + \ html_header_5 + project_title + \ html_header_6 self.html_index_header = html_header_1 + project_title + \ html_header_2 + \ html_header_3i + file_prefix + "toc.html" + \ html_header_5 + project_title + \ html_header_6 self.html_toc_header = html_header_1 + project_title + \ html_header_2 + \ html_header_3 + file_prefix + "index.html" + \ html_header_5t + project_title + \ html_header_6 self.html_footer = "<center><font size=""-2"">generated on " + \ time.asctime( time.localtime( time.time() ) ) + \ "</font></center>" + html_footer self.columns = 3 def make_section_url( self, section ): return self.file_prefix + section.name + ".html" def make_block_url( self, block ): return self.make_section_url( block.section ) + "#" + block.name def make_html_words( self, words ): """ convert a series of simple words into some HTML text """ line = "" if words: line = html_quote( words[0] ) for w in words[1:]: line = line + " " + html_quote( w ) return line def make_html_word( self, word ): """analyze a simple word to detect cross-references and styling""" # look for cross-references m = re_crossref.match( word ) if m: try: name = m.group( 1 ) rest = m.group( 2 ) block = self.identifiers[name] url = self.make_block_url( block ) return '<a href="' + url + '">' + name + '</a>' + rest except: # we detected a cross-reference to an unknown item sys.stderr.write( \ "WARNING: undefined cross reference '" + name + "'.\n" ) return '?' + name + '?' + rest # look for italics and bolds m = re_italic.match( word ) if m: name = m.group( 1 ) rest = m.group( 3 ) return '<i>' + name + '</i>' + rest m = re_bold.match( word ) if m: name = m.group( 1 ) rest = m.group( 3 ) return '<b>' + name + '</b>' + rest return html_quote( word ) def make_html_para( self, words ): """ convert words of a paragraph into tagged HTML text, handle xrefs """ line = "" if words: line = self.make_html_word( words[0] ) for word in words[1:]: line = line + " " + self.make_html_word( word ) # convert `...' quotations into real left and right single quotes line = re.sub( r"(^|\W)`(.*?)'(\W|$)", \ r'\1&lsquo;\2&rsquo;\3', \ line ) # convert tilde into non-breakable space line = string.replace( line, "~", "&nbsp;" ) return para_header + line + para_footer def make_html_code( self, lines ): """ convert a code sequence to HTML """ line = code_header + '\n' for l in lines: line = line + html_quote( l ) + '\n' return line + code_footer def make_html_items( self, items ): """ convert a field's content into some valid HTML """ lines = [] for item in items: if item.lines: lines.append( self.make_html_code( item.lines ) ) else: lines.append( self.make_html_para( item.words ) ) return string.join( lines, '\n' ) def print_html_items( self, items ): print self.make_html_items( items ) def print_html_field( self, field ): if field.name: print "<table><tr valign=top><td><b>" + field.name + "</b></td><td>" print self.make_html_items( field.items ) if field.name: print "</td></tr></table>" def html_source_quote( self, line, block_name = None ): result = "" while line: m = re_source_crossref.match( line ) if m: name = m.group( 2 ) prefix = html_quote( m.group( 1 ) ) length = len( m.group( 0 ) ) if name == block_name: # this is the current block name, if any result = result + prefix + '<b>' + name + '</b>' elif re_source_keywords.match( name ): # this is a C keyword result = result + prefix + keyword_prefix + name + keyword_suffix elif self.identifiers.has_key( name ): # this is a known identifier block = self.identifiers[name] result = result + prefix + '<a href="' + \ self.make_block_url( block ) + '">' + name + '</a>' else: result = result + html_quote( line[:length] ) line = line[length:] else: result = result + html_quote( line ) line = [] return result def print_html_field_list( self, fields ): print "<p></p>" print "<table cellpadding=3 border=0>" for field in fields: if len( field.name ) > 22: print "<tr valign=top><td colspan=0><b>" + field.name + "</b></td></tr>" print "<tr valign=top><td></td><td>" else: print "<tr valign=top><td><b>" + field.name + "</b></td><td>" self.print_html_items( field.items ) print "</td></tr>" print "</table>" def print_html_markup( self, markup ): table_fields = [] for field in markup.fields: if field.name: # we begin a new series of field or value definitions, we # will record them in the 'table_fields' list before outputting # all of them as a single table # table_fields.append( field ) else: if table_fields: self.print_html_field_list( table_fields ) table_fields = [] self.print_html_items( field.items ) if table_fields: self.print_html_field_list( table_fields ) # # Formatting the index # def index_enter( self ): print self.html_index_header self.index_items = {} def index_name_enter( self, name ): block = self.identifiers[name] url = self.make_block_url( block ) self.index_items[name] = url def index_exit( self ): # block_index already contains the sorted list of index names count = len( self.block_index ) rows = ( count + self.columns - 1 ) / self.columns print "<table align=center border=0 cellpadding=0 cellspacing=0>" for r in range( rows ): line = "<tr>" for c in range( self.columns ): i = r + c * rows if i < count: bname = self.block_index[r + c * rows] url = self.index_items[bname] line = line + '<td><a href="' + url + '">' + bname + '</a></td>' else: line = line + '<td></td>' line = line + "</tr>" print line print "</table>" print index_footer_start + \ self.file_prefix + "toc.html" + \ index_footer_end print self.html_footer self.index_items = {} def index_dump( self, index_filename = None ): if index_filename == None: index_filename = self.file_prefix + "index.html" Formatter.index_dump( self, index_filename ) # # Formatting the table of content # def toc_enter( self ): print self.html_toc_header print "<center><h1>Table of Contents</h1></center>" def toc_chapter_enter( self, chapter ): print chapter_header + string.join( chapter.title ) + chapter_inter print "<table cellpadding=5>" def toc_section_enter( self, section ): print '<tr valign=top><td class="left">' print '<a href="' + self.make_section_url( section ) + '">' + \ section.title + '</a></td><td>' print self.make_html_para( section.abstract ) def toc_section_exit( self, section ): print "</td></tr>" def toc_chapter_exit( self, chapter ): print "</table>" print chapter_footer def toc_index( self, index_filename ): print chapter_header + \ '<a href="' + index_filename + '">Global Index</a>' + \ chapter_inter + chapter_footer def toc_exit( self ): print toc_footer_start + \ self.file_prefix + "index.html" + \ toc_footer_end print self.html_footer def toc_dump( self, toc_filename = None, index_filename = None ): if toc_filename == None: toc_filename = self.file_prefix + "toc.html" if index_filename == None: index_filename = self.file_prefix + "index.html" Formatter.toc_dump( self, toc_filename, index_filename ) # # Formatting sections # def section_enter( self, section ): print self.html_header print section_title_header print section.title print section_title_footer maxwidth = 0 for b in section.blocks.values(): if len( b.name ) > maxwidth: maxwidth = len( b.name ) width = 70 # XXX magic number if maxwidth <> 0: # print section synopsis print section_synopsis_header print "<table align=center cellspacing=5 cellpadding=0 border=0>" columns = width / maxwidth if columns < 1: columns = 1 count = len( section.block_names ) rows = ( count + columns - 1 ) / columns for r in range( rows ): line = "<tr>" for c in range( columns ): i = r + c * rows line = line + '<td></td><td>' if i < count: name = section.block_names[i] line = line + '<a href="#' + name + '">' + name + '</a>' line = line + '</td>' line = line + "</tr>" print line print "</table><br><br>" print section_synopsis_footer print description_header print self.make_html_items( section.description ) print description_footer def block_enter( self, block ): print block_header # place html anchor if needed if block.name: print '<h4><a name="' + block.name + '">' + block.name + '</a></h4>' # dump the block C source lines now if block.code: header = '' for f in self.headers.keys(): if block.source.filename.find( f ) >= 0: header = self.headers[f] + ' (' + f + ')' break; # if not header: # sys.stderr.write( \ # 'WARNING: No header macro for ' + block.source.filename + '.\n' ) if header: print header_location_header print 'Defined in ' + header + '.' print header_location_footer print source_header for l in block.code: print self.html_source_quote( l, block.name ) print source_footer def markup_enter( self, markup, block ): if markup.tag == "description": print description_header else: print marker_header + markup.tag + marker_inter self.print_html_markup( markup ) def markup_exit( self, markup, block ): if markup.tag == "description": print description_footer else: print marker_footer def block_exit( self, block ): print block_footer_start + self.file_prefix + "index.html" + \ block_footer_middle + self.file_prefix + "toc.html" + \ block_footer_end def section_exit( self, section ): print html_footer def section_dump_all( self ): for section in self.sections: self.section_dump( section, self.file_prefix + section.name + '.html' ) # eof
Python
#!/usr/bin/env python # # DocBeauty (c) 2003, 2004, 2008 David Turner <david@freetype.org> # # This program is used to beautify the documentation comments used # in the FreeType 2 public headers. # from sources import * from content import * from utils import * import utils import sys, os, time, string, getopt content_processor = ContentProcessor() def beautify_block( block ): if block.content: content_processor.reset() markups = content_processor.process_content( block.content ) text = [] first = 1 for markup in markups: text.extend( markup.beautify( first ) ) first = 0 # now beautify the documentation "borders" themselves lines = [" /*************************************************************************"] for l in text: lines.append( " *" + l ) lines.append( " */" ) block.lines = lines def usage(): print "\nDocBeauty 0.1 Usage information\n" print " docbeauty [options] file1 [file2 ...]\n" print "using the following options:\n" print " -h : print this page" print " -b : backup original files with the 'orig' extension" print "" print " --backup : same as -b" def main( argv ): """main program loop""" global output_dir try: opts, args = getopt.getopt( sys.argv[1:], \ "hb", \ ["help", "backup"] ) except getopt.GetoptError: usage() sys.exit( 2 ) if args == []: usage() sys.exit( 1 ) # process options # output_dir = None do_backup = None for opt in opts: if opt[0] in ( "-h", "--help" ): usage() sys.exit( 0 ) if opt[0] in ( "-b", "--backup" ): do_backup = 1 # create context and processor source_processor = SourceProcessor() # retrieve the list of files to process file_list = make_file_list( args ) for filename in file_list: source_processor.parse_file( filename ) for block in source_processor.blocks: beautify_block( block ) new_name = filename + ".new" ok = None try: file = open( new_name, "wt" ) for block in source_processor.blocks: for line in block.lines: file.write( line ) file.write( "\n" ) file.close() except: ok = 0 # if called from the command line # if __name__ == '__main__': main( sys.argv ) # eof
Python
#!/usr/bin/env python # # DocMaker (c) 2002, 2004, 2008 David Turner <david@freetype.org> # # This program is a re-write of the original DocMaker took used # to generate the API Reference of the FreeType font engine # by converting in-source comments into structured HTML. # # This new version is capable of outputting XML data, as well # as accepts more liberal formatting options. # # It also uses regular expression matching and substitution # to speed things significantly. # from sources import * from content import * from utils import * from formatter import * from tohtml import * import utils import sys, os, time, string, glob, getopt def usage(): print "\nDocMaker Usage information\n" print " docmaker [options] file1 [file2 ...]\n" print "using the following options:\n" print " -h : print this page" print " -t : set project title, as in '-t \"My Project\"'" print " -o : set output directory, as in '-o mydir'" print " -p : set documentation prefix, as in '-p ft2'" print "" print " --title : same as -t, as in '--title=\"My Project\"'" print " --output : same as -o, as in '--output=mydir'" print " --prefix : same as -p, as in '--prefix=ft2'" def main( argv ): """main program loop""" global output_dir try: opts, args = getopt.getopt( sys.argv[1:], \ "ht:o:p:", \ ["help", "title=", "output=", "prefix="] ) except getopt.GetoptError: usage() sys.exit( 2 ) if args == []: usage() sys.exit( 1 ) # process options # project_title = "Project" project_prefix = None output_dir = None for opt in opts: if opt[0] in ( "-h", "--help" ): usage() sys.exit( 0 ) if opt[0] in ( "-t", "--title" ): project_title = opt[1] if opt[0] in ( "-o", "--output" ): utils.output_dir = opt[1] if opt[0] in ( "-p", "--prefix" ): project_prefix = opt[1] check_output() # create context and processor source_processor = SourceProcessor() content_processor = ContentProcessor() # retrieve the list of files to process file_list = make_file_list( args ) for filename in file_list: source_processor.parse_file( filename ) content_processor.parse_sources( source_processor ) # process sections content_processor.finish() formatter = HtmlFormatter( content_processor, project_title, project_prefix ) formatter.toc_dump() formatter.index_dump() formatter.section_dump_all() # if called from the command line # if __name__ == '__main__': main( sys.argv ) # eof
Python
#!/usr/bin/env python # # DocMaker (c) 2002, 2004, 2008 David Turner <david@freetype.org> # # This program is a re-write of the original DocMaker took used # to generate the API Reference of the FreeType font engine # by converting in-source comments into structured HTML. # # This new version is capable of outputting XML data, as well # as accepts more liberal formatting options. # # It also uses regular expression matching and substitution # to speed things significantly. # from sources import * from content import * from utils import * from formatter import * from tohtml import * import utils import sys, os, time, string, glob, getopt def usage(): print "\nDocMaker Usage information\n" print " docmaker [options] file1 [file2 ...]\n" print "using the following options:\n" print " -h : print this page" print " -t : set project title, as in '-t \"My Project\"'" print " -o : set output directory, as in '-o mydir'" print " -p : set documentation prefix, as in '-p ft2'" print "" print " --title : same as -t, as in '--title=\"My Project\"'" print " --output : same as -o, as in '--output=mydir'" print " --prefix : same as -p, as in '--prefix=ft2'" def main( argv ): """main program loop""" global output_dir try: opts, args = getopt.getopt( sys.argv[1:], \ "ht:o:p:", \ ["help", "title=", "output=", "prefix="] ) except getopt.GetoptError: usage() sys.exit( 2 ) if args == []: usage() sys.exit( 1 ) # process options # project_title = "Project" project_prefix = None output_dir = None for opt in opts: if opt[0] in ( "-h", "--help" ): usage() sys.exit( 0 ) if opt[0] in ( "-t", "--title" ): project_title = opt[1] if opt[0] in ( "-o", "--output" ): utils.output_dir = opt[1] if opt[0] in ( "-p", "--prefix" ): project_prefix = opt[1] check_output() # create context and processor source_processor = SourceProcessor() content_processor = ContentProcessor() # retrieve the list of files to process file_list = make_file_list( args ) for filename in file_list: source_processor.parse_file( filename ) content_processor.parse_sources( source_processor ) # process sections content_processor.finish() formatter = HtmlFormatter( content_processor, project_title, project_prefix ) formatter.toc_dump() formatter.index_dump() formatter.section_dump_all() # if called from the command line # if __name__ == '__main__': main( sys.argv ) # eof
Python
# Sources (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009 # David Turner <david@freetype.org> # # # this file contains definitions of classes needed to decompose # C sources files into a series of multi-line "blocks". There are # two kinds of blocks: # # - normal blocks, which contain source code or ordinary comments # # - documentation blocks, which have restricted formatting, and # whose text always start with a documentation markup tag like # "<Function>", "<Type>", etc.. # # the routines used to process the content of documentation blocks # are not contained here, but in "content.py" # # the classes and methods found here only deal with text parsing # and basic documentation block extraction # import fileinput, re, sys, os, string ################################################################ ## ## BLOCK FORMAT PATTERN ## ## A simple class containing compiled regular expressions used ## to detect potential documentation format block comments within ## C source code ## ## note that the 'column' pattern must contain a group that will ## be used to "unbox" the content of documentation comment blocks ## class SourceBlockFormat: def __init__( self, id, start, column, end ): """create a block pattern, used to recognize special documentation blocks""" self.id = id self.start = re.compile( start, re.VERBOSE ) self.column = re.compile( column, re.VERBOSE ) self.end = re.compile( end, re.VERBOSE ) # # format 1 documentation comment blocks look like the following: # # /************************************/ # /* */ # /* */ # /* */ # /************************************/ # # we define a few regular expressions here to detect them # start = r''' \s* # any number of whitespace /\*{2,}/ # followed by '/' and at least two asterisks then '/' \s*$ # probably followed by whitespace ''' column = r''' \s* # any number of whitespace /\*{1} # followed by '/' and precisely one asterisk ([^*].*) # followed by anything (group 1) \*{1}/ # followed by one asterisk and a '/' \s*$ # probably followed by whitespace ''' re_source_block_format1 = SourceBlockFormat( 1, start, column, start ) # # format 2 documentation comment blocks look like the following: # # /************************************ (at least 2 asterisks) # * # * # * # * # **/ (1 or more asterisks at the end) # # we define a few regular expressions here to detect them # start = r''' \s* # any number of whitespace /\*{2,} # followed by '/' and at least two asterisks \s*$ # probably followed by whitespace ''' column = r''' \s* # any number of whitespace \*{1}(?!/) # followed by precisely one asterisk not followed by `/' (.*) # then anything (group1) ''' end = r''' \s* # any number of whitespace \*+/ # followed by at least one asterisk, then '/' ''' re_source_block_format2 = SourceBlockFormat( 2, start, column, end ) # # the list of supported documentation block formats, we could add new ones # relatively easily # re_source_block_formats = [re_source_block_format1, re_source_block_format2] # # the following regular expressions corresponds to markup tags # within the documentation comment blocks. they're equivalent # despite their different syntax # # notice how each markup tag _must_ begin a new line # re_markup_tag1 = re.compile( r'''\s*<(\w*)>''' ) # <xxxx> format re_markup_tag2 = re.compile( r'''\s*@(\w*):''' ) # @xxxx: format # # the list of supported markup tags, we could add new ones relatively # easily # re_markup_tags = [re_markup_tag1, re_markup_tag2] # # used to detect a cross-reference, after markup tags have been stripped # re_crossref = re.compile( r'@(\w*)(.*)' ) # # used to detect italic and bold styles in paragraph text # re_italic = re.compile( r"_(\w(\w|')*)_(.*)" ) # _italic_ re_bold = re.compile( r"\*(\w(\w|')*)\*(.*)" ) # *bold* # # used to detect the end of commented source lines # re_source_sep = re.compile( r'\s*/\*\s*\*/' ) # # used to perform cross-reference within source output # re_source_crossref = re.compile( r'(\W*)(\w*)' ) # # a list of reserved source keywords # re_source_keywords = re.compile( '''\\b ( typedef | struct | enum | union | const | char | int | short | long | void | signed | unsigned | \#include | \#define | \#undef | \#if | \#ifdef | \#ifndef | \#else | \#endif ) \\b''', re.VERBOSE ) ################################################################ ## ## SOURCE BLOCK CLASS ## ## A SourceProcessor is in charge of reading a C source file ## and decomposing it into a series of different "SourceBlocks". ## each one of these blocks can be made of the following data: ## ## - A documentation comment block that starts with "/**" and ## whose exact format will be discussed later ## ## - normal sources lines, including comments ## ## the important fields in a text block are the following ones: ## ## self.lines : a list of text lines for the corresponding block ## ## self.content : for documentation comment blocks only, this is the ## block content that has been "unboxed" from its ## decoration. This is None for all other blocks ## (i.e. sources or ordinary comments with no starting ## markup tag) ## class SourceBlock: def __init__( self, processor, filename, lineno, lines ): self.processor = processor self.filename = filename self.lineno = lineno self.lines = lines[:] self.format = processor.format self.content = [] if self.format == None: return words = [] # extract comment lines lines = [] for line0 in self.lines: m = self.format.column.match( line0 ) if m: lines.append( m.group( 1 ) ) # now, look for a markup tag for l in lines: l = string.strip( l ) if len( l ) > 0: for tag in re_markup_tags: if tag.match( l ): self.content = lines return def location( self ): return "(" + self.filename + ":" + repr( self.lineno ) + ")" # debugging only - not used in normal operations def dump( self ): if self.content: print "{{{content start---" for l in self.content: print l print "---content end}}}" return fmt = "" if self.format: fmt = repr( self.format.id ) + " " for line in self.lines: print line ################################################################ ## ## SOURCE PROCESSOR CLASS ## ## The SourceProcessor is in charge of reading a C source file ## and decomposing it into a series of different "SourceBlock" ## objects. ## ## each one of these blocks can be made of the following data: ## ## - A documentation comment block that starts with "/**" and ## whose exact format will be discussed later ## ## - normal sources lines, include comments ## ## class SourceProcessor: def __init__( self ): """initialize a source processor""" self.blocks = [] self.filename = None self.format = None self.lines = [] def reset( self ): """reset a block processor, clean all its blocks""" self.blocks = [] self.format = None def parse_file( self, filename ): """parse a C source file, and add its blocks to the processor's list""" self.reset() self.filename = filename fileinput.close() self.format = None self.lineno = 0 self.lines = [] for line in fileinput.input( filename ): # strip trailing newlines, important on Windows machines! if line[-1] == '\012': line = line[0:-1] if self.format == None: self.process_normal_line( line ) else: if self.format.end.match( line ): # that's a normal block end, add it to 'lines' and # create a new block self.lines.append( line ) self.add_block_lines() elif self.format.column.match( line ): # that's a normal column line, add it to 'lines' self.lines.append( line ) else: # humm.. this is an unexpected block end, # create a new block, but don't process the line self.add_block_lines() # we need to process the line again self.process_normal_line( line ) # record the last lines self.add_block_lines() def process_normal_line( self, line ): """process a normal line and check whether it is the start of a new block""" for f in re_source_block_formats: if f.start.match( line ): self.add_block_lines() self.format = f self.lineno = fileinput.filelineno() self.lines.append( line ) def add_block_lines( self ): """add the current accumulated lines and create a new block""" if self.lines != []: block = SourceBlock( self, self.filename, self.lineno, self.lines ) self.blocks.append( block ) self.format = None self.lines = [] # debugging only, not used in normal operations def dump( self ): """print all blocks in a processor""" for b in self.blocks: b.dump() # eof
Python
# Formatter (c) 2002, 2004, 2007, 2008 David Turner <david@freetype.org> # from sources import * from content import * from utils import * # This is the base Formatter class. Its purpose is to convert # a content processor's data into specific documents (i.e., table of # contents, global index, and individual API reference indices). # # You need to sub-class it to output anything sensible. For example, # the file tohtml.py contains the definition of the HtmlFormatter sub-class # used to output -- you guessed it -- HTML. # class Formatter: def __init__( self, processor ): self.processor = processor self.identifiers = {} self.chapters = processor.chapters self.sections = processor.sections.values() self.block_index = [] # store all blocks in a dictionary self.blocks = [] for section in self.sections: for block in section.blocks.values(): self.add_identifier( block.name, block ) # add enumeration values to the index, since this is useful for markup in block.markups: if markup.tag == 'values': for field in markup.fields: self.add_identifier( field.name, block ) self.block_index = self.identifiers.keys() self.block_index.sort( index_sort ) def add_identifier( self, name, block ): if self.identifiers.has_key( name ): # duplicate name! sys.stderr.write( \ "WARNING: duplicate definition for '" + name + "' in " + \ block.location() + ", previous definition in " + \ self.identifiers[name].location() + "\n" ) else: self.identifiers[name] = block # # Formatting the table of contents # def toc_enter( self ): pass def toc_chapter_enter( self, chapter ): pass def toc_section_enter( self, section ): pass def toc_section_exit( self, section ): pass def toc_chapter_exit( self, chapter ): pass def toc_index( self, index_filename ): pass def toc_exit( self ): pass def toc_dump( self, toc_filename = None, index_filename = None ): output = None if toc_filename: output = open_output( toc_filename ) self.toc_enter() for chap in self.processor.chapters: self.toc_chapter_enter( chap ) for section in chap.sections: self.toc_section_enter( section ) self.toc_section_exit( section ) self.toc_chapter_exit( chap ) self.toc_index( index_filename ) self.toc_exit() if output: close_output( output ) # # Formatting the index # def index_enter( self ): pass def index_name_enter( self, name ): pass def index_name_exit( self, name ): pass def index_exit( self ): pass def index_dump( self, index_filename = None ): output = None if index_filename: output = open_output( index_filename ) self.index_enter() for name in self.block_index: self.index_name_enter( name ) self.index_name_exit( name ) self.index_exit() if output: close_output( output ) # # Formatting a section # def section_enter( self, section ): pass def block_enter( self, block ): pass def markup_enter( self, markup, block = None ): pass def field_enter( self, field, markup = None, block = None ): pass def field_exit( self, field, markup = None, block = None ): pass def markup_exit( self, markup, block = None ): pass def block_exit( self, block ): pass def section_exit( self, section ): pass def section_dump( self, section, section_filename = None ): output = None if section_filename: output = open_output( section_filename ) self.section_enter( section ) for name in section.block_names: block = self.identifiers[name] self.block_enter( block ) for markup in block.markups[1:]: # always ignore first markup! self.markup_enter( markup, block ) for field in markup.fields: self.field_enter( field, markup, block ) self.field_exit( field, markup, block ) self.markup_exit( markup, block ) self.block_exit( block ) self.section_exit( section ) if output: close_output( output ) def section_dump_all( self ): for section in self.sections: self.section_dump( section ) # eof
Python
# Content (c) 2002, 2004, 2006, 2007, 2008, 2009 # David Turner <david@freetype.org> # # This file contains routines used to parse the content of documentation # comment blocks and build more structured objects out of them. # from sources import * from utils import * import string, re # this regular expression is used to detect code sequences. these # are simply code fragments embedded in '{' and '}' like in: # # { # x = y + z; # if ( zookoo == 2 ) # { # foobar(); # } # } # # note that indentation of the starting and ending accolades must be # exactly the same. the code sequence can contain accolades at greater # indentation # re_code_start = re.compile( r"(\s*){\s*$" ) re_code_end = re.compile( r"(\s*)}\s*$" ) # this regular expression is used to isolate identifiers from # other text # re_identifier = re.compile( r'(\w*)' ) # we collect macros ending in `_H'; while outputting the object data, we use # this info together with the object's file location to emit the appropriate # header file macro and name before the object itself # re_header_macro = re.compile( r'^#define\s{1,}(\w{1,}_H)\s{1,}<(.*)>' ) ############################################################################# # # The DocCode class is used to store source code lines. # # 'self.lines' contains a set of source code lines that will be dumped as # HTML in a <PRE> tag. # # The object is filled line by line by the parser; it strips the leading # "margin" space from each input line before storing it in 'self.lines'. # class DocCode: def __init__( self, margin, lines ): self.lines = [] self.words = None # remove margin spaces for l in lines: if string.strip( l[:margin] ) == "": l = l[margin:] self.lines.append( l ) def dump( self, prefix = "", width = 60 ): lines = self.dump_lines( 0, width ) for l in lines: print prefix + l def dump_lines( self, margin = 0, width = 60 ): result = [] for l in self.lines: result.append( " " * margin + l ) return result ############################################################################# # # The DocPara class is used to store "normal" text paragraph. # # 'self.words' contains the list of words that make up the paragraph # class DocPara: def __init__( self, lines ): self.lines = None self.words = [] for l in lines: l = string.strip( l ) self.words.extend( string.split( l ) ) def dump( self, prefix = "", width = 60 ): lines = self.dump_lines( 0, width ) for l in lines: print prefix + l def dump_lines( self, margin = 0, width = 60 ): cur = "" # current line col = 0 # current width result = [] for word in self.words: ln = len( word ) if col > 0: ln = ln + 1 if col + ln > width: result.append( " " * margin + cur ) cur = word col = len( word ) else: if col > 0: cur = cur + " " cur = cur + word col = col + ln if col > 0: result.append( " " * margin + cur ) return result ############################################################################# # # The DocField class is used to store a list containing either DocPara or # DocCode objects. Each DocField also has an optional "name" which is used # when the object corresponds to a field or value definition # class DocField: def __init__( self, name, lines ): self.name = name # can be None for normal paragraphs/sources self.items = [] # list of items mode_none = 0 # start parsing mode mode_code = 1 # parsing code sequences mode_para = 3 # parsing normal paragraph margin = -1 # current code sequence indentation cur_lines = [] # now analyze the markup lines to see if they contain paragraphs, # code sequences or fields definitions # start = 0 mode = mode_none for l in lines: # are we parsing a code sequence ? if mode == mode_code: m = re_code_end.match( l ) if m and len( m.group( 1 ) ) <= margin: # that's it, we finished the code sequence code = DocCode( 0, cur_lines ) self.items.append( code ) margin = -1 cur_lines = [] mode = mode_none else: # nope, continue the code sequence cur_lines.append( l[margin:] ) else: # start of code sequence ? m = re_code_start.match( l ) if m: # save current lines if cur_lines: para = DocPara( cur_lines ) self.items.append( para ) cur_lines = [] # switch to code extraction mode margin = len( m.group( 1 ) ) mode = mode_code else: if not string.split( l ) and cur_lines: # if the line is empty, we end the current paragraph, # if any para = DocPara( cur_lines ) self.items.append( para ) cur_lines = [] else: # otherwise, simply add the line to the current # paragraph cur_lines.append( l ) if mode == mode_code: # unexpected end of code sequence code = DocCode( margin, cur_lines ) self.items.append( code ) elif cur_lines: para = DocPara( cur_lines ) self.items.append( para ) def dump( self, prefix = "" ): if self.field: print prefix + self.field + " ::" prefix = prefix + "----" first = 1 for p in self.items: if not first: print "" p.dump( prefix ) first = 0 def dump_lines( self, margin = 0, width = 60 ): result = [] nl = None for p in self.items: if nl: result.append( "" ) result.extend( p.dump_lines( margin, width ) ) nl = 1 return result # this regular expression is used to detect field definitions # re_field = re.compile( r"\s*(\w*|\w(\w|\.)*\w)\s*::" ) class DocMarkup: def __init__( self, tag, lines ): self.tag = string.lower( tag ) self.fields = [] cur_lines = [] field = None mode = 0 for l in lines: m = re_field.match( l ) if m: # we detected the start of a new field definition # first, save the current one if cur_lines: f = DocField( field, cur_lines ) self.fields.append( f ) cur_lines = [] field = None field = m.group( 1 ) # record field name ln = len( m.group( 0 ) ) l = " " * ln + l[ln:] cur_lines = [l] else: cur_lines.append( l ) if field or cur_lines: f = DocField( field, cur_lines ) self.fields.append( f ) def get_name( self ): try: return self.fields[0].items[0].words[0] except: return None def get_start( self ): try: result = "" for word in self.fields[0].items[0].words: result = result + " " + word return result[1:] except: return "ERROR" def dump( self, margin ): print " " * margin + "<" + self.tag + ">" for f in self.fields: f.dump( " " ) print " " * margin + "</" + self.tag + ">" class DocChapter: def __init__( self, block ): self.block = block self.sections = [] if block: self.name = block.name self.title = block.get_markup_words( "title" ) self.order = block.get_markup_words( "sections" ) else: self.name = "Other" self.title = string.split( "Miscellaneous" ) self.order = [] class DocSection: def __init__( self, name = "Other" ): self.name = name self.blocks = {} self.block_names = [] # ordered block names in section self.defs = [] self.abstract = "" self.description = "" self.order = [] self.title = "ERROR" self.chapter = None def add_def( self, block ): self.defs.append( block ) def add_block( self, block ): self.block_names.append( block.name ) self.blocks[block.name] = block def process( self ): # look up one block that contains a valid section description for block in self.defs: title = block.get_markup_text( "title" ) if title: self.title = title self.abstract = block.get_markup_words( "abstract" ) self.description = block.get_markup_items( "description" ) self.order = block.get_markup_words( "order" ) return def reorder( self ): self.block_names = sort_order_list( self.block_names, self.order ) class ContentProcessor: def __init__( self ): """initialize a block content processor""" self.reset() self.sections = {} # dictionary of documentation sections self.section = None # current documentation section self.chapters = [] # list of chapters self.headers = {} # dictionary of header macros def set_section( self, section_name ): """set current section during parsing""" if not self.sections.has_key( section_name ): section = DocSection( section_name ) self.sections[section_name] = section self.section = section else: self.section = self.sections[section_name] def add_chapter( self, block ): chapter = DocChapter( block ) self.chapters.append( chapter ) def reset( self ): """reset the content processor for a new block""" self.markups = [] self.markup = None self.markup_lines = [] def add_markup( self ): """add a new markup section""" if self.markup and self.markup_lines: # get rid of last line of markup if it's empty marks = self.markup_lines if len( marks ) > 0 and not string.strip( marks[-1] ): self.markup_lines = marks[:-1] m = DocMarkup( self.markup, self.markup_lines ) self.markups.append( m ) self.markup = None self.markup_lines = [] def process_content( self, content ): """process a block content and return a list of DocMarkup objects corresponding to it""" markup = None markup_lines = [] first = 1 for line in content: found = None for t in re_markup_tags: m = t.match( line ) if m: found = string.lower( m.group( 1 ) ) prefix = len( m.group( 0 ) ) line = " " * prefix + line[prefix:] # remove markup from line break # is it the start of a new markup section ? if found: first = 0 self.add_markup() # add current markup content self.markup = found if len( string.strip( line ) ) > 0: self.markup_lines.append( line ) elif first == 0: self.markup_lines.append( line ) self.add_markup() return self.markups def parse_sources( self, source_processor ): blocks = source_processor.blocks count = len( blocks ) for n in range( count ): source = blocks[n] if source.content: # this is a documentation comment, we need to catch # all following normal blocks in the "follow" list # follow = [] m = n + 1 while m < count and not blocks[m].content: follow.append( blocks[m] ) m = m + 1 doc_block = DocBlock( source, follow, self ) def finish( self ): # process all sections to extract their abstract, description # and ordered list of items # for sec in self.sections.values(): sec.process() # process chapters to check that all sections are correctly # listed there for chap in self.chapters: for sec in chap.order: if self.sections.has_key( sec ): section = self.sections[sec] section.chapter = chap section.reorder() chap.sections.append( section ) else: sys.stderr.write( "WARNING: chapter '" + \ chap.name + "' in " + chap.block.location() + \ " lists unknown section '" + sec + "'\n" ) # check that all sections are in a chapter # others = [] for sec in self.sections.values(): if not sec.chapter: others.append( sec ) # create a new special chapter for all remaining sections # when necessary # if others: chap = DocChapter( None ) chap.sections = others self.chapters.append( chap ) class DocBlock: def __init__( self, source, follow, processor ): processor.reset() self.source = source self.code = [] self.type = "ERRTYPE" self.name = "ERRNAME" self.section = processor.section self.markups = processor.process_content( source.content ) # compute block type from first markup tag try: self.type = self.markups[0].tag except: pass # compute block name from first markup paragraph try: markup = self.markups[0] para = markup.fields[0].items[0] name = para.words[0] m = re_identifier.match( name ) if m: name = m.group( 1 ) self.name = name except: pass if self.type == "section": # detect new section starts processor.set_section( self.name ) processor.section.add_def( self ) elif self.type == "chapter": # detect new chapter processor.add_chapter( self ) else: processor.section.add_block( self ) # now, compute the source lines relevant to this documentation # block. We keep normal comments in for obvious reasons (??) source = [] for b in follow: if b.format: break for l in b.lines: # collect header macro definitions m = re_header_macro.match( l ) if m: processor.headers[m.group( 2 )] = m.group( 1 ); # we use "/* */" as a separator if re_source_sep.match( l ): break source.append( l ) # now strip the leading and trailing empty lines from the sources start = 0 end = len( source ) - 1 while start < end and not string.strip( source[start] ): start = start + 1 while start < end and not string.strip( source[end] ): end = end - 1 if start == end and not string.strip( source[start] ): self.code = [] else: self.code = source[start:end + 1] def location( self ): return self.source.location() def get_markup( self, tag_name ): """return the DocMarkup corresponding to a given tag in a block""" for m in self.markups: if m.tag == string.lower( tag_name ): return m return None def get_markup_name( self, tag_name ): """return the name of a given primary markup in a block""" try: m = self.get_markup( tag_name ) return m.get_name() except: return None def get_markup_words( self, tag_name ): try: m = self.get_markup( tag_name ) return m.fields[0].items[0].words except: return [] def get_markup_text( self, tag_name ): result = self.get_markup_words( tag_name ) return string.join( result ) def get_markup_items( self, tag_name ): try: m = self.get_markup( tag_name ) return m.fields[0].items except: return None # eof
Python
#!/usr/bin/env python # # DocBeauty (c) 2003, 2004, 2008 David Turner <david@freetype.org> # # This program is used to beautify the documentation comments used # in the FreeType 2 public headers. # from sources import * from content import * from utils import * import utils import sys, os, time, string, getopt content_processor = ContentProcessor() def beautify_block( block ): if block.content: content_processor.reset() markups = content_processor.process_content( block.content ) text = [] first = 1 for markup in markups: text.extend( markup.beautify( first ) ) first = 0 # now beautify the documentation "borders" themselves lines = [" /*************************************************************************"] for l in text: lines.append( " *" + l ) lines.append( " */" ) block.lines = lines def usage(): print "\nDocBeauty 0.1 Usage information\n" print " docbeauty [options] file1 [file2 ...]\n" print "using the following options:\n" print " -h : print this page" print " -b : backup original files with the 'orig' extension" print "" print " --backup : same as -b" def main( argv ): """main program loop""" global output_dir try: opts, args = getopt.getopt( sys.argv[1:], \ "hb", \ ["help", "backup"] ) except getopt.GetoptError: usage() sys.exit( 2 ) if args == []: usage() sys.exit( 1 ) # process options # output_dir = None do_backup = None for opt in opts: if opt[0] in ( "-h", "--help" ): usage() sys.exit( 0 ) if opt[0] in ( "-b", "--backup" ): do_backup = 1 # create context and processor source_processor = SourceProcessor() # retrieve the list of files to process file_list = make_file_list( args ) for filename in file_list: source_processor.parse_file( filename ) for block in source_processor.blocks: beautify_block( block ) new_name = filename + ".new" ok = None try: file = open( new_name, "wt" ) for block in source_processor.blocks: for line in block.lines: file.write( line ) file.write( "\n" ) file.close() except: ok = 0 # if called from the command line # if __name__ == '__main__': main( sys.argv ) # eof
Python
# compute arctangent table for CORDIC computations in fttrigon.c import sys, math #units = 64*65536.0 # don't change !! units = 256 scale = units/math.pi shrink = 1.0 comma = "" def calc_val( x ): global units, shrink angle = math.atan(x) shrink = shrink * math.cos(angle) return angle/math.pi * units def print_val( n, x ): global comma lo = int(x) hi = lo + 1 alo = math.atan(lo) ahi = math.atan(hi) ax = math.atan(2.0**n) errlo = abs( alo - ax ) errhi = abs( ahi - ax ) if ( errlo < errhi ): hi = lo sys.stdout.write( comma + repr( int(hi) ) ) comma = ", " print "" print "table of arctan( 1/2^n ) for PI = " + repr(units/65536.0) + " units" # compute range of "i" r = [-1] r = r + range(32) for n in r: if n >= 0: x = 1.0/(2.0**n) # tangent value else: x = 2.0**(-n) angle = math.atan(x) # arctangent angle2 = angle*scale # arctangent in FT_Angle units # determine which integer value for angle gives the best tangent lo = int(angle2) hi = lo + 1 tlo = math.tan(lo/scale) thi = math.tan(hi/scale) errlo = abs( tlo - x ) errhi = abs( thi - x ) angle2 = hi if errlo < errhi: angle2 = lo if angle2 <= 0: break sys.stdout.write( comma + repr( int(angle2) ) ) comma = ", " shrink = shrink * math.cos( angle2/scale) print print "shrink factor = " + repr( shrink ) print "shrink factor 2 = " + repr( shrink * (2.0**32) ) print "expansion factor = " + repr(1/shrink) print ""
Python
#!/usr/bin/env python # # # FreeType 2 glyph name builder # # Copyright 1996-2000, 2003, 2005, 2007, 2008, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, # and distributed under the terms of the FreeType project license, # LICENSE.TXT. By continuing to use, modify, or distribute this file you # indicate that you have read the license and understand and accept it # fully. """\ usage: %s <output-file> This python script generates the glyph names tables defined in the `psnames' module. Its single argument is the name of the header file to be created. """ import sys, string, struct, re, os.path # This table lists the glyphs according to the Macintosh specification. # It is used by the TrueType Postscript names table. # # See # # http://fonts.apple.com/TTRefMan/RM06/Chap6post.html # # for the official list. # mac_standard_names = \ [ # 0 ".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", # 10 "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", # 20 "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", # 30 "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", # 40 "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", # 50 "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", # 60 "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", # 70 "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", # 80 "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", # 90 "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", # 100 "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", # 110 "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", # 120 "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", # 130 "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", # 140 "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", # 150 "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", # 160 "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", # 170 "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", # 180 "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", # 190 "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", # 200 "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", # 210 "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", # 220 "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", # 230 "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", # 240 "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", # 250 "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat" ] # The list of standard `SID' glyph names. For the official list, # see Annex A of document at # # http://partners.adobe.com/public/developer/en/font/5176.CFF.pdf . # sid_standard_names = \ [ # 0 ".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", # 10 "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", # 20 "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", # 30 "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", # 40 "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", # 50 "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", # 60 "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", # 70 "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", # 80 "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", # 90 "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", # 100 "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", # 110 "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", # 120 "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", # 130 "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", # 140 "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", # 150 "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", # 160 "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", # 170 "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", # 180 "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", # 190 "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", # 200 "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", # 210 "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", # 220 "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", # 230 "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", # 240 "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", # 250 "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", # 260 "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", # 270 "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", # 280 "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", # 290 "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", # 300 "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", # 310 "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", # 320 "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", # 330 "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", # 340 "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", # 350 "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", # 360 "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", # 370 "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", # 380 "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", # 390 "Semibold" ] # This table maps character codes of the Adobe Standard Type 1 # encoding to glyph indices in the sid_standard_names table. # t1_standard_encoding = \ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 0, 111, 112, 113, 114, 0, 115, 116, 117, 118, 119, 120, 121, 122, 0, 123, 0, 124, 125, 126, 127, 128, 129, 130, 131, 0, 132, 133, 0, 134, 135, 136, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 139, 0, 0, 0, 0, 140, 141, 142, 143, 0, 0, 0, 0, 0, 144, 0, 0, 0, 145, 0, 0, 146, 147, 148, 149, 0, 0, 0, 0 ] # This table maps character codes of the Adobe Expert Type 1 # encoding to glyph indices in the sid_standard_names table. # t1_expert_encoding = \ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 229, 230, 0, 231, 232, 233, 234, 235, 236, 237, 238, 13, 14, 15, 99, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 27, 28, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 0, 0, 0, 258, 0, 0, 259, 260, 261, 262, 0, 0, 263, 264, 265, 0, 266, 109, 110, 267, 268, 269, 0, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 304, 305, 306, 0, 0, 307, 308, 309, 310, 311, 0, 312, 0, 0, 313, 0, 0, 314, 315, 0, 0, 316, 317, 318, 0, 0, 0, 158, 155, 163, 319, 320, 321, 322, 323, 324, 325, 0, 0, 326, 150, 164, 169, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378 ] # This data has been taken literally from the files `glyphlist.txt' # and `zapfdingbats.txt' version 2.0, Sept 2002. It is available from # # http://sourceforge.net/adobe/aglfn/ # adobe_glyph_list = """\ A;0041 AE;00C6 AEacute;01FC AEmacron;01E2 AEsmall;F7E6 Aacute;00C1 Aacutesmall;F7E1 Abreve;0102 Abreveacute;1EAE Abrevecyrillic;04D0 Abrevedotbelow;1EB6 Abrevegrave;1EB0 Abrevehookabove;1EB2 Abrevetilde;1EB4 Acaron;01CD Acircle;24B6 Acircumflex;00C2 Acircumflexacute;1EA4 Acircumflexdotbelow;1EAC Acircumflexgrave;1EA6 Acircumflexhookabove;1EA8 Acircumflexsmall;F7E2 Acircumflextilde;1EAA Acute;F6C9 Acutesmall;F7B4 Acyrillic;0410 Adblgrave;0200 Adieresis;00C4 Adieresiscyrillic;04D2 Adieresismacron;01DE Adieresissmall;F7E4 Adotbelow;1EA0 Adotmacron;01E0 Agrave;00C0 Agravesmall;F7E0 Ahookabove;1EA2 Aiecyrillic;04D4 Ainvertedbreve;0202 Alpha;0391 Alphatonos;0386 Amacron;0100 Amonospace;FF21 Aogonek;0104 Aring;00C5 Aringacute;01FA Aringbelow;1E00 Aringsmall;F7E5 Asmall;F761 Atilde;00C3 Atildesmall;F7E3 Aybarmenian;0531 B;0042 Bcircle;24B7 Bdotaccent;1E02 Bdotbelow;1E04 Becyrillic;0411 Benarmenian;0532 Beta;0392 Bhook;0181 Blinebelow;1E06 Bmonospace;FF22 Brevesmall;F6F4 Bsmall;F762 Btopbar;0182 C;0043 Caarmenian;053E Cacute;0106 Caron;F6CA Caronsmall;F6F5 Ccaron;010C Ccedilla;00C7 Ccedillaacute;1E08 Ccedillasmall;F7E7 Ccircle;24B8 Ccircumflex;0108 Cdot;010A Cdotaccent;010A Cedillasmall;F7B8 Chaarmenian;0549 Cheabkhasiancyrillic;04BC Checyrillic;0427 Chedescenderabkhasiancyrillic;04BE Chedescendercyrillic;04B6 Chedieresiscyrillic;04F4 Cheharmenian;0543 Chekhakassiancyrillic;04CB Cheverticalstrokecyrillic;04B8 Chi;03A7 Chook;0187 Circumflexsmall;F6F6 Cmonospace;FF23 Coarmenian;0551 Csmall;F763 D;0044 DZ;01F1 DZcaron;01C4 Daarmenian;0534 Dafrican;0189 Dcaron;010E Dcedilla;1E10 Dcircle;24B9 Dcircumflexbelow;1E12 Dcroat;0110 Ddotaccent;1E0A Ddotbelow;1E0C Decyrillic;0414 Deicoptic;03EE Delta;2206 Deltagreek;0394 Dhook;018A Dieresis;F6CB DieresisAcute;F6CC DieresisGrave;F6CD Dieresissmall;F7A8 Digammagreek;03DC Djecyrillic;0402 Dlinebelow;1E0E Dmonospace;FF24 Dotaccentsmall;F6F7 Dslash;0110 Dsmall;F764 Dtopbar;018B Dz;01F2 Dzcaron;01C5 Dzeabkhasiancyrillic;04E0 Dzecyrillic;0405 Dzhecyrillic;040F E;0045 Eacute;00C9 Eacutesmall;F7E9 Ebreve;0114 Ecaron;011A Ecedillabreve;1E1C Echarmenian;0535 Ecircle;24BA Ecircumflex;00CA Ecircumflexacute;1EBE Ecircumflexbelow;1E18 Ecircumflexdotbelow;1EC6 Ecircumflexgrave;1EC0 Ecircumflexhookabove;1EC2 Ecircumflexsmall;F7EA Ecircumflextilde;1EC4 Ecyrillic;0404 Edblgrave;0204 Edieresis;00CB Edieresissmall;F7EB Edot;0116 Edotaccent;0116 Edotbelow;1EB8 Efcyrillic;0424 Egrave;00C8 Egravesmall;F7E8 Eharmenian;0537 Ehookabove;1EBA Eightroman;2167 Einvertedbreve;0206 Eiotifiedcyrillic;0464 Elcyrillic;041B Elevenroman;216A Emacron;0112 Emacronacute;1E16 Emacrongrave;1E14 Emcyrillic;041C Emonospace;FF25 Encyrillic;041D Endescendercyrillic;04A2 Eng;014A Enghecyrillic;04A4 Enhookcyrillic;04C7 Eogonek;0118 Eopen;0190 Epsilon;0395 Epsilontonos;0388 Ercyrillic;0420 Ereversed;018E Ereversedcyrillic;042D Escyrillic;0421 Esdescendercyrillic;04AA Esh;01A9 Esmall;F765 Eta;0397 Etarmenian;0538 Etatonos;0389 Eth;00D0 Ethsmall;F7F0 Etilde;1EBC Etildebelow;1E1A Euro;20AC Ezh;01B7 Ezhcaron;01EE Ezhreversed;01B8 F;0046 Fcircle;24BB Fdotaccent;1E1E Feharmenian;0556 Feicoptic;03E4 Fhook;0191 Fitacyrillic;0472 Fiveroman;2164 Fmonospace;FF26 Fourroman;2163 Fsmall;F766 G;0047 GBsquare;3387 Gacute;01F4 Gamma;0393 Gammaafrican;0194 Gangiacoptic;03EA Gbreve;011E Gcaron;01E6 Gcedilla;0122 Gcircle;24BC Gcircumflex;011C Gcommaaccent;0122 Gdot;0120 Gdotaccent;0120 Gecyrillic;0413 Ghadarmenian;0542 Ghemiddlehookcyrillic;0494 Ghestrokecyrillic;0492 Gheupturncyrillic;0490 Ghook;0193 Gimarmenian;0533 Gjecyrillic;0403 Gmacron;1E20 Gmonospace;FF27 Grave;F6CE Gravesmall;F760 Gsmall;F767 Gsmallhook;029B Gstroke;01E4 H;0048 H18533;25CF H18543;25AA H18551;25AB H22073;25A1 HPsquare;33CB Haabkhasiancyrillic;04A8 Hadescendercyrillic;04B2 Hardsigncyrillic;042A Hbar;0126 Hbrevebelow;1E2A Hcedilla;1E28 Hcircle;24BD Hcircumflex;0124 Hdieresis;1E26 Hdotaccent;1E22 Hdotbelow;1E24 Hmonospace;FF28 Hoarmenian;0540 Horicoptic;03E8 Hsmall;F768 Hungarumlaut;F6CF Hungarumlautsmall;F6F8 Hzsquare;3390 I;0049 IAcyrillic;042F IJ;0132 IUcyrillic;042E Iacute;00CD Iacutesmall;F7ED Ibreve;012C Icaron;01CF Icircle;24BE Icircumflex;00CE Icircumflexsmall;F7EE Icyrillic;0406 Idblgrave;0208 Idieresis;00CF Idieresisacute;1E2E Idieresiscyrillic;04E4 Idieresissmall;F7EF Idot;0130 Idotaccent;0130 Idotbelow;1ECA Iebrevecyrillic;04D6 Iecyrillic;0415 Ifraktur;2111 Igrave;00CC Igravesmall;F7EC Ihookabove;1EC8 Iicyrillic;0418 Iinvertedbreve;020A Iishortcyrillic;0419 Imacron;012A Imacroncyrillic;04E2 Imonospace;FF29 Iniarmenian;053B Iocyrillic;0401 Iogonek;012E Iota;0399 Iotaafrican;0196 Iotadieresis;03AA Iotatonos;038A Ismall;F769 Istroke;0197 Itilde;0128 Itildebelow;1E2C Izhitsacyrillic;0474 Izhitsadblgravecyrillic;0476 J;004A Jaarmenian;0541 Jcircle;24BF Jcircumflex;0134 Jecyrillic;0408 Jheharmenian;054B Jmonospace;FF2A Jsmall;F76A K;004B KBsquare;3385 KKsquare;33CD Kabashkircyrillic;04A0 Kacute;1E30 Kacyrillic;041A Kadescendercyrillic;049A Kahookcyrillic;04C3 Kappa;039A Kastrokecyrillic;049E Kaverticalstrokecyrillic;049C Kcaron;01E8 Kcedilla;0136 Kcircle;24C0 Kcommaaccent;0136 Kdotbelow;1E32 Keharmenian;0554 Kenarmenian;053F Khacyrillic;0425 Kheicoptic;03E6 Khook;0198 Kjecyrillic;040C Klinebelow;1E34 Kmonospace;FF2B Koppacyrillic;0480 Koppagreek;03DE Ksicyrillic;046E Ksmall;F76B L;004C LJ;01C7 LL;F6BF Lacute;0139 Lambda;039B Lcaron;013D Lcedilla;013B Lcircle;24C1 Lcircumflexbelow;1E3C Lcommaaccent;013B Ldot;013F Ldotaccent;013F Ldotbelow;1E36 Ldotbelowmacron;1E38 Liwnarmenian;053C Lj;01C8 Ljecyrillic;0409 Llinebelow;1E3A Lmonospace;FF2C Lslash;0141 Lslashsmall;F6F9 Lsmall;F76C M;004D MBsquare;3386 Macron;F6D0 Macronsmall;F7AF Macute;1E3E Mcircle;24C2 Mdotaccent;1E40 Mdotbelow;1E42 Menarmenian;0544 Mmonospace;FF2D Msmall;F76D Mturned;019C Mu;039C N;004E NJ;01CA Nacute;0143 Ncaron;0147 Ncedilla;0145 Ncircle;24C3 Ncircumflexbelow;1E4A Ncommaaccent;0145 Ndotaccent;1E44 Ndotbelow;1E46 Nhookleft;019D Nineroman;2168 Nj;01CB Njecyrillic;040A Nlinebelow;1E48 Nmonospace;FF2E Nowarmenian;0546 Nsmall;F76E Ntilde;00D1 Ntildesmall;F7F1 Nu;039D O;004F OE;0152 OEsmall;F6FA Oacute;00D3 Oacutesmall;F7F3 Obarredcyrillic;04E8 Obarreddieresiscyrillic;04EA Obreve;014E Ocaron;01D1 Ocenteredtilde;019F Ocircle;24C4 Ocircumflex;00D4 Ocircumflexacute;1ED0 Ocircumflexdotbelow;1ED8 Ocircumflexgrave;1ED2 Ocircumflexhookabove;1ED4 Ocircumflexsmall;F7F4 Ocircumflextilde;1ED6 Ocyrillic;041E Odblacute;0150 Odblgrave;020C Odieresis;00D6 Odieresiscyrillic;04E6 Odieresissmall;F7F6 Odotbelow;1ECC Ogoneksmall;F6FB Ograve;00D2 Ogravesmall;F7F2 Oharmenian;0555 Ohm;2126 Ohookabove;1ECE Ohorn;01A0 Ohornacute;1EDA Ohorndotbelow;1EE2 Ohorngrave;1EDC Ohornhookabove;1EDE Ohorntilde;1EE0 Ohungarumlaut;0150 Oi;01A2 Oinvertedbreve;020E Omacron;014C Omacronacute;1E52 Omacrongrave;1E50 Omega;2126 Omegacyrillic;0460 Omegagreek;03A9 Omegaroundcyrillic;047A Omegatitlocyrillic;047C Omegatonos;038F Omicron;039F Omicrontonos;038C Omonospace;FF2F Oneroman;2160 Oogonek;01EA Oogonekmacron;01EC Oopen;0186 Oslash;00D8 Oslashacute;01FE Oslashsmall;F7F8 Osmall;F76F Ostrokeacute;01FE Otcyrillic;047E Otilde;00D5 Otildeacute;1E4C Otildedieresis;1E4E Otildesmall;F7F5 P;0050 Pacute;1E54 Pcircle;24C5 Pdotaccent;1E56 Pecyrillic;041F Peharmenian;054A Pemiddlehookcyrillic;04A6 Phi;03A6 Phook;01A4 Pi;03A0 Piwrarmenian;0553 Pmonospace;FF30 Psi;03A8 Psicyrillic;0470 Psmall;F770 Q;0051 Qcircle;24C6 Qmonospace;FF31 Qsmall;F771 R;0052 Raarmenian;054C Racute;0154 Rcaron;0158 Rcedilla;0156 Rcircle;24C7 Rcommaaccent;0156 Rdblgrave;0210 Rdotaccent;1E58 Rdotbelow;1E5A Rdotbelowmacron;1E5C Reharmenian;0550 Rfraktur;211C Rho;03A1 Ringsmall;F6FC Rinvertedbreve;0212 Rlinebelow;1E5E Rmonospace;FF32 Rsmall;F772 Rsmallinverted;0281 Rsmallinvertedsuperior;02B6 S;0053 SF010000;250C SF020000;2514 SF030000;2510 SF040000;2518 SF050000;253C SF060000;252C SF070000;2534 SF080000;251C SF090000;2524 SF100000;2500 SF110000;2502 SF190000;2561 SF200000;2562 SF210000;2556 SF220000;2555 SF230000;2563 SF240000;2551 SF250000;2557 SF260000;255D SF270000;255C SF280000;255B SF360000;255E SF370000;255F SF380000;255A SF390000;2554 SF400000;2569 SF410000;2566 SF420000;2560 SF430000;2550 SF440000;256C SF450000;2567 SF460000;2568 SF470000;2564 SF480000;2565 SF490000;2559 SF500000;2558 SF510000;2552 SF520000;2553 SF530000;256B SF540000;256A Sacute;015A Sacutedotaccent;1E64 Sampigreek;03E0 Scaron;0160 Scarondotaccent;1E66 Scaronsmall;F6FD Scedilla;015E Schwa;018F Schwacyrillic;04D8 Schwadieresiscyrillic;04DA Scircle;24C8 Scircumflex;015C Scommaaccent;0218 Sdotaccent;1E60 Sdotbelow;1E62 Sdotbelowdotaccent;1E68 Seharmenian;054D Sevenroman;2166 Shaarmenian;0547 Shacyrillic;0428 Shchacyrillic;0429 Sheicoptic;03E2 Shhacyrillic;04BA Shimacoptic;03EC Sigma;03A3 Sixroman;2165 Smonospace;FF33 Softsigncyrillic;042C Ssmall;F773 Stigmagreek;03DA T;0054 Tau;03A4 Tbar;0166 Tcaron;0164 Tcedilla;0162 Tcircle;24C9 Tcircumflexbelow;1E70 Tcommaaccent;0162 Tdotaccent;1E6A Tdotbelow;1E6C Tecyrillic;0422 Tedescendercyrillic;04AC Tenroman;2169 Tetsecyrillic;04B4 Theta;0398 Thook;01AC Thorn;00DE Thornsmall;F7FE Threeroman;2162 Tildesmall;F6FE Tiwnarmenian;054F Tlinebelow;1E6E Tmonospace;FF34 Toarmenian;0539 Tonefive;01BC Tonesix;0184 Tonetwo;01A7 Tretroflexhook;01AE Tsecyrillic;0426 Tshecyrillic;040B Tsmall;F774 Twelveroman;216B Tworoman;2161 U;0055 Uacute;00DA Uacutesmall;F7FA Ubreve;016C Ucaron;01D3 Ucircle;24CA Ucircumflex;00DB Ucircumflexbelow;1E76 Ucircumflexsmall;F7FB Ucyrillic;0423 Udblacute;0170 Udblgrave;0214 Udieresis;00DC Udieresisacute;01D7 Udieresisbelow;1E72 Udieresiscaron;01D9 Udieresiscyrillic;04F0 Udieresisgrave;01DB Udieresismacron;01D5 Udieresissmall;F7FC Udotbelow;1EE4 Ugrave;00D9 Ugravesmall;F7F9 Uhookabove;1EE6 Uhorn;01AF Uhornacute;1EE8 Uhorndotbelow;1EF0 Uhorngrave;1EEA Uhornhookabove;1EEC Uhorntilde;1EEE Uhungarumlaut;0170 Uhungarumlautcyrillic;04F2 Uinvertedbreve;0216 Ukcyrillic;0478 Umacron;016A Umacroncyrillic;04EE Umacrondieresis;1E7A Umonospace;FF35 Uogonek;0172 Upsilon;03A5 Upsilon1;03D2 Upsilonacutehooksymbolgreek;03D3 Upsilonafrican;01B1 Upsilondieresis;03AB Upsilondieresishooksymbolgreek;03D4 Upsilonhooksymbol;03D2 Upsilontonos;038E Uring;016E Ushortcyrillic;040E Usmall;F775 Ustraightcyrillic;04AE Ustraightstrokecyrillic;04B0 Utilde;0168 Utildeacute;1E78 Utildebelow;1E74 V;0056 Vcircle;24CB Vdotbelow;1E7E Vecyrillic;0412 Vewarmenian;054E Vhook;01B2 Vmonospace;FF36 Voarmenian;0548 Vsmall;F776 Vtilde;1E7C W;0057 Wacute;1E82 Wcircle;24CC Wcircumflex;0174 Wdieresis;1E84 Wdotaccent;1E86 Wdotbelow;1E88 Wgrave;1E80 Wmonospace;FF37 Wsmall;F777 X;0058 Xcircle;24CD Xdieresis;1E8C Xdotaccent;1E8A Xeharmenian;053D Xi;039E Xmonospace;FF38 Xsmall;F778 Y;0059 Yacute;00DD Yacutesmall;F7FD Yatcyrillic;0462 Ycircle;24CE Ycircumflex;0176 Ydieresis;0178 Ydieresissmall;F7FF Ydotaccent;1E8E Ydotbelow;1EF4 Yericyrillic;042B Yerudieresiscyrillic;04F8 Ygrave;1EF2 Yhook;01B3 Yhookabove;1EF6 Yiarmenian;0545 Yicyrillic;0407 Yiwnarmenian;0552 Ymonospace;FF39 Ysmall;F779 Ytilde;1EF8 Yusbigcyrillic;046A Yusbigiotifiedcyrillic;046C Yuslittlecyrillic;0466 Yuslittleiotifiedcyrillic;0468 Z;005A Zaarmenian;0536 Zacute;0179 Zcaron;017D Zcaronsmall;F6FF Zcircle;24CF Zcircumflex;1E90 Zdot;017B Zdotaccent;017B Zdotbelow;1E92 Zecyrillic;0417 Zedescendercyrillic;0498 Zedieresiscyrillic;04DE Zeta;0396 Zhearmenian;053A Zhebrevecyrillic;04C1 Zhecyrillic;0416 Zhedescendercyrillic;0496 Zhedieresiscyrillic;04DC Zlinebelow;1E94 Zmonospace;FF3A Zsmall;F77A Zstroke;01B5 a;0061 aabengali;0986 aacute;00E1 aadeva;0906 aagujarati;0A86 aagurmukhi;0A06 aamatragurmukhi;0A3E aarusquare;3303 aavowelsignbengali;09BE aavowelsigndeva;093E aavowelsigngujarati;0ABE abbreviationmarkarmenian;055F abbreviationsigndeva;0970 abengali;0985 abopomofo;311A abreve;0103 abreveacute;1EAF abrevecyrillic;04D1 abrevedotbelow;1EB7 abrevegrave;1EB1 abrevehookabove;1EB3 abrevetilde;1EB5 acaron;01CE acircle;24D0 acircumflex;00E2 acircumflexacute;1EA5 acircumflexdotbelow;1EAD acircumflexgrave;1EA7 acircumflexhookabove;1EA9 acircumflextilde;1EAB acute;00B4 acutebelowcmb;0317 acutecmb;0301 acutecomb;0301 acutedeva;0954 acutelowmod;02CF acutetonecmb;0341 acyrillic;0430 adblgrave;0201 addakgurmukhi;0A71 adeva;0905 adieresis;00E4 adieresiscyrillic;04D3 adieresismacron;01DF adotbelow;1EA1 adotmacron;01E1 ae;00E6 aeacute;01FD aekorean;3150 aemacron;01E3 afii00208;2015 afii08941;20A4 afii10017;0410 afii10018;0411 afii10019;0412 afii10020;0413 afii10021;0414 afii10022;0415 afii10023;0401 afii10024;0416 afii10025;0417 afii10026;0418 afii10027;0419 afii10028;041A afii10029;041B afii10030;041C afii10031;041D afii10032;041E afii10033;041F afii10034;0420 afii10035;0421 afii10036;0422 afii10037;0423 afii10038;0424 afii10039;0425 afii10040;0426 afii10041;0427 afii10042;0428 afii10043;0429 afii10044;042A afii10045;042B afii10046;042C afii10047;042D afii10048;042E afii10049;042F afii10050;0490 afii10051;0402 afii10052;0403 afii10053;0404 afii10054;0405 afii10055;0406 afii10056;0407 afii10057;0408 afii10058;0409 afii10059;040A afii10060;040B afii10061;040C afii10062;040E afii10063;F6C4 afii10064;F6C5 afii10065;0430 afii10066;0431 afii10067;0432 afii10068;0433 afii10069;0434 afii10070;0435 afii10071;0451 afii10072;0436 afii10073;0437 afii10074;0438 afii10075;0439 afii10076;043A afii10077;043B afii10078;043C afii10079;043D afii10080;043E afii10081;043F afii10082;0440 afii10083;0441 afii10084;0442 afii10085;0443 afii10086;0444 afii10087;0445 afii10088;0446 afii10089;0447 afii10090;0448 afii10091;0449 afii10092;044A afii10093;044B afii10094;044C afii10095;044D afii10096;044E afii10097;044F afii10098;0491 afii10099;0452 afii10100;0453 afii10101;0454 afii10102;0455 afii10103;0456 afii10104;0457 afii10105;0458 afii10106;0459 afii10107;045A afii10108;045B afii10109;045C afii10110;045E afii10145;040F afii10146;0462 afii10147;0472 afii10148;0474 afii10192;F6C6 afii10193;045F afii10194;0463 afii10195;0473 afii10196;0475 afii10831;F6C7 afii10832;F6C8 afii10846;04D9 afii299;200E afii300;200F afii301;200D afii57381;066A afii57388;060C afii57392;0660 afii57393;0661 afii57394;0662 afii57395;0663 afii57396;0664 afii57397;0665 afii57398;0666 afii57399;0667 afii57400;0668 afii57401;0669 afii57403;061B afii57407;061F afii57409;0621 afii57410;0622 afii57411;0623 afii57412;0624 afii57413;0625 afii57414;0626 afii57415;0627 afii57416;0628 afii57417;0629 afii57418;062A afii57419;062B afii57420;062C afii57421;062D afii57422;062E afii57423;062F afii57424;0630 afii57425;0631 afii57426;0632 afii57427;0633 afii57428;0634 afii57429;0635 afii57430;0636 afii57431;0637 afii57432;0638 afii57433;0639 afii57434;063A afii57440;0640 afii57441;0641 afii57442;0642 afii57443;0643 afii57444;0644 afii57445;0645 afii57446;0646 afii57448;0648 afii57449;0649 afii57450;064A afii57451;064B afii57452;064C afii57453;064D afii57454;064E afii57455;064F afii57456;0650 afii57457;0651 afii57458;0652 afii57470;0647 afii57505;06A4 afii57506;067E afii57507;0686 afii57508;0698 afii57509;06AF afii57511;0679 afii57512;0688 afii57513;0691 afii57514;06BA afii57519;06D2 afii57534;06D5 afii57636;20AA afii57645;05BE afii57658;05C3 afii57664;05D0 afii57665;05D1 afii57666;05D2 afii57667;05D3 afii57668;05D4 afii57669;05D5 afii57670;05D6 afii57671;05D7 afii57672;05D8 afii57673;05D9 afii57674;05DA afii57675;05DB afii57676;05DC afii57677;05DD afii57678;05DE afii57679;05DF afii57680;05E0 afii57681;05E1 afii57682;05E2 afii57683;05E3 afii57684;05E4 afii57685;05E5 afii57686;05E6 afii57687;05E7 afii57688;05E8 afii57689;05E9 afii57690;05EA afii57694;FB2A afii57695;FB2B afii57700;FB4B afii57705;FB1F afii57716;05F0 afii57717;05F1 afii57718;05F2 afii57723;FB35 afii57793;05B4 afii57794;05B5 afii57795;05B6 afii57796;05BB afii57797;05B8 afii57798;05B7 afii57799;05B0 afii57800;05B2 afii57801;05B1 afii57802;05B3 afii57803;05C2 afii57804;05C1 afii57806;05B9 afii57807;05BC afii57839;05BD afii57841;05BF afii57842;05C0 afii57929;02BC afii61248;2105 afii61289;2113 afii61352;2116 afii61573;202C afii61574;202D afii61575;202E afii61664;200C afii63167;066D afii64937;02BD agrave;00E0 agujarati;0A85 agurmukhi;0A05 ahiragana;3042 ahookabove;1EA3 aibengali;0990 aibopomofo;311E aideva;0910 aiecyrillic;04D5 aigujarati;0A90 aigurmukhi;0A10 aimatragurmukhi;0A48 ainarabic;0639 ainfinalarabic;FECA aininitialarabic;FECB ainmedialarabic;FECC ainvertedbreve;0203 aivowelsignbengali;09C8 aivowelsigndeva;0948 aivowelsigngujarati;0AC8 akatakana;30A2 akatakanahalfwidth;FF71 akorean;314F alef;05D0 alefarabic;0627 alefdageshhebrew;FB30 aleffinalarabic;FE8E alefhamzaabovearabic;0623 alefhamzaabovefinalarabic;FE84 alefhamzabelowarabic;0625 alefhamzabelowfinalarabic;FE88 alefhebrew;05D0 aleflamedhebrew;FB4F alefmaddaabovearabic;0622 alefmaddaabovefinalarabic;FE82 alefmaksuraarabic;0649 alefmaksurafinalarabic;FEF0 alefmaksurainitialarabic;FEF3 alefmaksuramedialarabic;FEF4 alefpatahhebrew;FB2E alefqamatshebrew;FB2F aleph;2135 allequal;224C alpha;03B1 alphatonos;03AC amacron;0101 amonospace;FF41 ampersand;0026 ampersandmonospace;FF06 ampersandsmall;F726 amsquare;33C2 anbopomofo;3122 angbopomofo;3124 angkhankhuthai;0E5A angle;2220 anglebracketleft;3008 anglebracketleftvertical;FE3F anglebracketright;3009 anglebracketrightvertical;FE40 angleleft;2329 angleright;232A angstrom;212B anoteleia;0387 anudattadeva;0952 anusvarabengali;0982 anusvaradeva;0902 anusvaragujarati;0A82 aogonek;0105 apaatosquare;3300 aparen;249C apostrophearmenian;055A apostrophemod;02BC apple;F8FF approaches;2250 approxequal;2248 approxequalorimage;2252 approximatelyequal;2245 araeaekorean;318E araeakorean;318D arc;2312 arighthalfring;1E9A aring;00E5 aringacute;01FB aringbelow;1E01 arrowboth;2194 arrowdashdown;21E3 arrowdashleft;21E0 arrowdashright;21E2 arrowdashup;21E1 arrowdblboth;21D4 arrowdbldown;21D3 arrowdblleft;21D0 arrowdblright;21D2 arrowdblup;21D1 arrowdown;2193 arrowdownleft;2199 arrowdownright;2198 arrowdownwhite;21E9 arrowheaddownmod;02C5 arrowheadleftmod;02C2 arrowheadrightmod;02C3 arrowheadupmod;02C4 arrowhorizex;F8E7 arrowleft;2190 arrowleftdbl;21D0 arrowleftdblstroke;21CD arrowleftoverright;21C6 arrowleftwhite;21E6 arrowright;2192 arrowrightdblstroke;21CF arrowrightheavy;279E arrowrightoverleft;21C4 arrowrightwhite;21E8 arrowtableft;21E4 arrowtabright;21E5 arrowup;2191 arrowupdn;2195 arrowupdnbse;21A8 arrowupdownbase;21A8 arrowupleft;2196 arrowupleftofdown;21C5 arrowupright;2197 arrowupwhite;21E7 arrowvertex;F8E6 asciicircum;005E asciicircummonospace;FF3E asciitilde;007E asciitildemonospace;FF5E ascript;0251 ascriptturned;0252 asmallhiragana;3041 asmallkatakana;30A1 asmallkatakanahalfwidth;FF67 asterisk;002A asteriskaltonearabic;066D asteriskarabic;066D asteriskmath;2217 asteriskmonospace;FF0A asterisksmall;FE61 asterism;2042 asuperior;F6E9 asymptoticallyequal;2243 at;0040 atilde;00E3 atmonospace;FF20 atsmall;FE6B aturned;0250 aubengali;0994 aubopomofo;3120 audeva;0914 augujarati;0A94 augurmukhi;0A14 aulengthmarkbengali;09D7 aumatragurmukhi;0A4C auvowelsignbengali;09CC auvowelsigndeva;094C auvowelsigngujarati;0ACC avagrahadeva;093D aybarmenian;0561 ayin;05E2 ayinaltonehebrew;FB20 ayinhebrew;05E2 b;0062 babengali;09AC backslash;005C backslashmonospace;FF3C badeva;092C bagujarati;0AAC bagurmukhi;0A2C bahiragana;3070 bahtthai;0E3F bakatakana;30D0 bar;007C barmonospace;FF5C bbopomofo;3105 bcircle;24D1 bdotaccent;1E03 bdotbelow;1E05 beamedsixteenthnotes;266C because;2235 becyrillic;0431 beharabic;0628 behfinalarabic;FE90 behinitialarabic;FE91 behiragana;3079 behmedialarabic;FE92 behmeeminitialarabic;FC9F behmeemisolatedarabic;FC08 behnoonfinalarabic;FC6D bekatakana;30D9 benarmenian;0562 bet;05D1 beta;03B2 betasymbolgreek;03D0 betdagesh;FB31 betdageshhebrew;FB31 bethebrew;05D1 betrafehebrew;FB4C bhabengali;09AD bhadeva;092D bhagujarati;0AAD bhagurmukhi;0A2D bhook;0253 bihiragana;3073 bikatakana;30D3 bilabialclick;0298 bindigurmukhi;0A02 birusquare;3331 blackcircle;25CF blackdiamond;25C6 blackdownpointingtriangle;25BC blackleftpointingpointer;25C4 blackleftpointingtriangle;25C0 blacklenticularbracketleft;3010 blacklenticularbracketleftvertical;FE3B blacklenticularbracketright;3011 blacklenticularbracketrightvertical;FE3C blacklowerlefttriangle;25E3 blacklowerrighttriangle;25E2 blackrectangle;25AC blackrightpointingpointer;25BA blackrightpointingtriangle;25B6 blacksmallsquare;25AA blacksmilingface;263B blacksquare;25A0 blackstar;2605 blackupperlefttriangle;25E4 blackupperrighttriangle;25E5 blackuppointingsmalltriangle;25B4 blackuppointingtriangle;25B2 blank;2423 blinebelow;1E07 block;2588 bmonospace;FF42 bobaimaithai;0E1A bohiragana;307C bokatakana;30DC bparen;249D bqsquare;33C3 braceex;F8F4 braceleft;007B braceleftbt;F8F3 braceleftmid;F8F2 braceleftmonospace;FF5B braceleftsmall;FE5B bracelefttp;F8F1 braceleftvertical;FE37 braceright;007D bracerightbt;F8FE bracerightmid;F8FD bracerightmonospace;FF5D bracerightsmall;FE5C bracerighttp;F8FC bracerightvertical;FE38 bracketleft;005B bracketleftbt;F8F0 bracketleftex;F8EF bracketleftmonospace;FF3B bracketlefttp;F8EE bracketright;005D bracketrightbt;F8FB bracketrightex;F8FA bracketrightmonospace;FF3D bracketrighttp;F8F9 breve;02D8 brevebelowcmb;032E brevecmb;0306 breveinvertedbelowcmb;032F breveinvertedcmb;0311 breveinverteddoublecmb;0361 bridgebelowcmb;032A bridgeinvertedbelowcmb;033A brokenbar;00A6 bstroke;0180 bsuperior;F6EA btopbar;0183 buhiragana;3076 bukatakana;30D6 bullet;2022 bulletinverse;25D8 bulletoperator;2219 bullseye;25CE c;0063 caarmenian;056E cabengali;099A cacute;0107 cadeva;091A cagujarati;0A9A cagurmukhi;0A1A calsquare;3388 candrabindubengali;0981 candrabinducmb;0310 candrabindudeva;0901 candrabindugujarati;0A81 capslock;21EA careof;2105 caron;02C7 caronbelowcmb;032C caroncmb;030C carriagereturn;21B5 cbopomofo;3118 ccaron;010D ccedilla;00E7 ccedillaacute;1E09 ccircle;24D2 ccircumflex;0109 ccurl;0255 cdot;010B cdotaccent;010B cdsquare;33C5 cedilla;00B8 cedillacmb;0327 cent;00A2 centigrade;2103 centinferior;F6DF centmonospace;FFE0 centoldstyle;F7A2 centsuperior;F6E0 chaarmenian;0579 chabengali;099B chadeva;091B chagujarati;0A9B chagurmukhi;0A1B chbopomofo;3114 cheabkhasiancyrillic;04BD checkmark;2713 checyrillic;0447 chedescenderabkhasiancyrillic;04BF chedescendercyrillic;04B7 chedieresiscyrillic;04F5 cheharmenian;0573 chekhakassiancyrillic;04CC cheverticalstrokecyrillic;04B9 chi;03C7 chieuchacirclekorean;3277 chieuchaparenkorean;3217 chieuchcirclekorean;3269 chieuchkorean;314A chieuchparenkorean;3209 chochangthai;0E0A chochanthai;0E08 chochingthai;0E09 chochoethai;0E0C chook;0188 cieucacirclekorean;3276 cieucaparenkorean;3216 cieuccirclekorean;3268 cieuckorean;3148 cieucparenkorean;3208 cieucuparenkorean;321C circle;25CB circlemultiply;2297 circleot;2299 circleplus;2295 circlepostalmark;3036 circlewithlefthalfblack;25D0 circlewithrighthalfblack;25D1 circumflex;02C6 circumflexbelowcmb;032D circumflexcmb;0302 clear;2327 clickalveolar;01C2 clickdental;01C0 clicklateral;01C1 clickretroflex;01C3 club;2663 clubsuitblack;2663 clubsuitwhite;2667 cmcubedsquare;33A4 cmonospace;FF43 cmsquaredsquare;33A0 coarmenian;0581 colon;003A colonmonetary;20A1 colonmonospace;FF1A colonsign;20A1 colonsmall;FE55 colontriangularhalfmod;02D1 colontriangularmod;02D0 comma;002C commaabovecmb;0313 commaaboverightcmb;0315 commaaccent;F6C3 commaarabic;060C commaarmenian;055D commainferior;F6E1 commamonospace;FF0C commareversedabovecmb;0314 commareversedmod;02BD commasmall;FE50 commasuperior;F6E2 commaturnedabovecmb;0312 commaturnedmod;02BB compass;263C congruent;2245 contourintegral;222E control;2303 controlACK;0006 controlBEL;0007 controlBS;0008 controlCAN;0018 controlCR;000D controlDC1;0011 controlDC2;0012 controlDC3;0013 controlDC4;0014 controlDEL;007F controlDLE;0010 controlEM;0019 controlENQ;0005 controlEOT;0004 controlESC;001B controlETB;0017 controlETX;0003 controlFF;000C controlFS;001C controlGS;001D controlHT;0009 controlLF;000A controlNAK;0015 controlRS;001E controlSI;000F controlSO;000E controlSOT;0002 controlSTX;0001 controlSUB;001A controlSYN;0016 controlUS;001F controlVT;000B copyright;00A9 copyrightsans;F8E9 copyrightserif;F6D9 cornerbracketleft;300C cornerbracketlefthalfwidth;FF62 cornerbracketleftvertical;FE41 cornerbracketright;300D cornerbracketrighthalfwidth;FF63 cornerbracketrightvertical;FE42 corporationsquare;337F cosquare;33C7 coverkgsquare;33C6 cparen;249E cruzeiro;20A2 cstretched;0297 curlyand;22CF curlyor;22CE currency;00A4 cyrBreve;F6D1 cyrFlex;F6D2 cyrbreve;F6D4 cyrflex;F6D5 d;0064 daarmenian;0564 dabengali;09A6 dadarabic;0636 dadeva;0926 dadfinalarabic;FEBE dadinitialarabic;FEBF dadmedialarabic;FEC0 dagesh;05BC dageshhebrew;05BC dagger;2020 daggerdbl;2021 dagujarati;0AA6 dagurmukhi;0A26 dahiragana;3060 dakatakana;30C0 dalarabic;062F dalet;05D3 daletdagesh;FB33 daletdageshhebrew;FB33 dalethatafpatah;05D3 05B2 dalethatafpatahhebrew;05D3 05B2 dalethatafsegol;05D3 05B1 dalethatafsegolhebrew;05D3 05B1 dalethebrew;05D3 dalethiriq;05D3 05B4 dalethiriqhebrew;05D3 05B4 daletholam;05D3 05B9 daletholamhebrew;05D3 05B9 daletpatah;05D3 05B7 daletpatahhebrew;05D3 05B7 daletqamats;05D3 05B8 daletqamatshebrew;05D3 05B8 daletqubuts;05D3 05BB daletqubutshebrew;05D3 05BB daletsegol;05D3 05B6 daletsegolhebrew;05D3 05B6 daletsheva;05D3 05B0 daletshevahebrew;05D3 05B0 dalettsere;05D3 05B5 dalettserehebrew;05D3 05B5 dalfinalarabic;FEAA dammaarabic;064F dammalowarabic;064F dammatanaltonearabic;064C dammatanarabic;064C danda;0964 dargahebrew;05A7 dargalefthebrew;05A7 dasiapneumatacyrilliccmb;0485 dblGrave;F6D3 dblanglebracketleft;300A dblanglebracketleftvertical;FE3D dblanglebracketright;300B dblanglebracketrightvertical;FE3E dblarchinvertedbelowcmb;032B dblarrowleft;21D4 dblarrowright;21D2 dbldanda;0965 dblgrave;F6D6 dblgravecmb;030F dblintegral;222C dbllowline;2017 dbllowlinecmb;0333 dbloverlinecmb;033F dblprimemod;02BA dblverticalbar;2016 dblverticallineabovecmb;030E dbopomofo;3109 dbsquare;33C8 dcaron;010F dcedilla;1E11 dcircle;24D3 dcircumflexbelow;1E13 dcroat;0111 ddabengali;09A1 ddadeva;0921 ddagujarati;0AA1 ddagurmukhi;0A21 ddalarabic;0688 ddalfinalarabic;FB89 dddhadeva;095C ddhabengali;09A2 ddhadeva;0922 ddhagujarati;0AA2 ddhagurmukhi;0A22 ddotaccent;1E0B ddotbelow;1E0D decimalseparatorarabic;066B decimalseparatorpersian;066B decyrillic;0434 degree;00B0 dehihebrew;05AD dehiragana;3067 deicoptic;03EF dekatakana;30C7 deleteleft;232B deleteright;2326 delta;03B4 deltaturned;018D denominatorminusonenumeratorbengali;09F8 dezh;02A4 dhabengali;09A7 dhadeva;0927 dhagujarati;0AA7 dhagurmukhi;0A27 dhook;0257 dialytikatonos;0385 dialytikatonoscmb;0344 diamond;2666 diamondsuitwhite;2662 dieresis;00A8 dieresisacute;F6D7 dieresisbelowcmb;0324 dieresiscmb;0308 dieresisgrave;F6D8 dieresistonos;0385 dihiragana;3062 dikatakana;30C2 dittomark;3003 divide;00F7 divides;2223 divisionslash;2215 djecyrillic;0452 dkshade;2593 dlinebelow;1E0F dlsquare;3397 dmacron;0111 dmonospace;FF44 dnblock;2584 dochadathai;0E0E dodekthai;0E14 dohiragana;3069 dokatakana;30C9 dollar;0024 dollarinferior;F6E3 dollarmonospace;FF04 dollaroldstyle;F724 dollarsmall;FE69 dollarsuperior;F6E4 dong;20AB dorusquare;3326 dotaccent;02D9 dotaccentcmb;0307 dotbelowcmb;0323 dotbelowcomb;0323 dotkatakana;30FB dotlessi;0131 dotlessj;F6BE dotlessjstrokehook;0284 dotmath;22C5 dottedcircle;25CC doubleyodpatah;FB1F doubleyodpatahhebrew;FB1F downtackbelowcmb;031E downtackmod;02D5 dparen;249F dsuperior;F6EB dtail;0256 dtopbar;018C duhiragana;3065 dukatakana;30C5 dz;01F3 dzaltone;02A3 dzcaron;01C6 dzcurl;02A5 dzeabkhasiancyrillic;04E1 dzecyrillic;0455 dzhecyrillic;045F e;0065 eacute;00E9 earth;2641 ebengali;098F ebopomofo;311C ebreve;0115 ecandradeva;090D ecandragujarati;0A8D ecandravowelsigndeva;0945 ecandravowelsigngujarati;0AC5 ecaron;011B ecedillabreve;1E1D echarmenian;0565 echyiwnarmenian;0587 ecircle;24D4 ecircumflex;00EA ecircumflexacute;1EBF ecircumflexbelow;1E19 ecircumflexdotbelow;1EC7 ecircumflexgrave;1EC1 ecircumflexhookabove;1EC3 ecircumflextilde;1EC5 ecyrillic;0454 edblgrave;0205 edeva;090F edieresis;00EB edot;0117 edotaccent;0117 edotbelow;1EB9 eegurmukhi;0A0F eematragurmukhi;0A47 efcyrillic;0444 egrave;00E8 egujarati;0A8F eharmenian;0567 ehbopomofo;311D ehiragana;3048 ehookabove;1EBB eibopomofo;311F eight;0038 eightarabic;0668 eightbengali;09EE eightcircle;2467 eightcircleinversesansserif;2791 eightdeva;096E eighteencircle;2471 eighteenparen;2485 eighteenperiod;2499 eightgujarati;0AEE eightgurmukhi;0A6E eighthackarabic;0668 eighthangzhou;3028 eighthnotebeamed;266B eightideographicparen;3227 eightinferior;2088 eightmonospace;FF18 eightoldstyle;F738 eightparen;247B eightperiod;248F eightpersian;06F8 eightroman;2177 eightsuperior;2078 eightthai;0E58 einvertedbreve;0207 eiotifiedcyrillic;0465 ekatakana;30A8 ekatakanahalfwidth;FF74 ekonkargurmukhi;0A74 ekorean;3154 elcyrillic;043B element;2208 elevencircle;246A elevenparen;247E elevenperiod;2492 elevenroman;217A ellipsis;2026 ellipsisvertical;22EE emacron;0113 emacronacute;1E17 emacrongrave;1E15 emcyrillic;043C emdash;2014 emdashvertical;FE31 emonospace;FF45 emphasismarkarmenian;055B emptyset;2205 enbopomofo;3123 encyrillic;043D endash;2013 endashvertical;FE32 endescendercyrillic;04A3 eng;014B engbopomofo;3125 enghecyrillic;04A5 enhookcyrillic;04C8 enspace;2002 eogonek;0119 eokorean;3153 eopen;025B eopenclosed;029A eopenreversed;025C eopenreversedclosed;025E eopenreversedhook;025D eparen;24A0 epsilon;03B5 epsilontonos;03AD equal;003D equalmonospace;FF1D equalsmall;FE66 equalsuperior;207C equivalence;2261 erbopomofo;3126 ercyrillic;0440 ereversed;0258 ereversedcyrillic;044D escyrillic;0441 esdescendercyrillic;04AB esh;0283 eshcurl;0286 eshortdeva;090E eshortvowelsigndeva;0946 eshreversedloop;01AA eshsquatreversed;0285 esmallhiragana;3047 esmallkatakana;30A7 esmallkatakanahalfwidth;FF6A estimated;212E esuperior;F6EC eta;03B7 etarmenian;0568 etatonos;03AE eth;00F0 etilde;1EBD etildebelow;1E1B etnahtafoukhhebrew;0591 etnahtafoukhlefthebrew;0591 etnahtahebrew;0591 etnahtalefthebrew;0591 eturned;01DD eukorean;3161 euro;20AC evowelsignbengali;09C7 evowelsigndeva;0947 evowelsigngujarati;0AC7 exclam;0021 exclamarmenian;055C exclamdbl;203C exclamdown;00A1 exclamdownsmall;F7A1 exclammonospace;FF01 exclamsmall;F721 existential;2203 ezh;0292 ezhcaron;01EF ezhcurl;0293 ezhreversed;01B9 ezhtail;01BA f;0066 fadeva;095E fagurmukhi;0A5E fahrenheit;2109 fathaarabic;064E fathalowarabic;064E fathatanarabic;064B fbopomofo;3108 fcircle;24D5 fdotaccent;1E1F feharabic;0641 feharmenian;0586 fehfinalarabic;FED2 fehinitialarabic;FED3 fehmedialarabic;FED4 feicoptic;03E5 female;2640 ff;FB00 ffi;FB03 ffl;FB04 fi;FB01 fifteencircle;246E fifteenparen;2482 fifteenperiod;2496 figuredash;2012 filledbox;25A0 filledrect;25AC finalkaf;05DA finalkafdagesh;FB3A finalkafdageshhebrew;FB3A finalkafhebrew;05DA finalkafqamats;05DA 05B8 finalkafqamatshebrew;05DA 05B8 finalkafsheva;05DA 05B0 finalkafshevahebrew;05DA 05B0 finalmem;05DD finalmemhebrew;05DD finalnun;05DF finalnunhebrew;05DF finalpe;05E3 finalpehebrew;05E3 finaltsadi;05E5 finaltsadihebrew;05E5 firsttonechinese;02C9 fisheye;25C9 fitacyrillic;0473 five;0035 fivearabic;0665 fivebengali;09EB fivecircle;2464 fivecircleinversesansserif;278E fivedeva;096B fiveeighths;215D fivegujarati;0AEB fivegurmukhi;0A6B fivehackarabic;0665 fivehangzhou;3025 fiveideographicparen;3224 fiveinferior;2085 fivemonospace;FF15 fiveoldstyle;F735 fiveparen;2478 fiveperiod;248C fivepersian;06F5 fiveroman;2174 fivesuperior;2075 fivethai;0E55 fl;FB02 florin;0192 fmonospace;FF46 fmsquare;3399 fofanthai;0E1F fofathai;0E1D fongmanthai;0E4F forall;2200 four;0034 fourarabic;0664 fourbengali;09EA fourcircle;2463 fourcircleinversesansserif;278D fourdeva;096A fourgujarati;0AEA fourgurmukhi;0A6A fourhackarabic;0664 fourhangzhou;3024 fourideographicparen;3223 fourinferior;2084 fourmonospace;FF14 fournumeratorbengali;09F7 fouroldstyle;F734 fourparen;2477 fourperiod;248B fourpersian;06F4 fourroman;2173 foursuperior;2074 fourteencircle;246D fourteenparen;2481 fourteenperiod;2495 fourthai;0E54 fourthtonechinese;02CB fparen;24A1 fraction;2044 franc;20A3 g;0067 gabengali;0997 gacute;01F5 gadeva;0917 gafarabic;06AF gaffinalarabic;FB93 gafinitialarabic;FB94 gafmedialarabic;FB95 gagujarati;0A97 gagurmukhi;0A17 gahiragana;304C gakatakana;30AC gamma;03B3 gammalatinsmall;0263 gammasuperior;02E0 gangiacoptic;03EB gbopomofo;310D gbreve;011F gcaron;01E7 gcedilla;0123 gcircle;24D6 gcircumflex;011D gcommaaccent;0123 gdot;0121 gdotaccent;0121 gecyrillic;0433 gehiragana;3052 gekatakana;30B2 geometricallyequal;2251 gereshaccenthebrew;059C gereshhebrew;05F3 gereshmuqdamhebrew;059D germandbls;00DF gershayimaccenthebrew;059E gershayimhebrew;05F4 getamark;3013 ghabengali;0998 ghadarmenian;0572 ghadeva;0918 ghagujarati;0A98 ghagurmukhi;0A18 ghainarabic;063A ghainfinalarabic;FECE ghaininitialarabic;FECF ghainmedialarabic;FED0 ghemiddlehookcyrillic;0495 ghestrokecyrillic;0493 gheupturncyrillic;0491 ghhadeva;095A ghhagurmukhi;0A5A ghook;0260 ghzsquare;3393 gihiragana;304E gikatakana;30AE gimarmenian;0563 gimel;05D2 gimeldagesh;FB32 gimeldageshhebrew;FB32 gimelhebrew;05D2 gjecyrillic;0453 glottalinvertedstroke;01BE glottalstop;0294 glottalstopinverted;0296 glottalstopmod;02C0 glottalstopreversed;0295 glottalstopreversedmod;02C1 glottalstopreversedsuperior;02E4 glottalstopstroke;02A1 glottalstopstrokereversed;02A2 gmacron;1E21 gmonospace;FF47 gohiragana;3054 gokatakana;30B4 gparen;24A2 gpasquare;33AC gradient;2207 grave;0060 gravebelowcmb;0316 gravecmb;0300 gravecomb;0300 gravedeva;0953 gravelowmod;02CE gravemonospace;FF40 gravetonecmb;0340 greater;003E greaterequal;2265 greaterequalorless;22DB greatermonospace;FF1E greaterorequivalent;2273 greaterorless;2277 greateroverequal;2267 greatersmall;FE65 gscript;0261 gstroke;01E5 guhiragana;3050 guillemotleft;00AB guillemotright;00BB guilsinglleft;2039 guilsinglright;203A gukatakana;30B0 guramusquare;3318 gysquare;33C9 h;0068 haabkhasiancyrillic;04A9 haaltonearabic;06C1 habengali;09B9 hadescendercyrillic;04B3 hadeva;0939 hagujarati;0AB9 hagurmukhi;0A39 haharabic;062D hahfinalarabic;FEA2 hahinitialarabic;FEA3 hahiragana;306F hahmedialarabic;FEA4 haitusquare;332A hakatakana;30CF hakatakanahalfwidth;FF8A halantgurmukhi;0A4D hamzaarabic;0621 hamzadammaarabic;0621 064F hamzadammatanarabic;0621 064C hamzafathaarabic;0621 064E hamzafathatanarabic;0621 064B hamzalowarabic;0621 hamzalowkasraarabic;0621 0650 hamzalowkasratanarabic;0621 064D hamzasukunarabic;0621 0652 hangulfiller;3164 hardsigncyrillic;044A harpoonleftbarbup;21BC harpoonrightbarbup;21C0 hasquare;33CA hatafpatah;05B2 hatafpatah16;05B2 hatafpatah23;05B2 hatafpatah2f;05B2 hatafpatahhebrew;05B2 hatafpatahnarrowhebrew;05B2 hatafpatahquarterhebrew;05B2 hatafpatahwidehebrew;05B2 hatafqamats;05B3 hatafqamats1b;05B3 hatafqamats28;05B3 hatafqamats34;05B3 hatafqamatshebrew;05B3 hatafqamatsnarrowhebrew;05B3 hatafqamatsquarterhebrew;05B3 hatafqamatswidehebrew;05B3 hatafsegol;05B1 hatafsegol17;05B1 hatafsegol24;05B1 hatafsegol30;05B1 hatafsegolhebrew;05B1 hatafsegolnarrowhebrew;05B1 hatafsegolquarterhebrew;05B1 hatafsegolwidehebrew;05B1 hbar;0127 hbopomofo;310F hbrevebelow;1E2B hcedilla;1E29 hcircle;24D7 hcircumflex;0125 hdieresis;1E27 hdotaccent;1E23 hdotbelow;1E25 he;05D4 heart;2665 heartsuitblack;2665 heartsuitwhite;2661 hedagesh;FB34 hedageshhebrew;FB34 hehaltonearabic;06C1 heharabic;0647 hehebrew;05D4 hehfinalaltonearabic;FBA7 hehfinalalttwoarabic;FEEA hehfinalarabic;FEEA hehhamzaabovefinalarabic;FBA5 hehhamzaaboveisolatedarabic;FBA4 hehinitialaltonearabic;FBA8 hehinitialarabic;FEEB hehiragana;3078 hehmedialaltonearabic;FBA9 hehmedialarabic;FEEC heiseierasquare;337B hekatakana;30D8 hekatakanahalfwidth;FF8D hekutaarusquare;3336 henghook;0267 herutusquare;3339 het;05D7 hethebrew;05D7 hhook;0266 hhooksuperior;02B1 hieuhacirclekorean;327B hieuhaparenkorean;321B hieuhcirclekorean;326D hieuhkorean;314E hieuhparenkorean;320D hihiragana;3072 hikatakana;30D2 hikatakanahalfwidth;FF8B hiriq;05B4 hiriq14;05B4 hiriq21;05B4 hiriq2d;05B4 hiriqhebrew;05B4 hiriqnarrowhebrew;05B4 hiriqquarterhebrew;05B4 hiriqwidehebrew;05B4 hlinebelow;1E96 hmonospace;FF48 hoarmenian;0570 hohipthai;0E2B hohiragana;307B hokatakana;30DB hokatakanahalfwidth;FF8E holam;05B9 holam19;05B9 holam26;05B9 holam32;05B9 holamhebrew;05B9 holamnarrowhebrew;05B9 holamquarterhebrew;05B9 holamwidehebrew;05B9 honokhukthai;0E2E hookabovecomb;0309 hookcmb;0309 hookpalatalizedbelowcmb;0321 hookretroflexbelowcmb;0322 hoonsquare;3342 horicoptic;03E9 horizontalbar;2015 horncmb;031B hotsprings;2668 house;2302 hparen;24A3 hsuperior;02B0 hturned;0265 huhiragana;3075 huiitosquare;3333 hukatakana;30D5 hukatakanahalfwidth;FF8C hungarumlaut;02DD hungarumlautcmb;030B hv;0195 hyphen;002D hypheninferior;F6E5 hyphenmonospace;FF0D hyphensmall;FE63 hyphensuperior;F6E6 hyphentwo;2010 i;0069 iacute;00ED iacyrillic;044F ibengali;0987 ibopomofo;3127 ibreve;012D icaron;01D0 icircle;24D8 icircumflex;00EE icyrillic;0456 idblgrave;0209 ideographearthcircle;328F ideographfirecircle;328B ideographicallianceparen;323F ideographiccallparen;323A ideographiccentrecircle;32A5 ideographicclose;3006 ideographiccomma;3001 ideographiccommaleft;FF64 ideographiccongratulationparen;3237 ideographiccorrectcircle;32A3 ideographicearthparen;322F ideographicenterpriseparen;323D ideographicexcellentcircle;329D ideographicfestivalparen;3240 ideographicfinancialcircle;3296 ideographicfinancialparen;3236 ideographicfireparen;322B ideographichaveparen;3232 ideographichighcircle;32A4 ideographiciterationmark;3005 ideographiclaborcircle;3298 ideographiclaborparen;3238 ideographicleftcircle;32A7 ideographiclowcircle;32A6 ideographicmedicinecircle;32A9 ideographicmetalparen;322E ideographicmoonparen;322A ideographicnameparen;3234 ideographicperiod;3002 ideographicprintcircle;329E ideographicreachparen;3243 ideographicrepresentparen;3239 ideographicresourceparen;323E ideographicrightcircle;32A8 ideographicsecretcircle;3299 ideographicselfparen;3242 ideographicsocietyparen;3233 ideographicspace;3000 ideographicspecialparen;3235 ideographicstockparen;3231 ideographicstudyparen;323B ideographicsunparen;3230 ideographicsuperviseparen;323C ideographicwaterparen;322C ideographicwoodparen;322D ideographiczero;3007 ideographmetalcircle;328E ideographmooncircle;328A ideographnamecircle;3294 ideographsuncircle;3290 ideographwatercircle;328C ideographwoodcircle;328D ideva;0907 idieresis;00EF idieresisacute;1E2F idieresiscyrillic;04E5 idotbelow;1ECB iebrevecyrillic;04D7 iecyrillic;0435 ieungacirclekorean;3275 ieungaparenkorean;3215 ieungcirclekorean;3267 ieungkorean;3147 ieungparenkorean;3207 igrave;00EC igujarati;0A87 igurmukhi;0A07 ihiragana;3044 ihookabove;1EC9 iibengali;0988 iicyrillic;0438 iideva;0908 iigujarati;0A88 iigurmukhi;0A08 iimatragurmukhi;0A40 iinvertedbreve;020B iishortcyrillic;0439 iivowelsignbengali;09C0 iivowelsigndeva;0940 iivowelsigngujarati;0AC0 ij;0133 ikatakana;30A4 ikatakanahalfwidth;FF72 ikorean;3163 ilde;02DC iluyhebrew;05AC imacron;012B imacroncyrillic;04E3 imageorapproximatelyequal;2253 imatragurmukhi;0A3F imonospace;FF49 increment;2206 infinity;221E iniarmenian;056B integral;222B integralbottom;2321 integralbt;2321 integralex;F8F5 integraltop;2320 integraltp;2320 intersection;2229 intisquare;3305 invbullet;25D8 invcircle;25D9 invsmileface;263B iocyrillic;0451 iogonek;012F iota;03B9 iotadieresis;03CA iotadieresistonos;0390 iotalatin;0269 iotatonos;03AF iparen;24A4 irigurmukhi;0A72 ismallhiragana;3043 ismallkatakana;30A3 ismallkatakanahalfwidth;FF68 issharbengali;09FA istroke;0268 isuperior;F6ED iterationhiragana;309D iterationkatakana;30FD itilde;0129 itildebelow;1E2D iubopomofo;3129 iucyrillic;044E ivowelsignbengali;09BF ivowelsigndeva;093F ivowelsigngujarati;0ABF izhitsacyrillic;0475 izhitsadblgravecyrillic;0477 j;006A jaarmenian;0571 jabengali;099C jadeva;091C jagujarati;0A9C jagurmukhi;0A1C jbopomofo;3110 jcaron;01F0 jcircle;24D9 jcircumflex;0135 jcrossedtail;029D jdotlessstroke;025F jecyrillic;0458 jeemarabic;062C jeemfinalarabic;FE9E jeeminitialarabic;FE9F jeemmedialarabic;FEA0 jeharabic;0698 jehfinalarabic;FB8B jhabengali;099D jhadeva;091D jhagujarati;0A9D jhagurmukhi;0A1D jheharmenian;057B jis;3004 jmonospace;FF4A jparen;24A5 jsuperior;02B2 k;006B kabashkircyrillic;04A1 kabengali;0995 kacute;1E31 kacyrillic;043A kadescendercyrillic;049B kadeva;0915 kaf;05DB kafarabic;0643 kafdagesh;FB3B kafdageshhebrew;FB3B kaffinalarabic;FEDA kafhebrew;05DB kafinitialarabic;FEDB kafmedialarabic;FEDC kafrafehebrew;FB4D kagujarati;0A95 kagurmukhi;0A15 kahiragana;304B kahookcyrillic;04C4 kakatakana;30AB kakatakanahalfwidth;FF76 kappa;03BA kappasymbolgreek;03F0 kapyeounmieumkorean;3171 kapyeounphieuphkorean;3184 kapyeounpieupkorean;3178 kapyeounssangpieupkorean;3179 karoriisquare;330D kashidaautoarabic;0640 kashidaautonosidebearingarabic;0640 kasmallkatakana;30F5 kasquare;3384 kasraarabic;0650 kasratanarabic;064D kastrokecyrillic;049F katahiraprolongmarkhalfwidth;FF70 kaverticalstrokecyrillic;049D kbopomofo;310E kcalsquare;3389 kcaron;01E9 kcedilla;0137 kcircle;24DA kcommaaccent;0137 kdotbelow;1E33 keharmenian;0584 kehiragana;3051 kekatakana;30B1 kekatakanahalfwidth;FF79 kenarmenian;056F kesmallkatakana;30F6 kgreenlandic;0138 khabengali;0996 khacyrillic;0445 khadeva;0916 khagujarati;0A96 khagurmukhi;0A16 khaharabic;062E khahfinalarabic;FEA6 khahinitialarabic;FEA7 khahmedialarabic;FEA8 kheicoptic;03E7 khhadeva;0959 khhagurmukhi;0A59 khieukhacirclekorean;3278 khieukhaparenkorean;3218 khieukhcirclekorean;326A khieukhkorean;314B khieukhparenkorean;320A khokhaithai;0E02 khokhonthai;0E05 khokhuatthai;0E03 khokhwaithai;0E04 khomutthai;0E5B khook;0199 khorakhangthai;0E06 khzsquare;3391 kihiragana;304D kikatakana;30AD kikatakanahalfwidth;FF77 kiroguramusquare;3315 kiromeetorusquare;3316 kirosquare;3314 kiyeokacirclekorean;326E kiyeokaparenkorean;320E kiyeokcirclekorean;3260 kiyeokkorean;3131 kiyeokparenkorean;3200 kiyeoksioskorean;3133 kjecyrillic;045C klinebelow;1E35 klsquare;3398 kmcubedsquare;33A6 kmonospace;FF4B kmsquaredsquare;33A2 kohiragana;3053 kohmsquare;33C0 kokaithai;0E01 kokatakana;30B3 kokatakanahalfwidth;FF7A kooposquare;331E koppacyrillic;0481 koreanstandardsymbol;327F koroniscmb;0343 kparen;24A6 kpasquare;33AA ksicyrillic;046F ktsquare;33CF kturned;029E kuhiragana;304F kukatakana;30AF kukatakanahalfwidth;FF78 kvsquare;33B8 kwsquare;33BE l;006C labengali;09B2 lacute;013A ladeva;0932 lagujarati;0AB2 lagurmukhi;0A32 lakkhangyaothai;0E45 lamaleffinalarabic;FEFC lamalefhamzaabovefinalarabic;FEF8 lamalefhamzaaboveisolatedarabic;FEF7 lamalefhamzabelowfinalarabic;FEFA lamalefhamzabelowisolatedarabic;FEF9 lamalefisolatedarabic;FEFB lamalefmaddaabovefinalarabic;FEF6 lamalefmaddaaboveisolatedarabic;FEF5 lamarabic;0644 lambda;03BB lambdastroke;019B lamed;05DC lameddagesh;FB3C lameddageshhebrew;FB3C lamedhebrew;05DC lamedholam;05DC 05B9 lamedholamdagesh;05DC 05B9 05BC lamedholamdageshhebrew;05DC 05B9 05BC lamedholamhebrew;05DC 05B9 lamfinalarabic;FEDE lamhahinitialarabic;FCCA laminitialarabic;FEDF lamjeeminitialarabic;FCC9 lamkhahinitialarabic;FCCB lamlamhehisolatedarabic;FDF2 lammedialarabic;FEE0 lammeemhahinitialarabic;FD88 lammeeminitialarabic;FCCC lammeemjeeminitialarabic;FEDF FEE4 FEA0 lammeemkhahinitialarabic;FEDF FEE4 FEA8 largecircle;25EF lbar;019A lbelt;026C lbopomofo;310C lcaron;013E lcedilla;013C lcircle;24DB lcircumflexbelow;1E3D lcommaaccent;013C ldot;0140 ldotaccent;0140 ldotbelow;1E37 ldotbelowmacron;1E39 leftangleabovecmb;031A lefttackbelowcmb;0318 less;003C lessequal;2264 lessequalorgreater;22DA lessmonospace;FF1C lessorequivalent;2272 lessorgreater;2276 lessoverequal;2266 lesssmall;FE64 lezh;026E lfblock;258C lhookretroflex;026D lira;20A4 liwnarmenian;056C lj;01C9 ljecyrillic;0459 ll;F6C0 lladeva;0933 llagujarati;0AB3 llinebelow;1E3B llladeva;0934 llvocalicbengali;09E1 llvocalicdeva;0961 llvocalicvowelsignbengali;09E3 llvocalicvowelsigndeva;0963 lmiddletilde;026B lmonospace;FF4C lmsquare;33D0 lochulathai;0E2C logicaland;2227 logicalnot;00AC logicalnotreversed;2310 logicalor;2228 lolingthai;0E25 longs;017F lowlinecenterline;FE4E lowlinecmb;0332 lowlinedashed;FE4D lozenge;25CA lparen;24A7 lslash;0142 lsquare;2113 lsuperior;F6EE ltshade;2591 luthai;0E26 lvocalicbengali;098C lvocalicdeva;090C lvocalicvowelsignbengali;09E2 lvocalicvowelsigndeva;0962 lxsquare;33D3 m;006D mabengali;09AE macron;00AF macronbelowcmb;0331 macroncmb;0304 macronlowmod;02CD macronmonospace;FFE3 macute;1E3F madeva;092E magujarati;0AAE magurmukhi;0A2E mahapakhhebrew;05A4 mahapakhlefthebrew;05A4 mahiragana;307E maichattawalowleftthai;F895 maichattawalowrightthai;F894 maichattawathai;0E4B maichattawaupperleftthai;F893 maieklowleftthai;F88C maieklowrightthai;F88B maiekthai;0E48 maiekupperleftthai;F88A maihanakatleftthai;F884 maihanakatthai;0E31 maitaikhuleftthai;F889 maitaikhuthai;0E47 maitholowleftthai;F88F maitholowrightthai;F88E maithothai;0E49 maithoupperleftthai;F88D maitrilowleftthai;F892 maitrilowrightthai;F891 maitrithai;0E4A maitriupperleftthai;F890 maiyamokthai;0E46 makatakana;30DE makatakanahalfwidth;FF8F male;2642 mansyonsquare;3347 maqafhebrew;05BE mars;2642 masoracirclehebrew;05AF masquare;3383 mbopomofo;3107 mbsquare;33D4 mcircle;24DC mcubedsquare;33A5 mdotaccent;1E41 mdotbelow;1E43 meemarabic;0645 meemfinalarabic;FEE2 meeminitialarabic;FEE3 meemmedialarabic;FEE4 meemmeeminitialarabic;FCD1 meemmeemisolatedarabic;FC48 meetorusquare;334D mehiragana;3081 meizierasquare;337E mekatakana;30E1 mekatakanahalfwidth;FF92 mem;05DE memdagesh;FB3E memdageshhebrew;FB3E memhebrew;05DE menarmenian;0574 merkhahebrew;05A5 merkhakefulahebrew;05A6 merkhakefulalefthebrew;05A6 merkhalefthebrew;05A5 mhook;0271 mhzsquare;3392 middledotkatakanahalfwidth;FF65 middot;00B7 mieumacirclekorean;3272 mieumaparenkorean;3212 mieumcirclekorean;3264 mieumkorean;3141 mieumpansioskorean;3170 mieumparenkorean;3204 mieumpieupkorean;316E mieumsioskorean;316F mihiragana;307F mikatakana;30DF mikatakanahalfwidth;FF90 minus;2212 minusbelowcmb;0320 minuscircle;2296 minusmod;02D7 minusplus;2213 minute;2032 miribaarusquare;334A mirisquare;3349 mlonglegturned;0270 mlsquare;3396 mmcubedsquare;33A3 mmonospace;FF4D mmsquaredsquare;339F mohiragana;3082 mohmsquare;33C1 mokatakana;30E2 mokatakanahalfwidth;FF93 molsquare;33D6 momathai;0E21 moverssquare;33A7 moverssquaredsquare;33A8 mparen;24A8 mpasquare;33AB mssquare;33B3 msuperior;F6EF mturned;026F mu;00B5 mu1;00B5 muasquare;3382 muchgreater;226B muchless;226A mufsquare;338C mugreek;03BC mugsquare;338D muhiragana;3080 mukatakana;30E0 mukatakanahalfwidth;FF91 mulsquare;3395 multiply;00D7 mumsquare;339B munahhebrew;05A3 munahlefthebrew;05A3 musicalnote;266A musicalnotedbl;266B musicflatsign;266D musicsharpsign;266F mussquare;33B2 muvsquare;33B6 muwsquare;33BC mvmegasquare;33B9 mvsquare;33B7 mwmegasquare;33BF mwsquare;33BD n;006E nabengali;09A8 nabla;2207 nacute;0144 nadeva;0928 nagujarati;0AA8 nagurmukhi;0A28 nahiragana;306A nakatakana;30CA nakatakanahalfwidth;FF85 napostrophe;0149 nasquare;3381 nbopomofo;310B nbspace;00A0 ncaron;0148 ncedilla;0146 ncircle;24DD ncircumflexbelow;1E4B ncommaaccent;0146 ndotaccent;1E45 ndotbelow;1E47 nehiragana;306D nekatakana;30CD nekatakanahalfwidth;FF88 newsheqelsign;20AA nfsquare;338B ngabengali;0999 ngadeva;0919 ngagujarati;0A99 ngagurmukhi;0A19 ngonguthai;0E07 nhiragana;3093 nhookleft;0272 nhookretroflex;0273 nieunacirclekorean;326F nieunaparenkorean;320F nieuncieuckorean;3135 nieuncirclekorean;3261 nieunhieuhkorean;3136 nieunkorean;3134 nieunpansioskorean;3168 nieunparenkorean;3201 nieunsioskorean;3167 nieuntikeutkorean;3166 nihiragana;306B nikatakana;30CB nikatakanahalfwidth;FF86 nikhahitleftthai;F899 nikhahitthai;0E4D nine;0039 ninearabic;0669 ninebengali;09EF ninecircle;2468 ninecircleinversesansserif;2792 ninedeva;096F ninegujarati;0AEF ninegurmukhi;0A6F ninehackarabic;0669 ninehangzhou;3029 nineideographicparen;3228 nineinferior;2089 ninemonospace;FF19 nineoldstyle;F739 nineparen;247C nineperiod;2490 ninepersian;06F9 nineroman;2178 ninesuperior;2079 nineteencircle;2472 nineteenparen;2486 nineteenperiod;249A ninethai;0E59 nj;01CC njecyrillic;045A nkatakana;30F3 nkatakanahalfwidth;FF9D nlegrightlong;019E nlinebelow;1E49 nmonospace;FF4E nmsquare;339A nnabengali;09A3 nnadeva;0923 nnagujarati;0AA3 nnagurmukhi;0A23 nnnadeva;0929 nohiragana;306E nokatakana;30CE nokatakanahalfwidth;FF89 nonbreakingspace;00A0 nonenthai;0E13 nonuthai;0E19 noonarabic;0646 noonfinalarabic;FEE6 noonghunnaarabic;06BA noonghunnafinalarabic;FB9F noonhehinitialarabic;FEE7 FEEC nooninitialarabic;FEE7 noonjeeminitialarabic;FCD2 noonjeemisolatedarabic;FC4B noonmedialarabic;FEE8 noonmeeminitialarabic;FCD5 noonmeemisolatedarabic;FC4E noonnoonfinalarabic;FC8D notcontains;220C notelement;2209 notelementof;2209 notequal;2260 notgreater;226F notgreaternorequal;2271 notgreaternorless;2279 notidentical;2262 notless;226E notlessnorequal;2270 notparallel;2226 notprecedes;2280 notsubset;2284 notsucceeds;2281 notsuperset;2285 nowarmenian;0576 nparen;24A9 nssquare;33B1 nsuperior;207F ntilde;00F1 nu;03BD nuhiragana;306C nukatakana;30CC nukatakanahalfwidth;FF87 nuktabengali;09BC nuktadeva;093C nuktagujarati;0ABC nuktagurmukhi;0A3C numbersign;0023 numbersignmonospace;FF03 numbersignsmall;FE5F numeralsigngreek;0374 numeralsignlowergreek;0375 numero;2116 nun;05E0 nundagesh;FB40 nundageshhebrew;FB40 nunhebrew;05E0 nvsquare;33B5 nwsquare;33BB nyabengali;099E nyadeva;091E nyagujarati;0A9E nyagurmukhi;0A1E o;006F oacute;00F3 oangthai;0E2D obarred;0275 obarredcyrillic;04E9 obarreddieresiscyrillic;04EB obengali;0993 obopomofo;311B obreve;014F ocandradeva;0911 ocandragujarati;0A91 ocandravowelsigndeva;0949 ocandravowelsigngujarati;0AC9 ocaron;01D2 ocircle;24DE ocircumflex;00F4 ocircumflexacute;1ED1 ocircumflexdotbelow;1ED9 ocircumflexgrave;1ED3 ocircumflexhookabove;1ED5 ocircumflextilde;1ED7 ocyrillic;043E odblacute;0151 odblgrave;020D odeva;0913 odieresis;00F6 odieresiscyrillic;04E7 odotbelow;1ECD oe;0153 oekorean;315A ogonek;02DB ogonekcmb;0328 ograve;00F2 ogujarati;0A93 oharmenian;0585 ohiragana;304A ohookabove;1ECF ohorn;01A1 ohornacute;1EDB ohorndotbelow;1EE3 ohorngrave;1EDD ohornhookabove;1EDF ohorntilde;1EE1 ohungarumlaut;0151 oi;01A3 oinvertedbreve;020F okatakana;30AA okatakanahalfwidth;FF75 okorean;3157 olehebrew;05AB omacron;014D omacronacute;1E53 omacrongrave;1E51 omdeva;0950 omega;03C9 omega1;03D6 omegacyrillic;0461 omegalatinclosed;0277 omegaroundcyrillic;047B omegatitlocyrillic;047D omegatonos;03CE omgujarati;0AD0 omicron;03BF omicrontonos;03CC omonospace;FF4F one;0031 onearabic;0661 onebengali;09E7 onecircle;2460 onecircleinversesansserif;278A onedeva;0967 onedotenleader;2024 oneeighth;215B onefitted;F6DC onegujarati;0AE7 onegurmukhi;0A67 onehackarabic;0661 onehalf;00BD onehangzhou;3021 oneideographicparen;3220 oneinferior;2081 onemonospace;FF11 onenumeratorbengali;09F4 oneoldstyle;F731 oneparen;2474 oneperiod;2488 onepersian;06F1 onequarter;00BC oneroman;2170 onesuperior;00B9 onethai;0E51 onethird;2153 oogonek;01EB oogonekmacron;01ED oogurmukhi;0A13 oomatragurmukhi;0A4B oopen;0254 oparen;24AA openbullet;25E6 option;2325 ordfeminine;00AA ordmasculine;00BA orthogonal;221F oshortdeva;0912 oshortvowelsigndeva;094A oslash;00F8 oslashacute;01FF osmallhiragana;3049 osmallkatakana;30A9 osmallkatakanahalfwidth;FF6B ostrokeacute;01FF osuperior;F6F0 otcyrillic;047F otilde;00F5 otildeacute;1E4D otildedieresis;1E4F oubopomofo;3121 overline;203E overlinecenterline;FE4A overlinecmb;0305 overlinedashed;FE49 overlinedblwavy;FE4C overlinewavy;FE4B overscore;00AF ovowelsignbengali;09CB ovowelsigndeva;094B ovowelsigngujarati;0ACB p;0070 paampssquare;3380 paasentosquare;332B pabengali;09AA pacute;1E55 padeva;092A pagedown;21DF pageup;21DE pagujarati;0AAA pagurmukhi;0A2A pahiragana;3071 paiyannoithai;0E2F pakatakana;30D1 palatalizationcyrilliccmb;0484 palochkacyrillic;04C0 pansioskorean;317F paragraph;00B6 parallel;2225 parenleft;0028 parenleftaltonearabic;FD3E parenleftbt;F8ED parenleftex;F8EC parenleftinferior;208D parenleftmonospace;FF08 parenleftsmall;FE59 parenleftsuperior;207D parenlefttp;F8EB parenleftvertical;FE35 parenright;0029 parenrightaltonearabic;FD3F parenrightbt;F8F8 parenrightex;F8F7 parenrightinferior;208E parenrightmonospace;FF09 parenrightsmall;FE5A parenrightsuperior;207E parenrighttp;F8F6 parenrightvertical;FE36 partialdiff;2202 paseqhebrew;05C0 pashtahebrew;0599 pasquare;33A9 patah;05B7 patah11;05B7 patah1d;05B7 patah2a;05B7 patahhebrew;05B7 patahnarrowhebrew;05B7 patahquarterhebrew;05B7 patahwidehebrew;05B7 pazerhebrew;05A1 pbopomofo;3106 pcircle;24DF pdotaccent;1E57 pe;05E4 pecyrillic;043F pedagesh;FB44 pedageshhebrew;FB44 peezisquare;333B pefinaldageshhebrew;FB43 peharabic;067E peharmenian;057A pehebrew;05E4 pehfinalarabic;FB57 pehinitialarabic;FB58 pehiragana;307A pehmedialarabic;FB59 pekatakana;30DA pemiddlehookcyrillic;04A7 perafehebrew;FB4E percent;0025 percentarabic;066A percentmonospace;FF05 percentsmall;FE6A period;002E periodarmenian;0589 periodcentered;00B7 periodhalfwidth;FF61 periodinferior;F6E7 periodmonospace;FF0E periodsmall;FE52 periodsuperior;F6E8 perispomenigreekcmb;0342 perpendicular;22A5 perthousand;2030 peseta;20A7 pfsquare;338A phabengali;09AB phadeva;092B phagujarati;0AAB phagurmukhi;0A2B phi;03C6 phi1;03D5 phieuphacirclekorean;327A phieuphaparenkorean;321A phieuphcirclekorean;326C phieuphkorean;314D phieuphparenkorean;320C philatin;0278 phinthuthai;0E3A phisymbolgreek;03D5 phook;01A5 phophanthai;0E1E phophungthai;0E1C phosamphaothai;0E20 pi;03C0 pieupacirclekorean;3273 pieupaparenkorean;3213 pieupcieuckorean;3176 pieupcirclekorean;3265 pieupkiyeokkorean;3172 pieupkorean;3142 pieupparenkorean;3205 pieupsioskiyeokkorean;3174 pieupsioskorean;3144 pieupsiostikeutkorean;3175 pieupthieuthkorean;3177 pieuptikeutkorean;3173 pihiragana;3074 pikatakana;30D4 pisymbolgreek;03D6 piwrarmenian;0583 plus;002B plusbelowcmb;031F pluscircle;2295 plusminus;00B1 plusmod;02D6 plusmonospace;FF0B plussmall;FE62 plussuperior;207A pmonospace;FF50 pmsquare;33D8 pohiragana;307D pointingindexdownwhite;261F pointingindexleftwhite;261C pointingindexrightwhite;261E pointingindexupwhite;261D pokatakana;30DD poplathai;0E1B postalmark;3012 postalmarkface;3020 pparen;24AB precedes;227A prescription;211E primemod;02B9 primereversed;2035 product;220F projective;2305 prolongedkana;30FC propellor;2318 propersubset;2282 propersuperset;2283 proportion;2237 proportional;221D psi;03C8 psicyrillic;0471 psilipneumatacyrilliccmb;0486 pssquare;33B0 puhiragana;3077 pukatakana;30D7 pvsquare;33B4 pwsquare;33BA q;0071 qadeva;0958 qadmahebrew;05A8 qafarabic;0642 qaffinalarabic;FED6 qafinitialarabic;FED7 qafmedialarabic;FED8 qamats;05B8 qamats10;05B8 qamats1a;05B8 qamats1c;05B8 qamats27;05B8 qamats29;05B8 qamats33;05B8 qamatsde;05B8 qamatshebrew;05B8 qamatsnarrowhebrew;05B8 qamatsqatanhebrew;05B8 qamatsqatannarrowhebrew;05B8 qamatsqatanquarterhebrew;05B8 qamatsqatanwidehebrew;05B8 qamatsquarterhebrew;05B8 qamatswidehebrew;05B8 qarneyparahebrew;059F qbopomofo;3111 qcircle;24E0 qhook;02A0 qmonospace;FF51 qof;05E7 qofdagesh;FB47 qofdageshhebrew;FB47 qofhatafpatah;05E7 05B2 qofhatafpatahhebrew;05E7 05B2 qofhatafsegol;05E7 05B1 qofhatafsegolhebrew;05E7 05B1 qofhebrew;05E7 qofhiriq;05E7 05B4 qofhiriqhebrew;05E7 05B4 qofholam;05E7 05B9 qofholamhebrew;05E7 05B9 qofpatah;05E7 05B7 qofpatahhebrew;05E7 05B7 qofqamats;05E7 05B8 qofqamatshebrew;05E7 05B8 qofqubuts;05E7 05BB qofqubutshebrew;05E7 05BB qofsegol;05E7 05B6 qofsegolhebrew;05E7 05B6 qofsheva;05E7 05B0 qofshevahebrew;05E7 05B0 qoftsere;05E7 05B5 qoftserehebrew;05E7 05B5 qparen;24AC quarternote;2669 qubuts;05BB qubuts18;05BB qubuts25;05BB qubuts31;05BB qubutshebrew;05BB qubutsnarrowhebrew;05BB qubutsquarterhebrew;05BB qubutswidehebrew;05BB question;003F questionarabic;061F questionarmenian;055E questiondown;00BF questiondownsmall;F7BF questiongreek;037E questionmonospace;FF1F questionsmall;F73F quotedbl;0022 quotedblbase;201E quotedblleft;201C quotedblmonospace;FF02 quotedblprime;301E quotedblprimereversed;301D quotedblright;201D quoteleft;2018 quoteleftreversed;201B quotereversed;201B quoteright;2019 quoterightn;0149 quotesinglbase;201A quotesingle;0027 quotesinglemonospace;FF07 r;0072 raarmenian;057C rabengali;09B0 racute;0155 radeva;0930 radical;221A radicalex;F8E5 radoverssquare;33AE radoverssquaredsquare;33AF radsquare;33AD rafe;05BF rafehebrew;05BF ragujarati;0AB0 ragurmukhi;0A30 rahiragana;3089 rakatakana;30E9 rakatakanahalfwidth;FF97 ralowerdiagonalbengali;09F1 ramiddlediagonalbengali;09F0 ramshorn;0264 ratio;2236 rbopomofo;3116 rcaron;0159 rcedilla;0157 rcircle;24E1 rcommaaccent;0157 rdblgrave;0211 rdotaccent;1E59 rdotbelow;1E5B rdotbelowmacron;1E5D referencemark;203B reflexsubset;2286 reflexsuperset;2287 registered;00AE registersans;F8E8 registerserif;F6DA reharabic;0631 reharmenian;0580 rehfinalarabic;FEAE rehiragana;308C rehyehaleflamarabic;0631 FEF3 FE8E 0644 rekatakana;30EC rekatakanahalfwidth;FF9A resh;05E8 reshdageshhebrew;FB48 reshhatafpatah;05E8 05B2 reshhatafpatahhebrew;05E8 05B2 reshhatafsegol;05E8 05B1 reshhatafsegolhebrew;05E8 05B1 reshhebrew;05E8 reshhiriq;05E8 05B4 reshhiriqhebrew;05E8 05B4 reshholam;05E8 05B9 reshholamhebrew;05E8 05B9 reshpatah;05E8 05B7 reshpatahhebrew;05E8 05B7 reshqamats;05E8 05B8 reshqamatshebrew;05E8 05B8 reshqubuts;05E8 05BB reshqubutshebrew;05E8 05BB reshsegol;05E8 05B6 reshsegolhebrew;05E8 05B6 reshsheva;05E8 05B0 reshshevahebrew;05E8 05B0 reshtsere;05E8 05B5 reshtserehebrew;05E8 05B5 reversedtilde;223D reviahebrew;0597 reviamugrashhebrew;0597 revlogicalnot;2310 rfishhook;027E rfishhookreversed;027F rhabengali;09DD rhadeva;095D rho;03C1 rhook;027D rhookturned;027B rhookturnedsuperior;02B5 rhosymbolgreek;03F1 rhotichookmod;02DE rieulacirclekorean;3271 rieulaparenkorean;3211 rieulcirclekorean;3263 rieulhieuhkorean;3140 rieulkiyeokkorean;313A rieulkiyeoksioskorean;3169 rieulkorean;3139 rieulmieumkorean;313B rieulpansioskorean;316C rieulparenkorean;3203 rieulphieuphkorean;313F rieulpieupkorean;313C rieulpieupsioskorean;316B rieulsioskorean;313D rieulthieuthkorean;313E rieultikeutkorean;316A rieulyeorinhieuhkorean;316D rightangle;221F righttackbelowcmb;0319 righttriangle;22BF rihiragana;308A rikatakana;30EA rikatakanahalfwidth;FF98 ring;02DA ringbelowcmb;0325 ringcmb;030A ringhalfleft;02BF ringhalfleftarmenian;0559 ringhalfleftbelowcmb;031C ringhalfleftcentered;02D3 ringhalfright;02BE ringhalfrightbelowcmb;0339 ringhalfrightcentered;02D2 rinvertedbreve;0213 rittorusquare;3351 rlinebelow;1E5F rlongleg;027C rlonglegturned;027A rmonospace;FF52 rohiragana;308D rokatakana;30ED rokatakanahalfwidth;FF9B roruathai;0E23 rparen;24AD rrabengali;09DC rradeva;0931 rragurmukhi;0A5C rreharabic;0691 rrehfinalarabic;FB8D rrvocalicbengali;09E0 rrvocalicdeva;0960 rrvocalicgujarati;0AE0 rrvocalicvowelsignbengali;09C4 rrvocalicvowelsigndeva;0944 rrvocalicvowelsigngujarati;0AC4 rsuperior;F6F1 rtblock;2590 rturned;0279 rturnedsuperior;02B4 ruhiragana;308B rukatakana;30EB rukatakanahalfwidth;FF99 rupeemarkbengali;09F2 rupeesignbengali;09F3 rupiah;F6DD ruthai;0E24 rvocalicbengali;098B rvocalicdeva;090B rvocalicgujarati;0A8B rvocalicvowelsignbengali;09C3 rvocalicvowelsigndeva;0943 rvocalicvowelsigngujarati;0AC3 s;0073 sabengali;09B8 sacute;015B sacutedotaccent;1E65 sadarabic;0635 sadeva;0938 sadfinalarabic;FEBA sadinitialarabic;FEBB sadmedialarabic;FEBC sagujarati;0AB8 sagurmukhi;0A38 sahiragana;3055 sakatakana;30B5 sakatakanahalfwidth;FF7B sallallahoualayhewasallamarabic;FDFA samekh;05E1 samekhdagesh;FB41 samekhdageshhebrew;FB41 samekhhebrew;05E1 saraaathai;0E32 saraaethai;0E41 saraaimaimalaithai;0E44 saraaimaimuanthai;0E43 saraamthai;0E33 saraathai;0E30 saraethai;0E40 saraiileftthai;F886 saraiithai;0E35 saraileftthai;F885 saraithai;0E34 saraothai;0E42 saraueeleftthai;F888 saraueethai;0E37 saraueleftthai;F887 sarauethai;0E36 sarauthai;0E38 sarauuthai;0E39 sbopomofo;3119 scaron;0161 scarondotaccent;1E67 scedilla;015F schwa;0259 schwacyrillic;04D9 schwadieresiscyrillic;04DB schwahook;025A scircle;24E2 scircumflex;015D scommaaccent;0219 sdotaccent;1E61 sdotbelow;1E63 sdotbelowdotaccent;1E69 seagullbelowcmb;033C second;2033 secondtonechinese;02CA section;00A7 seenarabic;0633 seenfinalarabic;FEB2 seeninitialarabic;FEB3 seenmedialarabic;FEB4 segol;05B6 segol13;05B6 segol1f;05B6 segol2c;05B6 segolhebrew;05B6 segolnarrowhebrew;05B6 segolquarterhebrew;05B6 segoltahebrew;0592 segolwidehebrew;05B6 seharmenian;057D sehiragana;305B sekatakana;30BB sekatakanahalfwidth;FF7E semicolon;003B semicolonarabic;061B semicolonmonospace;FF1B semicolonsmall;FE54 semivoicedmarkkana;309C semivoicedmarkkanahalfwidth;FF9F sentisquare;3322 sentosquare;3323 seven;0037 sevenarabic;0667 sevenbengali;09ED sevencircle;2466 sevencircleinversesansserif;2790 sevendeva;096D seveneighths;215E sevengujarati;0AED sevengurmukhi;0A6D sevenhackarabic;0667 sevenhangzhou;3027 sevenideographicparen;3226 seveninferior;2087 sevenmonospace;FF17 sevenoldstyle;F737 sevenparen;247A sevenperiod;248E sevenpersian;06F7 sevenroman;2176 sevensuperior;2077 seventeencircle;2470 seventeenparen;2484 seventeenperiod;2498 seventhai;0E57 sfthyphen;00AD shaarmenian;0577 shabengali;09B6 shacyrillic;0448 shaddaarabic;0651 shaddadammaarabic;FC61 shaddadammatanarabic;FC5E shaddafathaarabic;FC60 shaddafathatanarabic;0651 064B shaddakasraarabic;FC62 shaddakasratanarabic;FC5F shade;2592 shadedark;2593 shadelight;2591 shademedium;2592 shadeva;0936 shagujarati;0AB6 shagurmukhi;0A36 shalshelethebrew;0593 shbopomofo;3115 shchacyrillic;0449 sheenarabic;0634 sheenfinalarabic;FEB6 sheeninitialarabic;FEB7 sheenmedialarabic;FEB8 sheicoptic;03E3 sheqel;20AA sheqelhebrew;20AA sheva;05B0 sheva115;05B0 sheva15;05B0 sheva22;05B0 sheva2e;05B0 shevahebrew;05B0 shevanarrowhebrew;05B0 shevaquarterhebrew;05B0 shevawidehebrew;05B0 shhacyrillic;04BB shimacoptic;03ED shin;05E9 shindagesh;FB49 shindageshhebrew;FB49 shindageshshindot;FB2C shindageshshindothebrew;FB2C shindageshsindot;FB2D shindageshsindothebrew;FB2D shindothebrew;05C1 shinhebrew;05E9 shinshindot;FB2A shinshindothebrew;FB2A shinsindot;FB2B shinsindothebrew;FB2B shook;0282 sigma;03C3 sigma1;03C2 sigmafinal;03C2 sigmalunatesymbolgreek;03F2 sihiragana;3057 sikatakana;30B7 sikatakanahalfwidth;FF7C siluqhebrew;05BD siluqlefthebrew;05BD similar;223C sindothebrew;05C2 siosacirclekorean;3274 siosaparenkorean;3214 sioscieuckorean;317E sioscirclekorean;3266 sioskiyeokkorean;317A sioskorean;3145 siosnieunkorean;317B siosparenkorean;3206 siospieupkorean;317D siostikeutkorean;317C six;0036 sixarabic;0666 sixbengali;09EC sixcircle;2465 sixcircleinversesansserif;278F sixdeva;096C sixgujarati;0AEC sixgurmukhi;0A6C sixhackarabic;0666 sixhangzhou;3026 sixideographicparen;3225 sixinferior;2086 sixmonospace;FF16 sixoldstyle;F736 sixparen;2479 sixperiod;248D sixpersian;06F6 sixroman;2175 sixsuperior;2076 sixteencircle;246F sixteencurrencydenominatorbengali;09F9 sixteenparen;2483 sixteenperiod;2497 sixthai;0E56 slash;002F slashmonospace;FF0F slong;017F slongdotaccent;1E9B smileface;263A smonospace;FF53 sofpasuqhebrew;05C3 softhyphen;00AD softsigncyrillic;044C sohiragana;305D sokatakana;30BD sokatakanahalfwidth;FF7F soliduslongoverlaycmb;0338 solidusshortoverlaycmb;0337 sorusithai;0E29 sosalathai;0E28 sosothai;0E0B sosuathai;0E2A space;0020 spacehackarabic;0020 spade;2660 spadesuitblack;2660 spadesuitwhite;2664 sparen;24AE squarebelowcmb;033B squarecc;33C4 squarecm;339D squarediagonalcrosshatchfill;25A9 squarehorizontalfill;25A4 squarekg;338F squarekm;339E squarekmcapital;33CE squareln;33D1 squarelog;33D2 squaremg;338E squaremil;33D5 squaremm;339C squaremsquared;33A1 squareorthogonalcrosshatchfill;25A6 squareupperlefttolowerrightfill;25A7 squareupperrighttolowerleftfill;25A8 squareverticalfill;25A5 squarewhitewithsmallblack;25A3 srsquare;33DB ssabengali;09B7 ssadeva;0937 ssagujarati;0AB7 ssangcieuckorean;3149 ssanghieuhkorean;3185 ssangieungkorean;3180 ssangkiyeokkorean;3132 ssangnieunkorean;3165 ssangpieupkorean;3143 ssangsioskorean;3146 ssangtikeutkorean;3138 ssuperior;F6F2 sterling;00A3 sterlingmonospace;FFE1 strokelongoverlaycmb;0336 strokeshortoverlaycmb;0335 subset;2282 subsetnotequal;228A subsetorequal;2286 succeeds;227B suchthat;220B suhiragana;3059 sukatakana;30B9 sukatakanahalfwidth;FF7D sukunarabic;0652 summation;2211 sun;263C superset;2283 supersetnotequal;228B supersetorequal;2287 svsquare;33DC syouwaerasquare;337C t;0074 tabengali;09A4 tackdown;22A4 tackleft;22A3 tadeva;0924 tagujarati;0AA4 tagurmukhi;0A24 taharabic;0637 tahfinalarabic;FEC2 tahinitialarabic;FEC3 tahiragana;305F tahmedialarabic;FEC4 taisyouerasquare;337D takatakana;30BF takatakanahalfwidth;FF80 tatweelarabic;0640 tau;03C4 tav;05EA tavdages;FB4A tavdagesh;FB4A tavdageshhebrew;FB4A tavhebrew;05EA tbar;0167 tbopomofo;310A tcaron;0165 tccurl;02A8 tcedilla;0163 tcheharabic;0686 tchehfinalarabic;FB7B tchehinitialarabic;FB7C tchehmedialarabic;FB7D tchehmeeminitialarabic;FB7C FEE4 tcircle;24E3 tcircumflexbelow;1E71 tcommaaccent;0163 tdieresis;1E97 tdotaccent;1E6B tdotbelow;1E6D tecyrillic;0442 tedescendercyrillic;04AD teharabic;062A tehfinalarabic;FE96 tehhahinitialarabic;FCA2 tehhahisolatedarabic;FC0C tehinitialarabic;FE97 tehiragana;3066 tehjeeminitialarabic;FCA1 tehjeemisolatedarabic;FC0B tehmarbutaarabic;0629 tehmarbutafinalarabic;FE94 tehmedialarabic;FE98 tehmeeminitialarabic;FCA4 tehmeemisolatedarabic;FC0E tehnoonfinalarabic;FC73 tekatakana;30C6 tekatakanahalfwidth;FF83 telephone;2121 telephoneblack;260E telishagedolahebrew;05A0 telishaqetanahebrew;05A9 tencircle;2469 tenideographicparen;3229 tenparen;247D tenperiod;2491 tenroman;2179 tesh;02A7 tet;05D8 tetdagesh;FB38 tetdageshhebrew;FB38 tethebrew;05D8 tetsecyrillic;04B5 tevirhebrew;059B tevirlefthebrew;059B thabengali;09A5 thadeva;0925 thagujarati;0AA5 thagurmukhi;0A25 thalarabic;0630 thalfinalarabic;FEAC thanthakhatlowleftthai;F898 thanthakhatlowrightthai;F897 thanthakhatthai;0E4C thanthakhatupperleftthai;F896 theharabic;062B thehfinalarabic;FE9A thehinitialarabic;FE9B thehmedialarabic;FE9C thereexists;2203 therefore;2234 theta;03B8 theta1;03D1 thetasymbolgreek;03D1 thieuthacirclekorean;3279 thieuthaparenkorean;3219 thieuthcirclekorean;326B thieuthkorean;314C thieuthparenkorean;320B thirteencircle;246C thirteenparen;2480 thirteenperiod;2494 thonangmonthothai;0E11 thook;01AD thophuthaothai;0E12 thorn;00FE thothahanthai;0E17 thothanthai;0E10 thothongthai;0E18 thothungthai;0E16 thousandcyrillic;0482 thousandsseparatorarabic;066C thousandsseparatorpersian;066C three;0033 threearabic;0663 threebengali;09E9 threecircle;2462 threecircleinversesansserif;278C threedeva;0969 threeeighths;215C threegujarati;0AE9 threegurmukhi;0A69 threehackarabic;0663 threehangzhou;3023 threeideographicparen;3222 threeinferior;2083 threemonospace;FF13 threenumeratorbengali;09F6 threeoldstyle;F733 threeparen;2476 threeperiod;248A threepersian;06F3 threequarters;00BE threequartersemdash;F6DE threeroman;2172 threesuperior;00B3 threethai;0E53 thzsquare;3394 tihiragana;3061 tikatakana;30C1 tikatakanahalfwidth;FF81 tikeutacirclekorean;3270 tikeutaparenkorean;3210 tikeutcirclekorean;3262 tikeutkorean;3137 tikeutparenkorean;3202 tilde;02DC tildebelowcmb;0330 tildecmb;0303 tildecomb;0303 tildedoublecmb;0360 tildeoperator;223C tildeoverlaycmb;0334 tildeverticalcmb;033E timescircle;2297 tipehahebrew;0596 tipehalefthebrew;0596 tippigurmukhi;0A70 titlocyrilliccmb;0483 tiwnarmenian;057F tlinebelow;1E6F tmonospace;FF54 toarmenian;0569 tohiragana;3068 tokatakana;30C8 tokatakanahalfwidth;FF84 tonebarextrahighmod;02E5 tonebarextralowmod;02E9 tonebarhighmod;02E6 tonebarlowmod;02E8 tonebarmidmod;02E7 tonefive;01BD tonesix;0185 tonetwo;01A8 tonos;0384 tonsquare;3327 topatakthai;0E0F tortoiseshellbracketleft;3014 tortoiseshellbracketleftsmall;FE5D tortoiseshellbracketleftvertical;FE39 tortoiseshellbracketright;3015 tortoiseshellbracketrightsmall;FE5E tortoiseshellbracketrightvertical;FE3A totaothai;0E15 tpalatalhook;01AB tparen;24AF trademark;2122 trademarksans;F8EA trademarkserif;F6DB tretroflexhook;0288 triagdn;25BC triaglf;25C4 triagrt;25BA triagup;25B2 ts;02A6 tsadi;05E6 tsadidagesh;FB46 tsadidageshhebrew;FB46 tsadihebrew;05E6 tsecyrillic;0446 tsere;05B5 tsere12;05B5 tsere1e;05B5 tsere2b;05B5 tserehebrew;05B5 tserenarrowhebrew;05B5 tserequarterhebrew;05B5 tserewidehebrew;05B5 tshecyrillic;045B tsuperior;F6F3 ttabengali;099F ttadeva;091F ttagujarati;0A9F ttagurmukhi;0A1F tteharabic;0679 ttehfinalarabic;FB67 ttehinitialarabic;FB68 ttehmedialarabic;FB69 tthabengali;09A0 tthadeva;0920 tthagujarati;0AA0 tthagurmukhi;0A20 tturned;0287 tuhiragana;3064 tukatakana;30C4 tukatakanahalfwidth;FF82 tusmallhiragana;3063 tusmallkatakana;30C3 tusmallkatakanahalfwidth;FF6F twelvecircle;246B twelveparen;247F twelveperiod;2493 twelveroman;217B twentycircle;2473 twentyhangzhou;5344 twentyparen;2487 twentyperiod;249B two;0032 twoarabic;0662 twobengali;09E8 twocircle;2461 twocircleinversesansserif;278B twodeva;0968 twodotenleader;2025 twodotleader;2025 twodotleadervertical;FE30 twogujarati;0AE8 twogurmukhi;0A68 twohackarabic;0662 twohangzhou;3022 twoideographicparen;3221 twoinferior;2082 twomonospace;FF12 twonumeratorbengali;09F5 twooldstyle;F732 twoparen;2475 twoperiod;2489 twopersian;06F2 tworoman;2171 twostroke;01BB twosuperior;00B2 twothai;0E52 twothirds;2154 u;0075 uacute;00FA ubar;0289 ubengali;0989 ubopomofo;3128 ubreve;016D ucaron;01D4 ucircle;24E4 ucircumflex;00FB ucircumflexbelow;1E77 ucyrillic;0443 udattadeva;0951 udblacute;0171 udblgrave;0215 udeva;0909 udieresis;00FC udieresisacute;01D8 udieresisbelow;1E73 udieresiscaron;01DA udieresiscyrillic;04F1 udieresisgrave;01DC udieresismacron;01D6 udotbelow;1EE5 ugrave;00F9 ugujarati;0A89 ugurmukhi;0A09 uhiragana;3046 uhookabove;1EE7 uhorn;01B0 uhornacute;1EE9 uhorndotbelow;1EF1 uhorngrave;1EEB uhornhookabove;1EED uhorntilde;1EEF uhungarumlaut;0171 uhungarumlautcyrillic;04F3 uinvertedbreve;0217 ukatakana;30A6 ukatakanahalfwidth;FF73 ukcyrillic;0479 ukorean;315C umacron;016B umacroncyrillic;04EF umacrondieresis;1E7B umatragurmukhi;0A41 umonospace;FF55 underscore;005F underscoredbl;2017 underscoremonospace;FF3F underscorevertical;FE33 underscorewavy;FE4F union;222A universal;2200 uogonek;0173 uparen;24B0 upblock;2580 upperdothebrew;05C4 upsilon;03C5 upsilondieresis;03CB upsilondieresistonos;03B0 upsilonlatin;028A upsilontonos;03CD uptackbelowcmb;031D uptackmod;02D4 uragurmukhi;0A73 uring;016F ushortcyrillic;045E usmallhiragana;3045 usmallkatakana;30A5 usmallkatakanahalfwidth;FF69 ustraightcyrillic;04AF ustraightstrokecyrillic;04B1 utilde;0169 utildeacute;1E79 utildebelow;1E75 uubengali;098A uudeva;090A uugujarati;0A8A uugurmukhi;0A0A uumatragurmukhi;0A42 uuvowelsignbengali;09C2 uuvowelsigndeva;0942 uuvowelsigngujarati;0AC2 uvowelsignbengali;09C1 uvowelsigndeva;0941 uvowelsigngujarati;0AC1 v;0076 vadeva;0935 vagujarati;0AB5 vagurmukhi;0A35 vakatakana;30F7 vav;05D5 vavdagesh;FB35 vavdagesh65;FB35 vavdageshhebrew;FB35 vavhebrew;05D5 vavholam;FB4B vavholamhebrew;FB4B vavvavhebrew;05F0 vavyodhebrew;05F1 vcircle;24E5 vdotbelow;1E7F vecyrillic;0432 veharabic;06A4 vehfinalarabic;FB6B vehinitialarabic;FB6C vehmedialarabic;FB6D vekatakana;30F9 venus;2640 verticalbar;007C verticallineabovecmb;030D verticallinebelowcmb;0329 verticallinelowmod;02CC verticallinemod;02C8 vewarmenian;057E vhook;028B vikatakana;30F8 viramabengali;09CD viramadeva;094D viramagujarati;0ACD visargabengali;0983 visargadeva;0903 visargagujarati;0A83 vmonospace;FF56 voarmenian;0578 voicediterationhiragana;309E voicediterationkatakana;30FE voicedmarkkana;309B voicedmarkkanahalfwidth;FF9E vokatakana;30FA vparen;24B1 vtilde;1E7D vturned;028C vuhiragana;3094 vukatakana;30F4 w;0077 wacute;1E83 waekorean;3159 wahiragana;308F wakatakana;30EF wakatakanahalfwidth;FF9C wakorean;3158 wasmallhiragana;308E wasmallkatakana;30EE wattosquare;3357 wavedash;301C wavyunderscorevertical;FE34 wawarabic;0648 wawfinalarabic;FEEE wawhamzaabovearabic;0624 wawhamzaabovefinalarabic;FE86 wbsquare;33DD wcircle;24E6 wcircumflex;0175 wdieresis;1E85 wdotaccent;1E87 wdotbelow;1E89 wehiragana;3091 weierstrass;2118 wekatakana;30F1 wekorean;315E weokorean;315D wgrave;1E81 whitebullet;25E6 whitecircle;25CB whitecircleinverse;25D9 whitecornerbracketleft;300E whitecornerbracketleftvertical;FE43 whitecornerbracketright;300F whitecornerbracketrightvertical;FE44 whitediamond;25C7 whitediamondcontainingblacksmalldiamond;25C8 whitedownpointingsmalltriangle;25BF whitedownpointingtriangle;25BD whiteleftpointingsmalltriangle;25C3 whiteleftpointingtriangle;25C1 whitelenticularbracketleft;3016 whitelenticularbracketright;3017 whiterightpointingsmalltriangle;25B9 whiterightpointingtriangle;25B7 whitesmallsquare;25AB whitesmilingface;263A whitesquare;25A1 whitestar;2606 whitetelephone;260F whitetortoiseshellbracketleft;3018 whitetortoiseshellbracketright;3019 whiteuppointingsmalltriangle;25B5 whiteuppointingtriangle;25B3 wihiragana;3090 wikatakana;30F0 wikorean;315F wmonospace;FF57 wohiragana;3092 wokatakana;30F2 wokatakanahalfwidth;FF66 won;20A9 wonmonospace;FFE6 wowaenthai;0E27 wparen;24B2 wring;1E98 wsuperior;02B7 wturned;028D wynn;01BF x;0078 xabovecmb;033D xbopomofo;3112 xcircle;24E7 xdieresis;1E8D xdotaccent;1E8B xeharmenian;056D xi;03BE xmonospace;FF58 xparen;24B3 xsuperior;02E3 y;0079 yaadosquare;334E yabengali;09AF yacute;00FD yadeva;092F yaekorean;3152 yagujarati;0AAF yagurmukhi;0A2F yahiragana;3084 yakatakana;30E4 yakatakanahalfwidth;FF94 yakorean;3151 yamakkanthai;0E4E yasmallhiragana;3083 yasmallkatakana;30E3 yasmallkatakanahalfwidth;FF6C yatcyrillic;0463 ycircle;24E8 ycircumflex;0177 ydieresis;00FF ydotaccent;1E8F ydotbelow;1EF5 yeharabic;064A yehbarreearabic;06D2 yehbarreefinalarabic;FBAF yehfinalarabic;FEF2 yehhamzaabovearabic;0626 yehhamzaabovefinalarabic;FE8A yehhamzaaboveinitialarabic;FE8B yehhamzaabovemedialarabic;FE8C yehinitialarabic;FEF3 yehmedialarabic;FEF4 yehmeeminitialarabic;FCDD yehmeemisolatedarabic;FC58 yehnoonfinalarabic;FC94 yehthreedotsbelowarabic;06D1 yekorean;3156 yen;00A5 yenmonospace;FFE5 yeokorean;3155 yeorinhieuhkorean;3186 yerahbenyomohebrew;05AA yerahbenyomolefthebrew;05AA yericyrillic;044B yerudieresiscyrillic;04F9 yesieungkorean;3181 yesieungpansioskorean;3183 yesieungsioskorean;3182 yetivhebrew;059A ygrave;1EF3 yhook;01B4 yhookabove;1EF7 yiarmenian;0575 yicyrillic;0457 yikorean;3162 yinyang;262F yiwnarmenian;0582 ymonospace;FF59 yod;05D9 yoddagesh;FB39 yoddageshhebrew;FB39 yodhebrew;05D9 yodyodhebrew;05F2 yodyodpatahhebrew;FB1F yohiragana;3088 yoikorean;3189 yokatakana;30E8 yokatakanahalfwidth;FF96 yokorean;315B yosmallhiragana;3087 yosmallkatakana;30E7 yosmallkatakanahalfwidth;FF6E yotgreek;03F3 yoyaekorean;3188 yoyakorean;3187 yoyakthai;0E22 yoyingthai;0E0D yparen;24B4 ypogegrammeni;037A ypogegrammenigreekcmb;0345 yr;01A6 yring;1E99 ysuperior;02B8 ytilde;1EF9 yturned;028E yuhiragana;3086 yuikorean;318C yukatakana;30E6 yukatakanahalfwidth;FF95 yukorean;3160 yusbigcyrillic;046B yusbigiotifiedcyrillic;046D yuslittlecyrillic;0467 yuslittleiotifiedcyrillic;0469 yusmallhiragana;3085 yusmallkatakana;30E5 yusmallkatakanahalfwidth;FF6D yuyekorean;318B yuyeokorean;318A yyabengali;09DF yyadeva;095F z;007A zaarmenian;0566 zacute;017A zadeva;095B zagurmukhi;0A5B zaharabic;0638 zahfinalarabic;FEC6 zahinitialarabic;FEC7 zahiragana;3056 zahmedialarabic;FEC8 zainarabic;0632 zainfinalarabic;FEB0 zakatakana;30B6 zaqefgadolhebrew;0595 zaqefqatanhebrew;0594 zarqahebrew;0598 zayin;05D6 zayindagesh;FB36 zayindageshhebrew;FB36 zayinhebrew;05D6 zbopomofo;3117 zcaron;017E zcircle;24E9 zcircumflex;1E91 zcurl;0291 zdot;017C zdotaccent;017C zdotbelow;1E93 zecyrillic;0437 zedescendercyrillic;0499 zedieresiscyrillic;04DF zehiragana;305C zekatakana;30BC zero;0030 zeroarabic;0660 zerobengali;09E6 zerodeva;0966 zerogujarati;0AE6 zerogurmukhi;0A66 zerohackarabic;0660 zeroinferior;2080 zeromonospace;FF10 zerooldstyle;F730 zeropersian;06F0 zerosuperior;2070 zerothai;0E50 zerowidthjoiner;FEFF zerowidthnonjoiner;200C zerowidthspace;200B zeta;03B6 zhbopomofo;3113 zhearmenian;056A zhebrevecyrillic;04C2 zhecyrillic;0436 zhedescendercyrillic;0497 zhedieresiscyrillic;04DD zihiragana;3058 zikatakana;30B8 zinorhebrew;05AE zlinebelow;1E95 zmonospace;FF5A zohiragana;305E zokatakana;30BE zparen;24B5 zretroflexhook;0290 zstroke;01B6 zuhiragana;305A zukatakana;30BA a100;275E a101;2761 a102;2762 a103;2763 a104;2764 a105;2710 a106;2765 a107;2766 a108;2767 a109;2660 a10;2721 a110;2665 a111;2666 a112;2663 a117;2709 a118;2708 a119;2707 a11;261B a120;2460 a121;2461 a122;2462 a123;2463 a124;2464 a125;2465 a126;2466 a127;2467 a128;2468 a129;2469 a12;261E a130;2776 a131;2777 a132;2778 a133;2779 a134;277A a135;277B a136;277C a137;277D a138;277E a139;277F a13;270C a140;2780 a141;2781 a142;2782 a143;2783 a144;2784 a145;2785 a146;2786 a147;2787 a148;2788 a149;2789 a14;270D a150;278A a151;278B a152;278C a153;278D a154;278E a155;278F a156;2790 a157;2791 a158;2792 a159;2793 a15;270E a160;2794 a161;2192 a162;27A3 a163;2194 a164;2195 a165;2799 a166;279B a167;279C a168;279D a169;279E a16;270F a170;279F a171;27A0 a172;27A1 a173;27A2 a174;27A4 a175;27A5 a176;27A6 a177;27A7 a178;27A8 a179;27A9 a17;2711 a180;27AB a181;27AD a182;27AF a183;27B2 a184;27B3 a185;27B5 a186;27B8 a187;27BA a188;27BB a189;27BC a18;2712 a190;27BD a191;27BE a192;279A a193;27AA a194;27B6 a195;27B9 a196;2798 a197;27B4 a198;27B7 a199;27AC a19;2713 a1;2701 a200;27AE a201;27B1 a202;2703 a203;2750 a204;2752 a205;276E a206;2770 a20;2714 a21;2715 a22;2716 a23;2717 a24;2718 a25;2719 a26;271A a27;271B a28;271C a29;2722 a2;2702 a30;2723 a31;2724 a32;2725 a33;2726 a34;2727 a35;2605 a36;2729 a37;272A a38;272B a39;272C a3;2704 a40;272D a41;272E a42;272F a43;2730 a44;2731 a45;2732 a46;2733 a47;2734 a48;2735 a49;2736 a4;260E a50;2737 a51;2738 a52;2739 a53;273A a54;273B a55;273C a56;273D a57;273E a58;273F a59;2740 a5;2706 a60;2741 a61;2742 a62;2743 a63;2744 a64;2745 a65;2746 a66;2747 a67;2748 a68;2749 a69;274A a6;271D a70;274B a71;25CF a72;274D a73;25A0 a74;274F a75;2751 a76;25B2 a77;25BC a78;25C6 a79;2756 a7;271E a81;25D7 a82;2758 a83;2759 a84;275A a85;276F a86;2771 a87;2772 a88;2773 a89;2768 a8;271F a90;2769 a91;276C a92;276D a93;276A a94;276B a95;2774 a96;2775 a97;275B a98;275C a99;275D a9;2720 """ # string table management # class StringTable: def __init__( self, name_list, master_table_name ): self.names = name_list self.master_table = master_table_name self.indices = {} index = 0 for name in name_list: self.indices[name] = index index += len( name ) + 1 self.total = index def dump( self, file ): write = file.write write( " static const char " + self.master_table + "[" + repr( self.total ) + "] =\n" ) write( " {\n" ) line = "" for name in self.names: line += " '" line += string.join( ( re.findall( ".", name ) ), "','" ) line += "', 0,\n" write( line + " };\n\n\n" ) def dump_sublist( self, file, table_name, macro_name, sublist ): write = file.write write( "#define " + macro_name + " " + repr( len( sublist ) ) + "\n\n" ) write( " /* Values are offsets into the `" + self.master_table + "' table */\n\n" ) write( " static const short " + table_name + "[" + macro_name + "] =\n" ) write( " {\n" ) line = " " comma = "" col = 0 for name in sublist: line += comma line += "%4d" % self.indices[name] col += 1 comma = "," if col == 14: col = 0 comma = ",\n " write( line + "\n };\n\n\n" ) # We now store the Adobe Glyph List in compressed form. The list is put # into a data structure called `trie' (because it has a tree-like # appearance). Consider, for example, that you want to store the # following name mapping: # # A => 1 # Aacute => 6 # Abalon => 2 # Abstract => 4 # # It is possible to store the entries as follows. # # A => 1 # | # +-acute => 6 # | # +-b # | # +-alon => 2 # | # +-stract => 4 # # We see that each node in the trie has: # # - one or more `letters' # - an optional value # - zero or more child nodes # # The first step is to call # # root = StringNode( "", 0 ) # for word in map.values(): # root.add( word, map[word] ) # # which creates a large trie where each node has only one children. # # Executing # # root = root.optimize() # # optimizes the trie by merging the letters of successive nodes whenever # possible. # # Each node of the trie is stored as follows. # # - First the node's letter, according to the following scheme. We # use the fact that in the AGL no name contains character codes > 127. # # name bitsize description # ---------------------------------------------------------------- # notlast 1 Set to 1 if this is not the last letter # in the word. # ascii 7 The letter's ASCII value. # # - The letter is followed by a children count and the value of the # current key (if any). Again we can do some optimization because all # AGL entries are from the BMP; this means that 16 bits are sufficient # to store its Unicode values. Additionally, no node has more than # 127 children. # # name bitsize description # ----------------------------------------- # hasvalue 1 Set to 1 if a 16-bit Unicode value follows. # num_children 7 Number of children. Can be 0 only if # `hasvalue' is set to 1. # value 16 Optional Unicode value. # # - A node is finished by a list of 16bit absolute offsets to the # children, which must be sorted in increasing order of their first # letter. # # For simplicity, all 16bit quantities are stored in big-endian order. # # The root node has first letter = 0, and no value. # class StringNode: def __init__( self, letter, value ): self.letter = letter self.value = value self.children = {} def __cmp__( self, other ): return ord( self.letter[0] ) - ord( other.letter[0] ) def add( self, word, value ): if len( word ) == 0: self.value = value return letter = word[0] word = word[1:] if self.children.has_key( letter ): child = self.children[letter] else: child = StringNode( letter, 0 ) self.children[letter] = child child.add( word, value ) def optimize( self ): # optimize all children first children = self.children.values() self.children = {} for child in children: self.children[child.letter[0]] = child.optimize() # don't optimize if there's a value, # if we don't have any child or if we # have more than one child if ( self.value != 0 ) or ( not children ) or len( children ) > 1: return self child = children[0] self.letter += child.letter self.value = child.value self.children = child.children return self def dump_debug( self, write, margin ): # this is used during debugging line = margin + "+-" if len( self.letter ) == 0: line += "<NOLETTER>" else: line += self.letter if self.value: line += " => " + repr( self.value ) write( line + "\n" ) if self.children: margin += "| " for child in self.children.values(): child.dump_debug( write, margin ) def locate( self, index ): self.index = index if len( self.letter ) > 0: index += len( self.letter ) + 1 else: index += 2 if self.value != 0: index += 2 children = self.children.values() children.sort() index += 2 * len( children ) for child in children: index = child.locate( index ) return index def store( self, storage ): # write the letters l = len( self.letter ) if l == 0: storage += struct.pack( "B", 0 ) else: for n in range( l ): val = ord( self.letter[n] ) if n < l - 1: val += 128 storage += struct.pack( "B", val ) # write the count children = self.children.values() children.sort() count = len( children ) if self.value != 0: storage += struct.pack( "!BH", count + 128, self.value ) else: storage += struct.pack( "B", count ) for child in children: storage += struct.pack( "!H", child.index ) for child in children: storage = child.store( storage ) return storage def adobe_glyph_values(): """return the list of glyph names and their unicode values""" lines = string.split( adobe_glyph_list, '\n' ) glyphs = [] values = [] for line in lines: if line: fields = string.split( line, ';' ) # print fields[1] + ' - ' + fields[0] subfields = string.split( fields[1], ' ' ) if len( subfields ) == 1: glyphs.append( fields[0] ) values.append( fields[1] ) return glyphs, values def filter_glyph_names( alist, filter ): """filter `alist' by taking _out_ all glyph names that are in `filter'""" count = 0 extras = [] for name in alist: try: filtered_index = filter.index( name ) except: extras.append( name ) return extras def dump_encoding( file, encoding_name, encoding_list ): """dump a given encoding""" write = file.write write( " /* the following are indices into the SID name table */\n" ) write( " static const unsigned short " + encoding_name + "[" + repr( len( encoding_list ) ) + "] =\n" ) write( " {\n" ) line = " " comma = "" col = 0 for value in encoding_list: line += comma line += "%3d" % value comma = "," col += 1 if col == 16: col = 0 comma = ",\n " write( line + "\n };\n\n\n" ) def dump_array( the_array, write, array_name ): """dumps a given encoding""" write( " static const unsigned char " + array_name + "[" + repr( len( the_array ) ) + "L] =\n" ) write( " {\n" ) line = "" comma = " " col = 0 for value in the_array: line += comma line += "%3d" % ord( value ) comma = "," col += 1 if col == 16: col = 0 comma = ",\n " if len( line ) > 1024: write( line ) line = "" write( line + "\n };\n\n\n" ) def main(): """main program body""" if len( sys.argv ) != 2: print __doc__ % sys.argv[0] sys.exit( 1 ) file = open( sys.argv[1], "w\n" ) write = file.write count_sid = len( sid_standard_names ) # `mac_extras' contains the list of glyph names in the Macintosh standard # encoding which are not in the SID Standard Names. # mac_extras = filter_glyph_names( mac_standard_names, sid_standard_names ) # `base_list' contains the names of our final glyph names table. # It consists of the `mac_extras' glyph names, followed by the SID # standard names. # mac_extras_count = len( mac_extras ) base_list = mac_extras + sid_standard_names write( "/***************************************************************************/\n" ) write( "/* */\n" ) write( "/* %-71s*/\n" % os.path.basename( sys.argv[1] ) ) write( "/* */\n" ) write( "/* PostScript glyph names. */\n" ) write( "/* */\n" ) write( "/* Copyright 2005, 2008, 2011 by */\n" ) write( "/* David Turner, Robert Wilhelm, and Werner Lemberg. */\n" ) write( "/* */\n" ) write( "/* This file is part of the FreeType project, and may only be used, */\n" ) write( "/* modified, and distributed under the terms of the FreeType project */\n" ) write( "/* license, LICENSE.TXT. By continuing to use, modify, or distribute */\n" ) write( "/* this file you indicate that you have read the license and */\n" ) write( "/* understand and accept it fully. */\n" ) write( "/* */\n" ) write( "/***************************************************************************/\n" ) write( "\n" ) write( "\n" ) write( " /* This file has been generated automatically -- do not edit! */\n" ) write( "\n" ) write( "\n" ) # dump final glyph list (mac extras + sid standard names) # st = StringTable( base_list, "ft_standard_glyph_names" ) st.dump( file ) st.dump_sublist( file, "ft_mac_names", "FT_NUM_MAC_NAMES", mac_standard_names ) st.dump_sublist( file, "ft_sid_names", "FT_NUM_SID_NAMES", sid_standard_names ) dump_encoding( file, "t1_standard_encoding", t1_standard_encoding ) dump_encoding( file, "t1_expert_encoding", t1_expert_encoding ) # dump the AGL in its compressed form # agl_glyphs, agl_values = adobe_glyph_values() dict = StringNode( "", 0 ) for g in range( len( agl_glyphs ) ): dict.add( agl_glyphs[g], eval( "0x" + agl_values[g] ) ) dict = dict.optimize() dict_len = dict.locate( 0 ) dict_array = dict.store( "" ) write( """\ /* * This table is a compressed version of the Adobe Glyph List (AGL), * optimized for efficient searching. It has been generated by the * `glnames.py' python script located in the `src/tools' directory. * * The lookup function to get the Unicode value for a given string * is defined below the table. */ #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST """ ) dump_array( dict_array, write, "ft_adobe_glyph_list" ) # write the lookup routine now # write( """\ /* * This function searches the compressed table efficiently. */ static unsigned long ft_get_adobe_glyph_index( const char* name, const char* limit ) { int c = 0; int count, min, max; const unsigned char* p = ft_adobe_glyph_list; if ( name == 0 || name >= limit ) goto NotFound; c = *name++; count = p[1]; p += 2; min = 0; max = count; while ( min < max ) { int mid = ( min + max ) >> 1; const unsigned char* q = p + mid * 2; int c2; q = ft_adobe_glyph_list + ( ( (int)q[0] << 8 ) | q[1] ); c2 = q[0] & 127; if ( c2 == c ) { p = q; goto Found; } if ( c2 < c ) min = mid + 1; else max = mid; } goto NotFound; Found: for (;;) { /* assert (*p & 127) == c */ if ( name >= limit ) { if ( (p[0] & 128) == 0 && (p[1] & 128) != 0 ) return (unsigned long)( ( (int)p[2] << 8 ) | p[3] ); goto NotFound; } c = *name++; if ( p[0] & 128 ) { p++; if ( c != (p[0] & 127) ) goto NotFound; continue; } p++; count = p[0] & 127; if ( p[0] & 128 ) p += 2; p++; for ( ; count > 0; count--, p += 2 ) { int offset = ( (int)p[0] << 8 ) | p[1]; const unsigned char* q = ft_adobe_glyph_list + offset; if ( c == ( q[0] & 127 ) ) { p = q; goto NextIter; } } goto NotFound; NextIter: ; } NotFound: return 0; } #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ """ ) if 0: # generate unit test, or don't # # now write the unit test to check that everything works OK # write( "#ifdef TEST\n\n" ) write( "static const char* const the_names[] = {\n" ) for name in agl_glyphs: write( ' "' + name + '",\n' ) write( " 0\n};\n" ) write( "static const unsigned long the_values[] = {\n" ) for val in agl_values: write( ' 0x' + val + ',\n' ) write( " 0\n};\n" ) write( """ #include <stdlib.h> #include <stdio.h> int main( void ) { int result = 0; const char* const* names = the_names; const unsigned long* values = the_values; for ( ; *names; names++, values++ ) { const char* name = *names; unsigned long reference = *values; unsigned long value; value = ft_get_adobe_glyph_index( name, name + strlen( name ) ); if ( value != reference ) { result = 1; fprintf( stderr, "name '%s' => %04x instead of %04x\\n", name, value, reference ); } } return result; } """ ) write( "#endif /* TEST */\n" ) write("\n/* END */\n") # Now run the main routine # main() # END
Python
#!/usr/bin/env python # # Check trace components in FreeType 2 source. # Author: suzuki toshiya, 2009 # # This code is explicitly into the public domain. import sys import os import re SRC_FILE_LIST = [] USED_COMPONENT = {} KNOWN_COMPONENT = {} SRC_FILE_DIRS = [ "src" ] TRACE_DEF_FILES = [ "include/freetype/internal/fttrace.h" ] # -------------------------------------------------------------- # Parse command line options # for i in range( 1, len( sys.argv ) ): if sys.argv[i].startswith( "--help" ): print "Usage: %s [option]" % sys.argv[0] print "Search used-but-defined and defined-but-not-used trace_XXX macros" print "" print " --help:" print " Show this help" print "" print " --src-dirs=dir1:dir2:..." print " Specify the directories of C source files to be checked" print " Default is %s" % ":".join( SRC_FILE_DIRS ) print "" print " --def-files=file1:file2:..." print " Specify the header files including FT_TRACE_DEF()" print " Default is %s" % ":".join( TRACE_DEF_FILES ) print "" exit(0) if sys.argv[i].startswith( "--src-dirs=" ): SRC_FILE_DIRS = sys.argv[i].replace( "--src-dirs=", "", 1 ).split( ":" ) elif sys.argv[i].startswith( "--def-files=" ): TRACE_DEF_FILES = sys.argv[i].replace( "--def-files=", "", 1 ).split( ":" ) # -------------------------------------------------------------- # Scan C source and header files using trace macros. # c_pathname_pat = re.compile( '^.*\.[ch]$', re.IGNORECASE ) trace_use_pat = re.compile( '^[ \t]*#define[ \t]+FT_COMPONENT[ \t]+trace_' ) for d in SRC_FILE_DIRS: for ( p, dlst, flst ) in os.walk( d ): for f in flst: if c_pathname_pat.match( f ) != None: src_pathname = os.path.join( p, f ) line_num = 0 for src_line in open( src_pathname, 'r' ): line_num = line_num + 1 src_line = src_line.strip() if trace_use_pat.match( src_line ) != None: component_name = trace_use_pat.sub( '', src_line ) if component_name in USED_COMPONENT: USED_COMPONENT[component_name].append( "%s:%d" % ( src_pathname, line_num ) ) else: USED_COMPONENT[component_name] = [ "%s:%d" % ( src_pathname, line_num ) ] # -------------------------------------------------------------- # Scan header file(s) defining trace macros. # trace_def_pat_opn = re.compile( '^.*FT_TRACE_DEF[ \t]*\([ \t]*' ) trace_def_pat_cls = re.compile( '[ \t\)].*$' ) for f in TRACE_DEF_FILES: line_num = 0 for hdr_line in open( f, 'r' ): line_num = line_num + 1 hdr_line = hdr_line.strip() if trace_def_pat_opn.match( hdr_line ) != None: component_name = trace_def_pat_opn.sub( '', hdr_line ) component_name = trace_def_pat_cls.sub( '', component_name ) if component_name in KNOWN_COMPONENT: print "trace component %s is defined twice, see %s and fttrace.h:%d" % \ ( component_name, KNOWN_COMPONENT[component_name], line_num ) else: KNOWN_COMPONENT[component_name] = "%s:%d" % \ ( os.path.basename( f ), line_num ) # -------------------------------------------------------------- # Compare the used and defined trace macros. # print "# Trace component used in the implementations but not defined in fttrace.h." cmpnt = USED_COMPONENT.keys() cmpnt.sort() for c in cmpnt: if c not in KNOWN_COMPONENT: print "Trace component %s (used in %s) is not defined." % ( c, ", ".join( USED_COMPONENT[c] ) ) print "# Trace component is defined but not used in the implementations." cmpnt = KNOWN_COMPONENT.keys() cmpnt.sort() for c in cmpnt: if c not in USED_COMPONENT: if c != "any": print "Trace component %s (defined in %s) is not used." % ( c, KNOWN_COMPONENT[c] )
Python
#!/usr/bin/env python # # # FreeType 2 glyph name builder # # Copyright 1996-2000, 2003, 2005, 2007, 2008, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, # and distributed under the terms of the FreeType project license, # LICENSE.TXT. By continuing to use, modify, or distribute this file you # indicate that you have read the license and understand and accept it # fully. """\ usage: %s <output-file> This python script generates the glyph names tables defined in the `psnames' module. Its single argument is the name of the header file to be created. """ import sys, string, struct, re, os.path # This table lists the glyphs according to the Macintosh specification. # It is used by the TrueType Postscript names table. # # See # # http://fonts.apple.com/TTRefMan/RM06/Chap6post.html # # for the official list. # mac_standard_names = \ [ # 0 ".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", # 10 "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", # 20 "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", # 30 "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", # 40 "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", # 50 "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", # 60 "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", # 70 "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", # 80 "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", # 90 "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", # 100 "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", # 110 "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", # 120 "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", # 130 "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", # 140 "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", # 150 "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", # 160 "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", # 170 "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", # 180 "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", # 190 "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", # 200 "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", # 210 "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", # 220 "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", # 230 "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", # 240 "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", # 250 "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat" ] # The list of standard `SID' glyph names. For the official list, # see Annex A of document at # # http://partners.adobe.com/public/developer/en/font/5176.CFF.pdf . # sid_standard_names = \ [ # 0 ".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", # 10 "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", # 20 "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", # 30 "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", # 40 "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", # 50 "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", # 60 "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", # 70 "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", # 80 "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", # 90 "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", # 100 "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", # 110 "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", # 120 "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", # 130 "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", # 140 "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", # 150 "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", # 160 "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", # 170 "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", # 180 "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", # 190 "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", # 200 "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", # 210 "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", # 220 "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", # 230 "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", # 240 "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", # 250 "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", # 260 "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", # 270 "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", # 280 "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", # 290 "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", # 300 "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", # 310 "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", # 320 "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", # 330 "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", # 340 "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", # 350 "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", # 360 "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", # 370 "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", # 380 "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", # 390 "Semibold" ] # This table maps character codes of the Adobe Standard Type 1 # encoding to glyph indices in the sid_standard_names table. # t1_standard_encoding = \ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 0, 111, 112, 113, 114, 0, 115, 116, 117, 118, 119, 120, 121, 122, 0, 123, 0, 124, 125, 126, 127, 128, 129, 130, 131, 0, 132, 133, 0, 134, 135, 136, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 139, 0, 0, 0, 0, 140, 141, 142, 143, 0, 0, 0, 0, 0, 144, 0, 0, 0, 145, 0, 0, 146, 147, 148, 149, 0, 0, 0, 0 ] # This table maps character codes of the Adobe Expert Type 1 # encoding to glyph indices in the sid_standard_names table. # t1_expert_encoding = \ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 229, 230, 0, 231, 232, 233, 234, 235, 236, 237, 238, 13, 14, 15, 99, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 27, 28, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 0, 0, 0, 258, 0, 0, 259, 260, 261, 262, 0, 0, 263, 264, 265, 0, 266, 109, 110, 267, 268, 269, 0, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 304, 305, 306, 0, 0, 307, 308, 309, 310, 311, 0, 312, 0, 0, 313, 0, 0, 314, 315, 0, 0, 316, 317, 318, 0, 0, 0, 158, 155, 163, 319, 320, 321, 322, 323, 324, 325, 0, 0, 326, 150, 164, 169, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378 ] # This data has been taken literally from the files `glyphlist.txt' # and `zapfdingbats.txt' version 2.0, Sept 2002. It is available from # # http://sourceforge.net/adobe/aglfn/ # adobe_glyph_list = """\ A;0041 AE;00C6 AEacute;01FC AEmacron;01E2 AEsmall;F7E6 Aacute;00C1 Aacutesmall;F7E1 Abreve;0102 Abreveacute;1EAE Abrevecyrillic;04D0 Abrevedotbelow;1EB6 Abrevegrave;1EB0 Abrevehookabove;1EB2 Abrevetilde;1EB4 Acaron;01CD Acircle;24B6 Acircumflex;00C2 Acircumflexacute;1EA4 Acircumflexdotbelow;1EAC Acircumflexgrave;1EA6 Acircumflexhookabove;1EA8 Acircumflexsmall;F7E2 Acircumflextilde;1EAA Acute;F6C9 Acutesmall;F7B4 Acyrillic;0410 Adblgrave;0200 Adieresis;00C4 Adieresiscyrillic;04D2 Adieresismacron;01DE Adieresissmall;F7E4 Adotbelow;1EA0 Adotmacron;01E0 Agrave;00C0 Agravesmall;F7E0 Ahookabove;1EA2 Aiecyrillic;04D4 Ainvertedbreve;0202 Alpha;0391 Alphatonos;0386 Amacron;0100 Amonospace;FF21 Aogonek;0104 Aring;00C5 Aringacute;01FA Aringbelow;1E00 Aringsmall;F7E5 Asmall;F761 Atilde;00C3 Atildesmall;F7E3 Aybarmenian;0531 B;0042 Bcircle;24B7 Bdotaccent;1E02 Bdotbelow;1E04 Becyrillic;0411 Benarmenian;0532 Beta;0392 Bhook;0181 Blinebelow;1E06 Bmonospace;FF22 Brevesmall;F6F4 Bsmall;F762 Btopbar;0182 C;0043 Caarmenian;053E Cacute;0106 Caron;F6CA Caronsmall;F6F5 Ccaron;010C Ccedilla;00C7 Ccedillaacute;1E08 Ccedillasmall;F7E7 Ccircle;24B8 Ccircumflex;0108 Cdot;010A Cdotaccent;010A Cedillasmall;F7B8 Chaarmenian;0549 Cheabkhasiancyrillic;04BC Checyrillic;0427 Chedescenderabkhasiancyrillic;04BE Chedescendercyrillic;04B6 Chedieresiscyrillic;04F4 Cheharmenian;0543 Chekhakassiancyrillic;04CB Cheverticalstrokecyrillic;04B8 Chi;03A7 Chook;0187 Circumflexsmall;F6F6 Cmonospace;FF23 Coarmenian;0551 Csmall;F763 D;0044 DZ;01F1 DZcaron;01C4 Daarmenian;0534 Dafrican;0189 Dcaron;010E Dcedilla;1E10 Dcircle;24B9 Dcircumflexbelow;1E12 Dcroat;0110 Ddotaccent;1E0A Ddotbelow;1E0C Decyrillic;0414 Deicoptic;03EE Delta;2206 Deltagreek;0394 Dhook;018A Dieresis;F6CB DieresisAcute;F6CC DieresisGrave;F6CD Dieresissmall;F7A8 Digammagreek;03DC Djecyrillic;0402 Dlinebelow;1E0E Dmonospace;FF24 Dotaccentsmall;F6F7 Dslash;0110 Dsmall;F764 Dtopbar;018B Dz;01F2 Dzcaron;01C5 Dzeabkhasiancyrillic;04E0 Dzecyrillic;0405 Dzhecyrillic;040F E;0045 Eacute;00C9 Eacutesmall;F7E9 Ebreve;0114 Ecaron;011A Ecedillabreve;1E1C Echarmenian;0535 Ecircle;24BA Ecircumflex;00CA Ecircumflexacute;1EBE Ecircumflexbelow;1E18 Ecircumflexdotbelow;1EC6 Ecircumflexgrave;1EC0 Ecircumflexhookabove;1EC2 Ecircumflexsmall;F7EA Ecircumflextilde;1EC4 Ecyrillic;0404 Edblgrave;0204 Edieresis;00CB Edieresissmall;F7EB Edot;0116 Edotaccent;0116 Edotbelow;1EB8 Efcyrillic;0424 Egrave;00C8 Egravesmall;F7E8 Eharmenian;0537 Ehookabove;1EBA Eightroman;2167 Einvertedbreve;0206 Eiotifiedcyrillic;0464 Elcyrillic;041B Elevenroman;216A Emacron;0112 Emacronacute;1E16 Emacrongrave;1E14 Emcyrillic;041C Emonospace;FF25 Encyrillic;041D Endescendercyrillic;04A2 Eng;014A Enghecyrillic;04A4 Enhookcyrillic;04C7 Eogonek;0118 Eopen;0190 Epsilon;0395 Epsilontonos;0388 Ercyrillic;0420 Ereversed;018E Ereversedcyrillic;042D Escyrillic;0421 Esdescendercyrillic;04AA Esh;01A9 Esmall;F765 Eta;0397 Etarmenian;0538 Etatonos;0389 Eth;00D0 Ethsmall;F7F0 Etilde;1EBC Etildebelow;1E1A Euro;20AC Ezh;01B7 Ezhcaron;01EE Ezhreversed;01B8 F;0046 Fcircle;24BB Fdotaccent;1E1E Feharmenian;0556 Feicoptic;03E4 Fhook;0191 Fitacyrillic;0472 Fiveroman;2164 Fmonospace;FF26 Fourroman;2163 Fsmall;F766 G;0047 GBsquare;3387 Gacute;01F4 Gamma;0393 Gammaafrican;0194 Gangiacoptic;03EA Gbreve;011E Gcaron;01E6 Gcedilla;0122 Gcircle;24BC Gcircumflex;011C Gcommaaccent;0122 Gdot;0120 Gdotaccent;0120 Gecyrillic;0413 Ghadarmenian;0542 Ghemiddlehookcyrillic;0494 Ghestrokecyrillic;0492 Gheupturncyrillic;0490 Ghook;0193 Gimarmenian;0533 Gjecyrillic;0403 Gmacron;1E20 Gmonospace;FF27 Grave;F6CE Gravesmall;F760 Gsmall;F767 Gsmallhook;029B Gstroke;01E4 H;0048 H18533;25CF H18543;25AA H18551;25AB H22073;25A1 HPsquare;33CB Haabkhasiancyrillic;04A8 Hadescendercyrillic;04B2 Hardsigncyrillic;042A Hbar;0126 Hbrevebelow;1E2A Hcedilla;1E28 Hcircle;24BD Hcircumflex;0124 Hdieresis;1E26 Hdotaccent;1E22 Hdotbelow;1E24 Hmonospace;FF28 Hoarmenian;0540 Horicoptic;03E8 Hsmall;F768 Hungarumlaut;F6CF Hungarumlautsmall;F6F8 Hzsquare;3390 I;0049 IAcyrillic;042F IJ;0132 IUcyrillic;042E Iacute;00CD Iacutesmall;F7ED Ibreve;012C Icaron;01CF Icircle;24BE Icircumflex;00CE Icircumflexsmall;F7EE Icyrillic;0406 Idblgrave;0208 Idieresis;00CF Idieresisacute;1E2E Idieresiscyrillic;04E4 Idieresissmall;F7EF Idot;0130 Idotaccent;0130 Idotbelow;1ECA Iebrevecyrillic;04D6 Iecyrillic;0415 Ifraktur;2111 Igrave;00CC Igravesmall;F7EC Ihookabove;1EC8 Iicyrillic;0418 Iinvertedbreve;020A Iishortcyrillic;0419 Imacron;012A Imacroncyrillic;04E2 Imonospace;FF29 Iniarmenian;053B Iocyrillic;0401 Iogonek;012E Iota;0399 Iotaafrican;0196 Iotadieresis;03AA Iotatonos;038A Ismall;F769 Istroke;0197 Itilde;0128 Itildebelow;1E2C Izhitsacyrillic;0474 Izhitsadblgravecyrillic;0476 J;004A Jaarmenian;0541 Jcircle;24BF Jcircumflex;0134 Jecyrillic;0408 Jheharmenian;054B Jmonospace;FF2A Jsmall;F76A K;004B KBsquare;3385 KKsquare;33CD Kabashkircyrillic;04A0 Kacute;1E30 Kacyrillic;041A Kadescendercyrillic;049A Kahookcyrillic;04C3 Kappa;039A Kastrokecyrillic;049E Kaverticalstrokecyrillic;049C Kcaron;01E8 Kcedilla;0136 Kcircle;24C0 Kcommaaccent;0136 Kdotbelow;1E32 Keharmenian;0554 Kenarmenian;053F Khacyrillic;0425 Kheicoptic;03E6 Khook;0198 Kjecyrillic;040C Klinebelow;1E34 Kmonospace;FF2B Koppacyrillic;0480 Koppagreek;03DE Ksicyrillic;046E Ksmall;F76B L;004C LJ;01C7 LL;F6BF Lacute;0139 Lambda;039B Lcaron;013D Lcedilla;013B Lcircle;24C1 Lcircumflexbelow;1E3C Lcommaaccent;013B Ldot;013F Ldotaccent;013F Ldotbelow;1E36 Ldotbelowmacron;1E38 Liwnarmenian;053C Lj;01C8 Ljecyrillic;0409 Llinebelow;1E3A Lmonospace;FF2C Lslash;0141 Lslashsmall;F6F9 Lsmall;F76C M;004D MBsquare;3386 Macron;F6D0 Macronsmall;F7AF Macute;1E3E Mcircle;24C2 Mdotaccent;1E40 Mdotbelow;1E42 Menarmenian;0544 Mmonospace;FF2D Msmall;F76D Mturned;019C Mu;039C N;004E NJ;01CA Nacute;0143 Ncaron;0147 Ncedilla;0145 Ncircle;24C3 Ncircumflexbelow;1E4A Ncommaaccent;0145 Ndotaccent;1E44 Ndotbelow;1E46 Nhookleft;019D Nineroman;2168 Nj;01CB Njecyrillic;040A Nlinebelow;1E48 Nmonospace;FF2E Nowarmenian;0546 Nsmall;F76E Ntilde;00D1 Ntildesmall;F7F1 Nu;039D O;004F OE;0152 OEsmall;F6FA Oacute;00D3 Oacutesmall;F7F3 Obarredcyrillic;04E8 Obarreddieresiscyrillic;04EA Obreve;014E Ocaron;01D1 Ocenteredtilde;019F Ocircle;24C4 Ocircumflex;00D4 Ocircumflexacute;1ED0 Ocircumflexdotbelow;1ED8 Ocircumflexgrave;1ED2 Ocircumflexhookabove;1ED4 Ocircumflexsmall;F7F4 Ocircumflextilde;1ED6 Ocyrillic;041E Odblacute;0150 Odblgrave;020C Odieresis;00D6 Odieresiscyrillic;04E6 Odieresissmall;F7F6 Odotbelow;1ECC Ogoneksmall;F6FB Ograve;00D2 Ogravesmall;F7F2 Oharmenian;0555 Ohm;2126 Ohookabove;1ECE Ohorn;01A0 Ohornacute;1EDA Ohorndotbelow;1EE2 Ohorngrave;1EDC Ohornhookabove;1EDE Ohorntilde;1EE0 Ohungarumlaut;0150 Oi;01A2 Oinvertedbreve;020E Omacron;014C Omacronacute;1E52 Omacrongrave;1E50 Omega;2126 Omegacyrillic;0460 Omegagreek;03A9 Omegaroundcyrillic;047A Omegatitlocyrillic;047C Omegatonos;038F Omicron;039F Omicrontonos;038C Omonospace;FF2F Oneroman;2160 Oogonek;01EA Oogonekmacron;01EC Oopen;0186 Oslash;00D8 Oslashacute;01FE Oslashsmall;F7F8 Osmall;F76F Ostrokeacute;01FE Otcyrillic;047E Otilde;00D5 Otildeacute;1E4C Otildedieresis;1E4E Otildesmall;F7F5 P;0050 Pacute;1E54 Pcircle;24C5 Pdotaccent;1E56 Pecyrillic;041F Peharmenian;054A Pemiddlehookcyrillic;04A6 Phi;03A6 Phook;01A4 Pi;03A0 Piwrarmenian;0553 Pmonospace;FF30 Psi;03A8 Psicyrillic;0470 Psmall;F770 Q;0051 Qcircle;24C6 Qmonospace;FF31 Qsmall;F771 R;0052 Raarmenian;054C Racute;0154 Rcaron;0158 Rcedilla;0156 Rcircle;24C7 Rcommaaccent;0156 Rdblgrave;0210 Rdotaccent;1E58 Rdotbelow;1E5A Rdotbelowmacron;1E5C Reharmenian;0550 Rfraktur;211C Rho;03A1 Ringsmall;F6FC Rinvertedbreve;0212 Rlinebelow;1E5E Rmonospace;FF32 Rsmall;F772 Rsmallinverted;0281 Rsmallinvertedsuperior;02B6 S;0053 SF010000;250C SF020000;2514 SF030000;2510 SF040000;2518 SF050000;253C SF060000;252C SF070000;2534 SF080000;251C SF090000;2524 SF100000;2500 SF110000;2502 SF190000;2561 SF200000;2562 SF210000;2556 SF220000;2555 SF230000;2563 SF240000;2551 SF250000;2557 SF260000;255D SF270000;255C SF280000;255B SF360000;255E SF370000;255F SF380000;255A SF390000;2554 SF400000;2569 SF410000;2566 SF420000;2560 SF430000;2550 SF440000;256C SF450000;2567 SF460000;2568 SF470000;2564 SF480000;2565 SF490000;2559 SF500000;2558 SF510000;2552 SF520000;2553 SF530000;256B SF540000;256A Sacute;015A Sacutedotaccent;1E64 Sampigreek;03E0 Scaron;0160 Scarondotaccent;1E66 Scaronsmall;F6FD Scedilla;015E Schwa;018F Schwacyrillic;04D8 Schwadieresiscyrillic;04DA Scircle;24C8 Scircumflex;015C Scommaaccent;0218 Sdotaccent;1E60 Sdotbelow;1E62 Sdotbelowdotaccent;1E68 Seharmenian;054D Sevenroman;2166 Shaarmenian;0547 Shacyrillic;0428 Shchacyrillic;0429 Sheicoptic;03E2 Shhacyrillic;04BA Shimacoptic;03EC Sigma;03A3 Sixroman;2165 Smonospace;FF33 Softsigncyrillic;042C Ssmall;F773 Stigmagreek;03DA T;0054 Tau;03A4 Tbar;0166 Tcaron;0164 Tcedilla;0162 Tcircle;24C9 Tcircumflexbelow;1E70 Tcommaaccent;0162 Tdotaccent;1E6A Tdotbelow;1E6C Tecyrillic;0422 Tedescendercyrillic;04AC Tenroman;2169 Tetsecyrillic;04B4 Theta;0398 Thook;01AC Thorn;00DE Thornsmall;F7FE Threeroman;2162 Tildesmall;F6FE Tiwnarmenian;054F Tlinebelow;1E6E Tmonospace;FF34 Toarmenian;0539 Tonefive;01BC Tonesix;0184 Tonetwo;01A7 Tretroflexhook;01AE Tsecyrillic;0426 Tshecyrillic;040B Tsmall;F774 Twelveroman;216B Tworoman;2161 U;0055 Uacute;00DA Uacutesmall;F7FA Ubreve;016C Ucaron;01D3 Ucircle;24CA Ucircumflex;00DB Ucircumflexbelow;1E76 Ucircumflexsmall;F7FB Ucyrillic;0423 Udblacute;0170 Udblgrave;0214 Udieresis;00DC Udieresisacute;01D7 Udieresisbelow;1E72 Udieresiscaron;01D9 Udieresiscyrillic;04F0 Udieresisgrave;01DB Udieresismacron;01D5 Udieresissmall;F7FC Udotbelow;1EE4 Ugrave;00D9 Ugravesmall;F7F9 Uhookabove;1EE6 Uhorn;01AF Uhornacute;1EE8 Uhorndotbelow;1EF0 Uhorngrave;1EEA Uhornhookabove;1EEC Uhorntilde;1EEE Uhungarumlaut;0170 Uhungarumlautcyrillic;04F2 Uinvertedbreve;0216 Ukcyrillic;0478 Umacron;016A Umacroncyrillic;04EE Umacrondieresis;1E7A Umonospace;FF35 Uogonek;0172 Upsilon;03A5 Upsilon1;03D2 Upsilonacutehooksymbolgreek;03D3 Upsilonafrican;01B1 Upsilondieresis;03AB Upsilondieresishooksymbolgreek;03D4 Upsilonhooksymbol;03D2 Upsilontonos;038E Uring;016E Ushortcyrillic;040E Usmall;F775 Ustraightcyrillic;04AE Ustraightstrokecyrillic;04B0 Utilde;0168 Utildeacute;1E78 Utildebelow;1E74 V;0056 Vcircle;24CB Vdotbelow;1E7E Vecyrillic;0412 Vewarmenian;054E Vhook;01B2 Vmonospace;FF36 Voarmenian;0548 Vsmall;F776 Vtilde;1E7C W;0057 Wacute;1E82 Wcircle;24CC Wcircumflex;0174 Wdieresis;1E84 Wdotaccent;1E86 Wdotbelow;1E88 Wgrave;1E80 Wmonospace;FF37 Wsmall;F777 X;0058 Xcircle;24CD Xdieresis;1E8C Xdotaccent;1E8A Xeharmenian;053D Xi;039E Xmonospace;FF38 Xsmall;F778 Y;0059 Yacute;00DD Yacutesmall;F7FD Yatcyrillic;0462 Ycircle;24CE Ycircumflex;0176 Ydieresis;0178 Ydieresissmall;F7FF Ydotaccent;1E8E Ydotbelow;1EF4 Yericyrillic;042B Yerudieresiscyrillic;04F8 Ygrave;1EF2 Yhook;01B3 Yhookabove;1EF6 Yiarmenian;0545 Yicyrillic;0407 Yiwnarmenian;0552 Ymonospace;FF39 Ysmall;F779 Ytilde;1EF8 Yusbigcyrillic;046A Yusbigiotifiedcyrillic;046C Yuslittlecyrillic;0466 Yuslittleiotifiedcyrillic;0468 Z;005A Zaarmenian;0536 Zacute;0179 Zcaron;017D Zcaronsmall;F6FF Zcircle;24CF Zcircumflex;1E90 Zdot;017B Zdotaccent;017B Zdotbelow;1E92 Zecyrillic;0417 Zedescendercyrillic;0498 Zedieresiscyrillic;04DE Zeta;0396 Zhearmenian;053A Zhebrevecyrillic;04C1 Zhecyrillic;0416 Zhedescendercyrillic;0496 Zhedieresiscyrillic;04DC Zlinebelow;1E94 Zmonospace;FF3A Zsmall;F77A Zstroke;01B5 a;0061 aabengali;0986 aacute;00E1 aadeva;0906 aagujarati;0A86 aagurmukhi;0A06 aamatragurmukhi;0A3E aarusquare;3303 aavowelsignbengali;09BE aavowelsigndeva;093E aavowelsigngujarati;0ABE abbreviationmarkarmenian;055F abbreviationsigndeva;0970 abengali;0985 abopomofo;311A abreve;0103 abreveacute;1EAF abrevecyrillic;04D1 abrevedotbelow;1EB7 abrevegrave;1EB1 abrevehookabove;1EB3 abrevetilde;1EB5 acaron;01CE acircle;24D0 acircumflex;00E2 acircumflexacute;1EA5 acircumflexdotbelow;1EAD acircumflexgrave;1EA7 acircumflexhookabove;1EA9 acircumflextilde;1EAB acute;00B4 acutebelowcmb;0317 acutecmb;0301 acutecomb;0301 acutedeva;0954 acutelowmod;02CF acutetonecmb;0341 acyrillic;0430 adblgrave;0201 addakgurmukhi;0A71 adeva;0905 adieresis;00E4 adieresiscyrillic;04D3 adieresismacron;01DF adotbelow;1EA1 adotmacron;01E1 ae;00E6 aeacute;01FD aekorean;3150 aemacron;01E3 afii00208;2015 afii08941;20A4 afii10017;0410 afii10018;0411 afii10019;0412 afii10020;0413 afii10021;0414 afii10022;0415 afii10023;0401 afii10024;0416 afii10025;0417 afii10026;0418 afii10027;0419 afii10028;041A afii10029;041B afii10030;041C afii10031;041D afii10032;041E afii10033;041F afii10034;0420 afii10035;0421 afii10036;0422 afii10037;0423 afii10038;0424 afii10039;0425 afii10040;0426 afii10041;0427 afii10042;0428 afii10043;0429 afii10044;042A afii10045;042B afii10046;042C afii10047;042D afii10048;042E afii10049;042F afii10050;0490 afii10051;0402 afii10052;0403 afii10053;0404 afii10054;0405 afii10055;0406 afii10056;0407 afii10057;0408 afii10058;0409 afii10059;040A afii10060;040B afii10061;040C afii10062;040E afii10063;F6C4 afii10064;F6C5 afii10065;0430 afii10066;0431 afii10067;0432 afii10068;0433 afii10069;0434 afii10070;0435 afii10071;0451 afii10072;0436 afii10073;0437 afii10074;0438 afii10075;0439 afii10076;043A afii10077;043B afii10078;043C afii10079;043D afii10080;043E afii10081;043F afii10082;0440 afii10083;0441 afii10084;0442 afii10085;0443 afii10086;0444 afii10087;0445 afii10088;0446 afii10089;0447 afii10090;0448 afii10091;0449 afii10092;044A afii10093;044B afii10094;044C afii10095;044D afii10096;044E afii10097;044F afii10098;0491 afii10099;0452 afii10100;0453 afii10101;0454 afii10102;0455 afii10103;0456 afii10104;0457 afii10105;0458 afii10106;0459 afii10107;045A afii10108;045B afii10109;045C afii10110;045E afii10145;040F afii10146;0462 afii10147;0472 afii10148;0474 afii10192;F6C6 afii10193;045F afii10194;0463 afii10195;0473 afii10196;0475 afii10831;F6C7 afii10832;F6C8 afii10846;04D9 afii299;200E afii300;200F afii301;200D afii57381;066A afii57388;060C afii57392;0660 afii57393;0661 afii57394;0662 afii57395;0663 afii57396;0664 afii57397;0665 afii57398;0666 afii57399;0667 afii57400;0668 afii57401;0669 afii57403;061B afii57407;061F afii57409;0621 afii57410;0622 afii57411;0623 afii57412;0624 afii57413;0625 afii57414;0626 afii57415;0627 afii57416;0628 afii57417;0629 afii57418;062A afii57419;062B afii57420;062C afii57421;062D afii57422;062E afii57423;062F afii57424;0630 afii57425;0631 afii57426;0632 afii57427;0633 afii57428;0634 afii57429;0635 afii57430;0636 afii57431;0637 afii57432;0638 afii57433;0639 afii57434;063A afii57440;0640 afii57441;0641 afii57442;0642 afii57443;0643 afii57444;0644 afii57445;0645 afii57446;0646 afii57448;0648 afii57449;0649 afii57450;064A afii57451;064B afii57452;064C afii57453;064D afii57454;064E afii57455;064F afii57456;0650 afii57457;0651 afii57458;0652 afii57470;0647 afii57505;06A4 afii57506;067E afii57507;0686 afii57508;0698 afii57509;06AF afii57511;0679 afii57512;0688 afii57513;0691 afii57514;06BA afii57519;06D2 afii57534;06D5 afii57636;20AA afii57645;05BE afii57658;05C3 afii57664;05D0 afii57665;05D1 afii57666;05D2 afii57667;05D3 afii57668;05D4 afii57669;05D5 afii57670;05D6 afii57671;05D7 afii57672;05D8 afii57673;05D9 afii57674;05DA afii57675;05DB afii57676;05DC afii57677;05DD afii57678;05DE afii57679;05DF afii57680;05E0 afii57681;05E1 afii57682;05E2 afii57683;05E3 afii57684;05E4 afii57685;05E5 afii57686;05E6 afii57687;05E7 afii57688;05E8 afii57689;05E9 afii57690;05EA afii57694;FB2A afii57695;FB2B afii57700;FB4B afii57705;FB1F afii57716;05F0 afii57717;05F1 afii57718;05F2 afii57723;FB35 afii57793;05B4 afii57794;05B5 afii57795;05B6 afii57796;05BB afii57797;05B8 afii57798;05B7 afii57799;05B0 afii57800;05B2 afii57801;05B1 afii57802;05B3 afii57803;05C2 afii57804;05C1 afii57806;05B9 afii57807;05BC afii57839;05BD afii57841;05BF afii57842;05C0 afii57929;02BC afii61248;2105 afii61289;2113 afii61352;2116 afii61573;202C afii61574;202D afii61575;202E afii61664;200C afii63167;066D afii64937;02BD agrave;00E0 agujarati;0A85 agurmukhi;0A05 ahiragana;3042 ahookabove;1EA3 aibengali;0990 aibopomofo;311E aideva;0910 aiecyrillic;04D5 aigujarati;0A90 aigurmukhi;0A10 aimatragurmukhi;0A48 ainarabic;0639 ainfinalarabic;FECA aininitialarabic;FECB ainmedialarabic;FECC ainvertedbreve;0203 aivowelsignbengali;09C8 aivowelsigndeva;0948 aivowelsigngujarati;0AC8 akatakana;30A2 akatakanahalfwidth;FF71 akorean;314F alef;05D0 alefarabic;0627 alefdageshhebrew;FB30 aleffinalarabic;FE8E alefhamzaabovearabic;0623 alefhamzaabovefinalarabic;FE84 alefhamzabelowarabic;0625 alefhamzabelowfinalarabic;FE88 alefhebrew;05D0 aleflamedhebrew;FB4F alefmaddaabovearabic;0622 alefmaddaabovefinalarabic;FE82 alefmaksuraarabic;0649 alefmaksurafinalarabic;FEF0 alefmaksurainitialarabic;FEF3 alefmaksuramedialarabic;FEF4 alefpatahhebrew;FB2E alefqamatshebrew;FB2F aleph;2135 allequal;224C alpha;03B1 alphatonos;03AC amacron;0101 amonospace;FF41 ampersand;0026 ampersandmonospace;FF06 ampersandsmall;F726 amsquare;33C2 anbopomofo;3122 angbopomofo;3124 angkhankhuthai;0E5A angle;2220 anglebracketleft;3008 anglebracketleftvertical;FE3F anglebracketright;3009 anglebracketrightvertical;FE40 angleleft;2329 angleright;232A angstrom;212B anoteleia;0387 anudattadeva;0952 anusvarabengali;0982 anusvaradeva;0902 anusvaragujarati;0A82 aogonek;0105 apaatosquare;3300 aparen;249C apostrophearmenian;055A apostrophemod;02BC apple;F8FF approaches;2250 approxequal;2248 approxequalorimage;2252 approximatelyequal;2245 araeaekorean;318E araeakorean;318D arc;2312 arighthalfring;1E9A aring;00E5 aringacute;01FB aringbelow;1E01 arrowboth;2194 arrowdashdown;21E3 arrowdashleft;21E0 arrowdashright;21E2 arrowdashup;21E1 arrowdblboth;21D4 arrowdbldown;21D3 arrowdblleft;21D0 arrowdblright;21D2 arrowdblup;21D1 arrowdown;2193 arrowdownleft;2199 arrowdownright;2198 arrowdownwhite;21E9 arrowheaddownmod;02C5 arrowheadleftmod;02C2 arrowheadrightmod;02C3 arrowheadupmod;02C4 arrowhorizex;F8E7 arrowleft;2190 arrowleftdbl;21D0 arrowleftdblstroke;21CD arrowleftoverright;21C6 arrowleftwhite;21E6 arrowright;2192 arrowrightdblstroke;21CF arrowrightheavy;279E arrowrightoverleft;21C4 arrowrightwhite;21E8 arrowtableft;21E4 arrowtabright;21E5 arrowup;2191 arrowupdn;2195 arrowupdnbse;21A8 arrowupdownbase;21A8 arrowupleft;2196 arrowupleftofdown;21C5 arrowupright;2197 arrowupwhite;21E7 arrowvertex;F8E6 asciicircum;005E asciicircummonospace;FF3E asciitilde;007E asciitildemonospace;FF5E ascript;0251 ascriptturned;0252 asmallhiragana;3041 asmallkatakana;30A1 asmallkatakanahalfwidth;FF67 asterisk;002A asteriskaltonearabic;066D asteriskarabic;066D asteriskmath;2217 asteriskmonospace;FF0A asterisksmall;FE61 asterism;2042 asuperior;F6E9 asymptoticallyequal;2243 at;0040 atilde;00E3 atmonospace;FF20 atsmall;FE6B aturned;0250 aubengali;0994 aubopomofo;3120 audeva;0914 augujarati;0A94 augurmukhi;0A14 aulengthmarkbengali;09D7 aumatragurmukhi;0A4C auvowelsignbengali;09CC auvowelsigndeva;094C auvowelsigngujarati;0ACC avagrahadeva;093D aybarmenian;0561 ayin;05E2 ayinaltonehebrew;FB20 ayinhebrew;05E2 b;0062 babengali;09AC backslash;005C backslashmonospace;FF3C badeva;092C bagujarati;0AAC bagurmukhi;0A2C bahiragana;3070 bahtthai;0E3F bakatakana;30D0 bar;007C barmonospace;FF5C bbopomofo;3105 bcircle;24D1 bdotaccent;1E03 bdotbelow;1E05 beamedsixteenthnotes;266C because;2235 becyrillic;0431 beharabic;0628 behfinalarabic;FE90 behinitialarabic;FE91 behiragana;3079 behmedialarabic;FE92 behmeeminitialarabic;FC9F behmeemisolatedarabic;FC08 behnoonfinalarabic;FC6D bekatakana;30D9 benarmenian;0562 bet;05D1 beta;03B2 betasymbolgreek;03D0 betdagesh;FB31 betdageshhebrew;FB31 bethebrew;05D1 betrafehebrew;FB4C bhabengali;09AD bhadeva;092D bhagujarati;0AAD bhagurmukhi;0A2D bhook;0253 bihiragana;3073 bikatakana;30D3 bilabialclick;0298 bindigurmukhi;0A02 birusquare;3331 blackcircle;25CF blackdiamond;25C6 blackdownpointingtriangle;25BC blackleftpointingpointer;25C4 blackleftpointingtriangle;25C0 blacklenticularbracketleft;3010 blacklenticularbracketleftvertical;FE3B blacklenticularbracketright;3011 blacklenticularbracketrightvertical;FE3C blacklowerlefttriangle;25E3 blacklowerrighttriangle;25E2 blackrectangle;25AC blackrightpointingpointer;25BA blackrightpointingtriangle;25B6 blacksmallsquare;25AA blacksmilingface;263B blacksquare;25A0 blackstar;2605 blackupperlefttriangle;25E4 blackupperrighttriangle;25E5 blackuppointingsmalltriangle;25B4 blackuppointingtriangle;25B2 blank;2423 blinebelow;1E07 block;2588 bmonospace;FF42 bobaimaithai;0E1A bohiragana;307C bokatakana;30DC bparen;249D bqsquare;33C3 braceex;F8F4 braceleft;007B braceleftbt;F8F3 braceleftmid;F8F2 braceleftmonospace;FF5B braceleftsmall;FE5B bracelefttp;F8F1 braceleftvertical;FE37 braceright;007D bracerightbt;F8FE bracerightmid;F8FD bracerightmonospace;FF5D bracerightsmall;FE5C bracerighttp;F8FC bracerightvertical;FE38 bracketleft;005B bracketleftbt;F8F0 bracketleftex;F8EF bracketleftmonospace;FF3B bracketlefttp;F8EE bracketright;005D bracketrightbt;F8FB bracketrightex;F8FA bracketrightmonospace;FF3D bracketrighttp;F8F9 breve;02D8 brevebelowcmb;032E brevecmb;0306 breveinvertedbelowcmb;032F breveinvertedcmb;0311 breveinverteddoublecmb;0361 bridgebelowcmb;032A bridgeinvertedbelowcmb;033A brokenbar;00A6 bstroke;0180 bsuperior;F6EA btopbar;0183 buhiragana;3076 bukatakana;30D6 bullet;2022 bulletinverse;25D8 bulletoperator;2219 bullseye;25CE c;0063 caarmenian;056E cabengali;099A cacute;0107 cadeva;091A cagujarati;0A9A cagurmukhi;0A1A calsquare;3388 candrabindubengali;0981 candrabinducmb;0310 candrabindudeva;0901 candrabindugujarati;0A81 capslock;21EA careof;2105 caron;02C7 caronbelowcmb;032C caroncmb;030C carriagereturn;21B5 cbopomofo;3118 ccaron;010D ccedilla;00E7 ccedillaacute;1E09 ccircle;24D2 ccircumflex;0109 ccurl;0255 cdot;010B cdotaccent;010B cdsquare;33C5 cedilla;00B8 cedillacmb;0327 cent;00A2 centigrade;2103 centinferior;F6DF centmonospace;FFE0 centoldstyle;F7A2 centsuperior;F6E0 chaarmenian;0579 chabengali;099B chadeva;091B chagujarati;0A9B chagurmukhi;0A1B chbopomofo;3114 cheabkhasiancyrillic;04BD checkmark;2713 checyrillic;0447 chedescenderabkhasiancyrillic;04BF chedescendercyrillic;04B7 chedieresiscyrillic;04F5 cheharmenian;0573 chekhakassiancyrillic;04CC cheverticalstrokecyrillic;04B9 chi;03C7 chieuchacirclekorean;3277 chieuchaparenkorean;3217 chieuchcirclekorean;3269 chieuchkorean;314A chieuchparenkorean;3209 chochangthai;0E0A chochanthai;0E08 chochingthai;0E09 chochoethai;0E0C chook;0188 cieucacirclekorean;3276 cieucaparenkorean;3216 cieuccirclekorean;3268 cieuckorean;3148 cieucparenkorean;3208 cieucuparenkorean;321C circle;25CB circlemultiply;2297 circleot;2299 circleplus;2295 circlepostalmark;3036 circlewithlefthalfblack;25D0 circlewithrighthalfblack;25D1 circumflex;02C6 circumflexbelowcmb;032D circumflexcmb;0302 clear;2327 clickalveolar;01C2 clickdental;01C0 clicklateral;01C1 clickretroflex;01C3 club;2663 clubsuitblack;2663 clubsuitwhite;2667 cmcubedsquare;33A4 cmonospace;FF43 cmsquaredsquare;33A0 coarmenian;0581 colon;003A colonmonetary;20A1 colonmonospace;FF1A colonsign;20A1 colonsmall;FE55 colontriangularhalfmod;02D1 colontriangularmod;02D0 comma;002C commaabovecmb;0313 commaaboverightcmb;0315 commaaccent;F6C3 commaarabic;060C commaarmenian;055D commainferior;F6E1 commamonospace;FF0C commareversedabovecmb;0314 commareversedmod;02BD commasmall;FE50 commasuperior;F6E2 commaturnedabovecmb;0312 commaturnedmod;02BB compass;263C congruent;2245 contourintegral;222E control;2303 controlACK;0006 controlBEL;0007 controlBS;0008 controlCAN;0018 controlCR;000D controlDC1;0011 controlDC2;0012 controlDC3;0013 controlDC4;0014 controlDEL;007F controlDLE;0010 controlEM;0019 controlENQ;0005 controlEOT;0004 controlESC;001B controlETB;0017 controlETX;0003 controlFF;000C controlFS;001C controlGS;001D controlHT;0009 controlLF;000A controlNAK;0015 controlRS;001E controlSI;000F controlSO;000E controlSOT;0002 controlSTX;0001 controlSUB;001A controlSYN;0016 controlUS;001F controlVT;000B copyright;00A9 copyrightsans;F8E9 copyrightserif;F6D9 cornerbracketleft;300C cornerbracketlefthalfwidth;FF62 cornerbracketleftvertical;FE41 cornerbracketright;300D cornerbracketrighthalfwidth;FF63 cornerbracketrightvertical;FE42 corporationsquare;337F cosquare;33C7 coverkgsquare;33C6 cparen;249E cruzeiro;20A2 cstretched;0297 curlyand;22CF curlyor;22CE currency;00A4 cyrBreve;F6D1 cyrFlex;F6D2 cyrbreve;F6D4 cyrflex;F6D5 d;0064 daarmenian;0564 dabengali;09A6 dadarabic;0636 dadeva;0926 dadfinalarabic;FEBE dadinitialarabic;FEBF dadmedialarabic;FEC0 dagesh;05BC dageshhebrew;05BC dagger;2020 daggerdbl;2021 dagujarati;0AA6 dagurmukhi;0A26 dahiragana;3060 dakatakana;30C0 dalarabic;062F dalet;05D3 daletdagesh;FB33 daletdageshhebrew;FB33 dalethatafpatah;05D3 05B2 dalethatafpatahhebrew;05D3 05B2 dalethatafsegol;05D3 05B1 dalethatafsegolhebrew;05D3 05B1 dalethebrew;05D3 dalethiriq;05D3 05B4 dalethiriqhebrew;05D3 05B4 daletholam;05D3 05B9 daletholamhebrew;05D3 05B9 daletpatah;05D3 05B7 daletpatahhebrew;05D3 05B7 daletqamats;05D3 05B8 daletqamatshebrew;05D3 05B8 daletqubuts;05D3 05BB daletqubutshebrew;05D3 05BB daletsegol;05D3 05B6 daletsegolhebrew;05D3 05B6 daletsheva;05D3 05B0 daletshevahebrew;05D3 05B0 dalettsere;05D3 05B5 dalettserehebrew;05D3 05B5 dalfinalarabic;FEAA dammaarabic;064F dammalowarabic;064F dammatanaltonearabic;064C dammatanarabic;064C danda;0964 dargahebrew;05A7 dargalefthebrew;05A7 dasiapneumatacyrilliccmb;0485 dblGrave;F6D3 dblanglebracketleft;300A dblanglebracketleftvertical;FE3D dblanglebracketright;300B dblanglebracketrightvertical;FE3E dblarchinvertedbelowcmb;032B dblarrowleft;21D4 dblarrowright;21D2 dbldanda;0965 dblgrave;F6D6 dblgravecmb;030F dblintegral;222C dbllowline;2017 dbllowlinecmb;0333 dbloverlinecmb;033F dblprimemod;02BA dblverticalbar;2016 dblverticallineabovecmb;030E dbopomofo;3109 dbsquare;33C8 dcaron;010F dcedilla;1E11 dcircle;24D3 dcircumflexbelow;1E13 dcroat;0111 ddabengali;09A1 ddadeva;0921 ddagujarati;0AA1 ddagurmukhi;0A21 ddalarabic;0688 ddalfinalarabic;FB89 dddhadeva;095C ddhabengali;09A2 ddhadeva;0922 ddhagujarati;0AA2 ddhagurmukhi;0A22 ddotaccent;1E0B ddotbelow;1E0D decimalseparatorarabic;066B decimalseparatorpersian;066B decyrillic;0434 degree;00B0 dehihebrew;05AD dehiragana;3067 deicoptic;03EF dekatakana;30C7 deleteleft;232B deleteright;2326 delta;03B4 deltaturned;018D denominatorminusonenumeratorbengali;09F8 dezh;02A4 dhabengali;09A7 dhadeva;0927 dhagujarati;0AA7 dhagurmukhi;0A27 dhook;0257 dialytikatonos;0385 dialytikatonoscmb;0344 diamond;2666 diamondsuitwhite;2662 dieresis;00A8 dieresisacute;F6D7 dieresisbelowcmb;0324 dieresiscmb;0308 dieresisgrave;F6D8 dieresistonos;0385 dihiragana;3062 dikatakana;30C2 dittomark;3003 divide;00F7 divides;2223 divisionslash;2215 djecyrillic;0452 dkshade;2593 dlinebelow;1E0F dlsquare;3397 dmacron;0111 dmonospace;FF44 dnblock;2584 dochadathai;0E0E dodekthai;0E14 dohiragana;3069 dokatakana;30C9 dollar;0024 dollarinferior;F6E3 dollarmonospace;FF04 dollaroldstyle;F724 dollarsmall;FE69 dollarsuperior;F6E4 dong;20AB dorusquare;3326 dotaccent;02D9 dotaccentcmb;0307 dotbelowcmb;0323 dotbelowcomb;0323 dotkatakana;30FB dotlessi;0131 dotlessj;F6BE dotlessjstrokehook;0284 dotmath;22C5 dottedcircle;25CC doubleyodpatah;FB1F doubleyodpatahhebrew;FB1F downtackbelowcmb;031E downtackmod;02D5 dparen;249F dsuperior;F6EB dtail;0256 dtopbar;018C duhiragana;3065 dukatakana;30C5 dz;01F3 dzaltone;02A3 dzcaron;01C6 dzcurl;02A5 dzeabkhasiancyrillic;04E1 dzecyrillic;0455 dzhecyrillic;045F e;0065 eacute;00E9 earth;2641 ebengali;098F ebopomofo;311C ebreve;0115 ecandradeva;090D ecandragujarati;0A8D ecandravowelsigndeva;0945 ecandravowelsigngujarati;0AC5 ecaron;011B ecedillabreve;1E1D echarmenian;0565 echyiwnarmenian;0587 ecircle;24D4 ecircumflex;00EA ecircumflexacute;1EBF ecircumflexbelow;1E19 ecircumflexdotbelow;1EC7 ecircumflexgrave;1EC1 ecircumflexhookabove;1EC3 ecircumflextilde;1EC5 ecyrillic;0454 edblgrave;0205 edeva;090F edieresis;00EB edot;0117 edotaccent;0117 edotbelow;1EB9 eegurmukhi;0A0F eematragurmukhi;0A47 efcyrillic;0444 egrave;00E8 egujarati;0A8F eharmenian;0567 ehbopomofo;311D ehiragana;3048 ehookabove;1EBB eibopomofo;311F eight;0038 eightarabic;0668 eightbengali;09EE eightcircle;2467 eightcircleinversesansserif;2791 eightdeva;096E eighteencircle;2471 eighteenparen;2485 eighteenperiod;2499 eightgujarati;0AEE eightgurmukhi;0A6E eighthackarabic;0668 eighthangzhou;3028 eighthnotebeamed;266B eightideographicparen;3227 eightinferior;2088 eightmonospace;FF18 eightoldstyle;F738 eightparen;247B eightperiod;248F eightpersian;06F8 eightroman;2177 eightsuperior;2078 eightthai;0E58 einvertedbreve;0207 eiotifiedcyrillic;0465 ekatakana;30A8 ekatakanahalfwidth;FF74 ekonkargurmukhi;0A74 ekorean;3154 elcyrillic;043B element;2208 elevencircle;246A elevenparen;247E elevenperiod;2492 elevenroman;217A ellipsis;2026 ellipsisvertical;22EE emacron;0113 emacronacute;1E17 emacrongrave;1E15 emcyrillic;043C emdash;2014 emdashvertical;FE31 emonospace;FF45 emphasismarkarmenian;055B emptyset;2205 enbopomofo;3123 encyrillic;043D endash;2013 endashvertical;FE32 endescendercyrillic;04A3 eng;014B engbopomofo;3125 enghecyrillic;04A5 enhookcyrillic;04C8 enspace;2002 eogonek;0119 eokorean;3153 eopen;025B eopenclosed;029A eopenreversed;025C eopenreversedclosed;025E eopenreversedhook;025D eparen;24A0 epsilon;03B5 epsilontonos;03AD equal;003D equalmonospace;FF1D equalsmall;FE66 equalsuperior;207C equivalence;2261 erbopomofo;3126 ercyrillic;0440 ereversed;0258 ereversedcyrillic;044D escyrillic;0441 esdescendercyrillic;04AB esh;0283 eshcurl;0286 eshortdeva;090E eshortvowelsigndeva;0946 eshreversedloop;01AA eshsquatreversed;0285 esmallhiragana;3047 esmallkatakana;30A7 esmallkatakanahalfwidth;FF6A estimated;212E esuperior;F6EC eta;03B7 etarmenian;0568 etatonos;03AE eth;00F0 etilde;1EBD etildebelow;1E1B etnahtafoukhhebrew;0591 etnahtafoukhlefthebrew;0591 etnahtahebrew;0591 etnahtalefthebrew;0591 eturned;01DD eukorean;3161 euro;20AC evowelsignbengali;09C7 evowelsigndeva;0947 evowelsigngujarati;0AC7 exclam;0021 exclamarmenian;055C exclamdbl;203C exclamdown;00A1 exclamdownsmall;F7A1 exclammonospace;FF01 exclamsmall;F721 existential;2203 ezh;0292 ezhcaron;01EF ezhcurl;0293 ezhreversed;01B9 ezhtail;01BA f;0066 fadeva;095E fagurmukhi;0A5E fahrenheit;2109 fathaarabic;064E fathalowarabic;064E fathatanarabic;064B fbopomofo;3108 fcircle;24D5 fdotaccent;1E1F feharabic;0641 feharmenian;0586 fehfinalarabic;FED2 fehinitialarabic;FED3 fehmedialarabic;FED4 feicoptic;03E5 female;2640 ff;FB00 ffi;FB03 ffl;FB04 fi;FB01 fifteencircle;246E fifteenparen;2482 fifteenperiod;2496 figuredash;2012 filledbox;25A0 filledrect;25AC finalkaf;05DA finalkafdagesh;FB3A finalkafdageshhebrew;FB3A finalkafhebrew;05DA finalkafqamats;05DA 05B8 finalkafqamatshebrew;05DA 05B8 finalkafsheva;05DA 05B0 finalkafshevahebrew;05DA 05B0 finalmem;05DD finalmemhebrew;05DD finalnun;05DF finalnunhebrew;05DF finalpe;05E3 finalpehebrew;05E3 finaltsadi;05E5 finaltsadihebrew;05E5 firsttonechinese;02C9 fisheye;25C9 fitacyrillic;0473 five;0035 fivearabic;0665 fivebengali;09EB fivecircle;2464 fivecircleinversesansserif;278E fivedeva;096B fiveeighths;215D fivegujarati;0AEB fivegurmukhi;0A6B fivehackarabic;0665 fivehangzhou;3025 fiveideographicparen;3224 fiveinferior;2085 fivemonospace;FF15 fiveoldstyle;F735 fiveparen;2478 fiveperiod;248C fivepersian;06F5 fiveroman;2174 fivesuperior;2075 fivethai;0E55 fl;FB02 florin;0192 fmonospace;FF46 fmsquare;3399 fofanthai;0E1F fofathai;0E1D fongmanthai;0E4F forall;2200 four;0034 fourarabic;0664 fourbengali;09EA fourcircle;2463 fourcircleinversesansserif;278D fourdeva;096A fourgujarati;0AEA fourgurmukhi;0A6A fourhackarabic;0664 fourhangzhou;3024 fourideographicparen;3223 fourinferior;2084 fourmonospace;FF14 fournumeratorbengali;09F7 fouroldstyle;F734 fourparen;2477 fourperiod;248B fourpersian;06F4 fourroman;2173 foursuperior;2074 fourteencircle;246D fourteenparen;2481 fourteenperiod;2495 fourthai;0E54 fourthtonechinese;02CB fparen;24A1 fraction;2044 franc;20A3 g;0067 gabengali;0997 gacute;01F5 gadeva;0917 gafarabic;06AF gaffinalarabic;FB93 gafinitialarabic;FB94 gafmedialarabic;FB95 gagujarati;0A97 gagurmukhi;0A17 gahiragana;304C gakatakana;30AC gamma;03B3 gammalatinsmall;0263 gammasuperior;02E0 gangiacoptic;03EB gbopomofo;310D gbreve;011F gcaron;01E7 gcedilla;0123 gcircle;24D6 gcircumflex;011D gcommaaccent;0123 gdot;0121 gdotaccent;0121 gecyrillic;0433 gehiragana;3052 gekatakana;30B2 geometricallyequal;2251 gereshaccenthebrew;059C gereshhebrew;05F3 gereshmuqdamhebrew;059D germandbls;00DF gershayimaccenthebrew;059E gershayimhebrew;05F4 getamark;3013 ghabengali;0998 ghadarmenian;0572 ghadeva;0918 ghagujarati;0A98 ghagurmukhi;0A18 ghainarabic;063A ghainfinalarabic;FECE ghaininitialarabic;FECF ghainmedialarabic;FED0 ghemiddlehookcyrillic;0495 ghestrokecyrillic;0493 gheupturncyrillic;0491 ghhadeva;095A ghhagurmukhi;0A5A ghook;0260 ghzsquare;3393 gihiragana;304E gikatakana;30AE gimarmenian;0563 gimel;05D2 gimeldagesh;FB32 gimeldageshhebrew;FB32 gimelhebrew;05D2 gjecyrillic;0453 glottalinvertedstroke;01BE glottalstop;0294 glottalstopinverted;0296 glottalstopmod;02C0 glottalstopreversed;0295 glottalstopreversedmod;02C1 glottalstopreversedsuperior;02E4 glottalstopstroke;02A1 glottalstopstrokereversed;02A2 gmacron;1E21 gmonospace;FF47 gohiragana;3054 gokatakana;30B4 gparen;24A2 gpasquare;33AC gradient;2207 grave;0060 gravebelowcmb;0316 gravecmb;0300 gravecomb;0300 gravedeva;0953 gravelowmod;02CE gravemonospace;FF40 gravetonecmb;0340 greater;003E greaterequal;2265 greaterequalorless;22DB greatermonospace;FF1E greaterorequivalent;2273 greaterorless;2277 greateroverequal;2267 greatersmall;FE65 gscript;0261 gstroke;01E5 guhiragana;3050 guillemotleft;00AB guillemotright;00BB guilsinglleft;2039 guilsinglright;203A gukatakana;30B0 guramusquare;3318 gysquare;33C9 h;0068 haabkhasiancyrillic;04A9 haaltonearabic;06C1 habengali;09B9 hadescendercyrillic;04B3 hadeva;0939 hagujarati;0AB9 hagurmukhi;0A39 haharabic;062D hahfinalarabic;FEA2 hahinitialarabic;FEA3 hahiragana;306F hahmedialarabic;FEA4 haitusquare;332A hakatakana;30CF hakatakanahalfwidth;FF8A halantgurmukhi;0A4D hamzaarabic;0621 hamzadammaarabic;0621 064F hamzadammatanarabic;0621 064C hamzafathaarabic;0621 064E hamzafathatanarabic;0621 064B hamzalowarabic;0621 hamzalowkasraarabic;0621 0650 hamzalowkasratanarabic;0621 064D hamzasukunarabic;0621 0652 hangulfiller;3164 hardsigncyrillic;044A harpoonleftbarbup;21BC harpoonrightbarbup;21C0 hasquare;33CA hatafpatah;05B2 hatafpatah16;05B2 hatafpatah23;05B2 hatafpatah2f;05B2 hatafpatahhebrew;05B2 hatafpatahnarrowhebrew;05B2 hatafpatahquarterhebrew;05B2 hatafpatahwidehebrew;05B2 hatafqamats;05B3 hatafqamats1b;05B3 hatafqamats28;05B3 hatafqamats34;05B3 hatafqamatshebrew;05B3 hatafqamatsnarrowhebrew;05B3 hatafqamatsquarterhebrew;05B3 hatafqamatswidehebrew;05B3 hatafsegol;05B1 hatafsegol17;05B1 hatafsegol24;05B1 hatafsegol30;05B1 hatafsegolhebrew;05B1 hatafsegolnarrowhebrew;05B1 hatafsegolquarterhebrew;05B1 hatafsegolwidehebrew;05B1 hbar;0127 hbopomofo;310F hbrevebelow;1E2B hcedilla;1E29 hcircle;24D7 hcircumflex;0125 hdieresis;1E27 hdotaccent;1E23 hdotbelow;1E25 he;05D4 heart;2665 heartsuitblack;2665 heartsuitwhite;2661 hedagesh;FB34 hedageshhebrew;FB34 hehaltonearabic;06C1 heharabic;0647 hehebrew;05D4 hehfinalaltonearabic;FBA7 hehfinalalttwoarabic;FEEA hehfinalarabic;FEEA hehhamzaabovefinalarabic;FBA5 hehhamzaaboveisolatedarabic;FBA4 hehinitialaltonearabic;FBA8 hehinitialarabic;FEEB hehiragana;3078 hehmedialaltonearabic;FBA9 hehmedialarabic;FEEC heiseierasquare;337B hekatakana;30D8 hekatakanahalfwidth;FF8D hekutaarusquare;3336 henghook;0267 herutusquare;3339 het;05D7 hethebrew;05D7 hhook;0266 hhooksuperior;02B1 hieuhacirclekorean;327B hieuhaparenkorean;321B hieuhcirclekorean;326D hieuhkorean;314E hieuhparenkorean;320D hihiragana;3072 hikatakana;30D2 hikatakanahalfwidth;FF8B hiriq;05B4 hiriq14;05B4 hiriq21;05B4 hiriq2d;05B4 hiriqhebrew;05B4 hiriqnarrowhebrew;05B4 hiriqquarterhebrew;05B4 hiriqwidehebrew;05B4 hlinebelow;1E96 hmonospace;FF48 hoarmenian;0570 hohipthai;0E2B hohiragana;307B hokatakana;30DB hokatakanahalfwidth;FF8E holam;05B9 holam19;05B9 holam26;05B9 holam32;05B9 holamhebrew;05B9 holamnarrowhebrew;05B9 holamquarterhebrew;05B9 holamwidehebrew;05B9 honokhukthai;0E2E hookabovecomb;0309 hookcmb;0309 hookpalatalizedbelowcmb;0321 hookretroflexbelowcmb;0322 hoonsquare;3342 horicoptic;03E9 horizontalbar;2015 horncmb;031B hotsprings;2668 house;2302 hparen;24A3 hsuperior;02B0 hturned;0265 huhiragana;3075 huiitosquare;3333 hukatakana;30D5 hukatakanahalfwidth;FF8C hungarumlaut;02DD hungarumlautcmb;030B hv;0195 hyphen;002D hypheninferior;F6E5 hyphenmonospace;FF0D hyphensmall;FE63 hyphensuperior;F6E6 hyphentwo;2010 i;0069 iacute;00ED iacyrillic;044F ibengali;0987 ibopomofo;3127 ibreve;012D icaron;01D0 icircle;24D8 icircumflex;00EE icyrillic;0456 idblgrave;0209 ideographearthcircle;328F ideographfirecircle;328B ideographicallianceparen;323F ideographiccallparen;323A ideographiccentrecircle;32A5 ideographicclose;3006 ideographiccomma;3001 ideographiccommaleft;FF64 ideographiccongratulationparen;3237 ideographiccorrectcircle;32A3 ideographicearthparen;322F ideographicenterpriseparen;323D ideographicexcellentcircle;329D ideographicfestivalparen;3240 ideographicfinancialcircle;3296 ideographicfinancialparen;3236 ideographicfireparen;322B ideographichaveparen;3232 ideographichighcircle;32A4 ideographiciterationmark;3005 ideographiclaborcircle;3298 ideographiclaborparen;3238 ideographicleftcircle;32A7 ideographiclowcircle;32A6 ideographicmedicinecircle;32A9 ideographicmetalparen;322E ideographicmoonparen;322A ideographicnameparen;3234 ideographicperiod;3002 ideographicprintcircle;329E ideographicreachparen;3243 ideographicrepresentparen;3239 ideographicresourceparen;323E ideographicrightcircle;32A8 ideographicsecretcircle;3299 ideographicselfparen;3242 ideographicsocietyparen;3233 ideographicspace;3000 ideographicspecialparen;3235 ideographicstockparen;3231 ideographicstudyparen;323B ideographicsunparen;3230 ideographicsuperviseparen;323C ideographicwaterparen;322C ideographicwoodparen;322D ideographiczero;3007 ideographmetalcircle;328E ideographmooncircle;328A ideographnamecircle;3294 ideographsuncircle;3290 ideographwatercircle;328C ideographwoodcircle;328D ideva;0907 idieresis;00EF idieresisacute;1E2F idieresiscyrillic;04E5 idotbelow;1ECB iebrevecyrillic;04D7 iecyrillic;0435 ieungacirclekorean;3275 ieungaparenkorean;3215 ieungcirclekorean;3267 ieungkorean;3147 ieungparenkorean;3207 igrave;00EC igujarati;0A87 igurmukhi;0A07 ihiragana;3044 ihookabove;1EC9 iibengali;0988 iicyrillic;0438 iideva;0908 iigujarati;0A88 iigurmukhi;0A08 iimatragurmukhi;0A40 iinvertedbreve;020B iishortcyrillic;0439 iivowelsignbengali;09C0 iivowelsigndeva;0940 iivowelsigngujarati;0AC0 ij;0133 ikatakana;30A4 ikatakanahalfwidth;FF72 ikorean;3163 ilde;02DC iluyhebrew;05AC imacron;012B imacroncyrillic;04E3 imageorapproximatelyequal;2253 imatragurmukhi;0A3F imonospace;FF49 increment;2206 infinity;221E iniarmenian;056B integral;222B integralbottom;2321 integralbt;2321 integralex;F8F5 integraltop;2320 integraltp;2320 intersection;2229 intisquare;3305 invbullet;25D8 invcircle;25D9 invsmileface;263B iocyrillic;0451 iogonek;012F iota;03B9 iotadieresis;03CA iotadieresistonos;0390 iotalatin;0269 iotatonos;03AF iparen;24A4 irigurmukhi;0A72 ismallhiragana;3043 ismallkatakana;30A3 ismallkatakanahalfwidth;FF68 issharbengali;09FA istroke;0268 isuperior;F6ED iterationhiragana;309D iterationkatakana;30FD itilde;0129 itildebelow;1E2D iubopomofo;3129 iucyrillic;044E ivowelsignbengali;09BF ivowelsigndeva;093F ivowelsigngujarati;0ABF izhitsacyrillic;0475 izhitsadblgravecyrillic;0477 j;006A jaarmenian;0571 jabengali;099C jadeva;091C jagujarati;0A9C jagurmukhi;0A1C jbopomofo;3110 jcaron;01F0 jcircle;24D9 jcircumflex;0135 jcrossedtail;029D jdotlessstroke;025F jecyrillic;0458 jeemarabic;062C jeemfinalarabic;FE9E jeeminitialarabic;FE9F jeemmedialarabic;FEA0 jeharabic;0698 jehfinalarabic;FB8B jhabengali;099D jhadeva;091D jhagujarati;0A9D jhagurmukhi;0A1D jheharmenian;057B jis;3004 jmonospace;FF4A jparen;24A5 jsuperior;02B2 k;006B kabashkircyrillic;04A1 kabengali;0995 kacute;1E31 kacyrillic;043A kadescendercyrillic;049B kadeva;0915 kaf;05DB kafarabic;0643 kafdagesh;FB3B kafdageshhebrew;FB3B kaffinalarabic;FEDA kafhebrew;05DB kafinitialarabic;FEDB kafmedialarabic;FEDC kafrafehebrew;FB4D kagujarati;0A95 kagurmukhi;0A15 kahiragana;304B kahookcyrillic;04C4 kakatakana;30AB kakatakanahalfwidth;FF76 kappa;03BA kappasymbolgreek;03F0 kapyeounmieumkorean;3171 kapyeounphieuphkorean;3184 kapyeounpieupkorean;3178 kapyeounssangpieupkorean;3179 karoriisquare;330D kashidaautoarabic;0640 kashidaautonosidebearingarabic;0640 kasmallkatakana;30F5 kasquare;3384 kasraarabic;0650 kasratanarabic;064D kastrokecyrillic;049F katahiraprolongmarkhalfwidth;FF70 kaverticalstrokecyrillic;049D kbopomofo;310E kcalsquare;3389 kcaron;01E9 kcedilla;0137 kcircle;24DA kcommaaccent;0137 kdotbelow;1E33 keharmenian;0584 kehiragana;3051 kekatakana;30B1 kekatakanahalfwidth;FF79 kenarmenian;056F kesmallkatakana;30F6 kgreenlandic;0138 khabengali;0996 khacyrillic;0445 khadeva;0916 khagujarati;0A96 khagurmukhi;0A16 khaharabic;062E khahfinalarabic;FEA6 khahinitialarabic;FEA7 khahmedialarabic;FEA8 kheicoptic;03E7 khhadeva;0959 khhagurmukhi;0A59 khieukhacirclekorean;3278 khieukhaparenkorean;3218 khieukhcirclekorean;326A khieukhkorean;314B khieukhparenkorean;320A khokhaithai;0E02 khokhonthai;0E05 khokhuatthai;0E03 khokhwaithai;0E04 khomutthai;0E5B khook;0199 khorakhangthai;0E06 khzsquare;3391 kihiragana;304D kikatakana;30AD kikatakanahalfwidth;FF77 kiroguramusquare;3315 kiromeetorusquare;3316 kirosquare;3314 kiyeokacirclekorean;326E kiyeokaparenkorean;320E kiyeokcirclekorean;3260 kiyeokkorean;3131 kiyeokparenkorean;3200 kiyeoksioskorean;3133 kjecyrillic;045C klinebelow;1E35 klsquare;3398 kmcubedsquare;33A6 kmonospace;FF4B kmsquaredsquare;33A2 kohiragana;3053 kohmsquare;33C0 kokaithai;0E01 kokatakana;30B3 kokatakanahalfwidth;FF7A kooposquare;331E koppacyrillic;0481 koreanstandardsymbol;327F koroniscmb;0343 kparen;24A6 kpasquare;33AA ksicyrillic;046F ktsquare;33CF kturned;029E kuhiragana;304F kukatakana;30AF kukatakanahalfwidth;FF78 kvsquare;33B8 kwsquare;33BE l;006C labengali;09B2 lacute;013A ladeva;0932 lagujarati;0AB2 lagurmukhi;0A32 lakkhangyaothai;0E45 lamaleffinalarabic;FEFC lamalefhamzaabovefinalarabic;FEF8 lamalefhamzaaboveisolatedarabic;FEF7 lamalefhamzabelowfinalarabic;FEFA lamalefhamzabelowisolatedarabic;FEF9 lamalefisolatedarabic;FEFB lamalefmaddaabovefinalarabic;FEF6 lamalefmaddaaboveisolatedarabic;FEF5 lamarabic;0644 lambda;03BB lambdastroke;019B lamed;05DC lameddagesh;FB3C lameddageshhebrew;FB3C lamedhebrew;05DC lamedholam;05DC 05B9 lamedholamdagesh;05DC 05B9 05BC lamedholamdageshhebrew;05DC 05B9 05BC lamedholamhebrew;05DC 05B9 lamfinalarabic;FEDE lamhahinitialarabic;FCCA laminitialarabic;FEDF lamjeeminitialarabic;FCC9 lamkhahinitialarabic;FCCB lamlamhehisolatedarabic;FDF2 lammedialarabic;FEE0 lammeemhahinitialarabic;FD88 lammeeminitialarabic;FCCC lammeemjeeminitialarabic;FEDF FEE4 FEA0 lammeemkhahinitialarabic;FEDF FEE4 FEA8 largecircle;25EF lbar;019A lbelt;026C lbopomofo;310C lcaron;013E lcedilla;013C lcircle;24DB lcircumflexbelow;1E3D lcommaaccent;013C ldot;0140 ldotaccent;0140 ldotbelow;1E37 ldotbelowmacron;1E39 leftangleabovecmb;031A lefttackbelowcmb;0318 less;003C lessequal;2264 lessequalorgreater;22DA lessmonospace;FF1C lessorequivalent;2272 lessorgreater;2276 lessoverequal;2266 lesssmall;FE64 lezh;026E lfblock;258C lhookretroflex;026D lira;20A4 liwnarmenian;056C lj;01C9 ljecyrillic;0459 ll;F6C0 lladeva;0933 llagujarati;0AB3 llinebelow;1E3B llladeva;0934 llvocalicbengali;09E1 llvocalicdeva;0961 llvocalicvowelsignbengali;09E3 llvocalicvowelsigndeva;0963 lmiddletilde;026B lmonospace;FF4C lmsquare;33D0 lochulathai;0E2C logicaland;2227 logicalnot;00AC logicalnotreversed;2310 logicalor;2228 lolingthai;0E25 longs;017F lowlinecenterline;FE4E lowlinecmb;0332 lowlinedashed;FE4D lozenge;25CA lparen;24A7 lslash;0142 lsquare;2113 lsuperior;F6EE ltshade;2591 luthai;0E26 lvocalicbengali;098C lvocalicdeva;090C lvocalicvowelsignbengali;09E2 lvocalicvowelsigndeva;0962 lxsquare;33D3 m;006D mabengali;09AE macron;00AF macronbelowcmb;0331 macroncmb;0304 macronlowmod;02CD macronmonospace;FFE3 macute;1E3F madeva;092E magujarati;0AAE magurmukhi;0A2E mahapakhhebrew;05A4 mahapakhlefthebrew;05A4 mahiragana;307E maichattawalowleftthai;F895 maichattawalowrightthai;F894 maichattawathai;0E4B maichattawaupperleftthai;F893 maieklowleftthai;F88C maieklowrightthai;F88B maiekthai;0E48 maiekupperleftthai;F88A maihanakatleftthai;F884 maihanakatthai;0E31 maitaikhuleftthai;F889 maitaikhuthai;0E47 maitholowleftthai;F88F maitholowrightthai;F88E maithothai;0E49 maithoupperleftthai;F88D maitrilowleftthai;F892 maitrilowrightthai;F891 maitrithai;0E4A maitriupperleftthai;F890 maiyamokthai;0E46 makatakana;30DE makatakanahalfwidth;FF8F male;2642 mansyonsquare;3347 maqafhebrew;05BE mars;2642 masoracirclehebrew;05AF masquare;3383 mbopomofo;3107 mbsquare;33D4 mcircle;24DC mcubedsquare;33A5 mdotaccent;1E41 mdotbelow;1E43 meemarabic;0645 meemfinalarabic;FEE2 meeminitialarabic;FEE3 meemmedialarabic;FEE4 meemmeeminitialarabic;FCD1 meemmeemisolatedarabic;FC48 meetorusquare;334D mehiragana;3081 meizierasquare;337E mekatakana;30E1 mekatakanahalfwidth;FF92 mem;05DE memdagesh;FB3E memdageshhebrew;FB3E memhebrew;05DE menarmenian;0574 merkhahebrew;05A5 merkhakefulahebrew;05A6 merkhakefulalefthebrew;05A6 merkhalefthebrew;05A5 mhook;0271 mhzsquare;3392 middledotkatakanahalfwidth;FF65 middot;00B7 mieumacirclekorean;3272 mieumaparenkorean;3212 mieumcirclekorean;3264 mieumkorean;3141 mieumpansioskorean;3170 mieumparenkorean;3204 mieumpieupkorean;316E mieumsioskorean;316F mihiragana;307F mikatakana;30DF mikatakanahalfwidth;FF90 minus;2212 minusbelowcmb;0320 minuscircle;2296 minusmod;02D7 minusplus;2213 minute;2032 miribaarusquare;334A mirisquare;3349 mlonglegturned;0270 mlsquare;3396 mmcubedsquare;33A3 mmonospace;FF4D mmsquaredsquare;339F mohiragana;3082 mohmsquare;33C1 mokatakana;30E2 mokatakanahalfwidth;FF93 molsquare;33D6 momathai;0E21 moverssquare;33A7 moverssquaredsquare;33A8 mparen;24A8 mpasquare;33AB mssquare;33B3 msuperior;F6EF mturned;026F mu;00B5 mu1;00B5 muasquare;3382 muchgreater;226B muchless;226A mufsquare;338C mugreek;03BC mugsquare;338D muhiragana;3080 mukatakana;30E0 mukatakanahalfwidth;FF91 mulsquare;3395 multiply;00D7 mumsquare;339B munahhebrew;05A3 munahlefthebrew;05A3 musicalnote;266A musicalnotedbl;266B musicflatsign;266D musicsharpsign;266F mussquare;33B2 muvsquare;33B6 muwsquare;33BC mvmegasquare;33B9 mvsquare;33B7 mwmegasquare;33BF mwsquare;33BD n;006E nabengali;09A8 nabla;2207 nacute;0144 nadeva;0928 nagujarati;0AA8 nagurmukhi;0A28 nahiragana;306A nakatakana;30CA nakatakanahalfwidth;FF85 napostrophe;0149 nasquare;3381 nbopomofo;310B nbspace;00A0 ncaron;0148 ncedilla;0146 ncircle;24DD ncircumflexbelow;1E4B ncommaaccent;0146 ndotaccent;1E45 ndotbelow;1E47 nehiragana;306D nekatakana;30CD nekatakanahalfwidth;FF88 newsheqelsign;20AA nfsquare;338B ngabengali;0999 ngadeva;0919 ngagujarati;0A99 ngagurmukhi;0A19 ngonguthai;0E07 nhiragana;3093 nhookleft;0272 nhookretroflex;0273 nieunacirclekorean;326F nieunaparenkorean;320F nieuncieuckorean;3135 nieuncirclekorean;3261 nieunhieuhkorean;3136 nieunkorean;3134 nieunpansioskorean;3168 nieunparenkorean;3201 nieunsioskorean;3167 nieuntikeutkorean;3166 nihiragana;306B nikatakana;30CB nikatakanahalfwidth;FF86 nikhahitleftthai;F899 nikhahitthai;0E4D nine;0039 ninearabic;0669 ninebengali;09EF ninecircle;2468 ninecircleinversesansserif;2792 ninedeva;096F ninegujarati;0AEF ninegurmukhi;0A6F ninehackarabic;0669 ninehangzhou;3029 nineideographicparen;3228 nineinferior;2089 ninemonospace;FF19 nineoldstyle;F739 nineparen;247C nineperiod;2490 ninepersian;06F9 nineroman;2178 ninesuperior;2079 nineteencircle;2472 nineteenparen;2486 nineteenperiod;249A ninethai;0E59 nj;01CC njecyrillic;045A nkatakana;30F3 nkatakanahalfwidth;FF9D nlegrightlong;019E nlinebelow;1E49 nmonospace;FF4E nmsquare;339A nnabengali;09A3 nnadeva;0923 nnagujarati;0AA3 nnagurmukhi;0A23 nnnadeva;0929 nohiragana;306E nokatakana;30CE nokatakanahalfwidth;FF89 nonbreakingspace;00A0 nonenthai;0E13 nonuthai;0E19 noonarabic;0646 noonfinalarabic;FEE6 noonghunnaarabic;06BA noonghunnafinalarabic;FB9F noonhehinitialarabic;FEE7 FEEC nooninitialarabic;FEE7 noonjeeminitialarabic;FCD2 noonjeemisolatedarabic;FC4B noonmedialarabic;FEE8 noonmeeminitialarabic;FCD5 noonmeemisolatedarabic;FC4E noonnoonfinalarabic;FC8D notcontains;220C notelement;2209 notelementof;2209 notequal;2260 notgreater;226F notgreaternorequal;2271 notgreaternorless;2279 notidentical;2262 notless;226E notlessnorequal;2270 notparallel;2226 notprecedes;2280 notsubset;2284 notsucceeds;2281 notsuperset;2285 nowarmenian;0576 nparen;24A9 nssquare;33B1 nsuperior;207F ntilde;00F1 nu;03BD nuhiragana;306C nukatakana;30CC nukatakanahalfwidth;FF87 nuktabengali;09BC nuktadeva;093C nuktagujarati;0ABC nuktagurmukhi;0A3C numbersign;0023 numbersignmonospace;FF03 numbersignsmall;FE5F numeralsigngreek;0374 numeralsignlowergreek;0375 numero;2116 nun;05E0 nundagesh;FB40 nundageshhebrew;FB40 nunhebrew;05E0 nvsquare;33B5 nwsquare;33BB nyabengali;099E nyadeva;091E nyagujarati;0A9E nyagurmukhi;0A1E o;006F oacute;00F3 oangthai;0E2D obarred;0275 obarredcyrillic;04E9 obarreddieresiscyrillic;04EB obengali;0993 obopomofo;311B obreve;014F ocandradeva;0911 ocandragujarati;0A91 ocandravowelsigndeva;0949 ocandravowelsigngujarati;0AC9 ocaron;01D2 ocircle;24DE ocircumflex;00F4 ocircumflexacute;1ED1 ocircumflexdotbelow;1ED9 ocircumflexgrave;1ED3 ocircumflexhookabove;1ED5 ocircumflextilde;1ED7 ocyrillic;043E odblacute;0151 odblgrave;020D odeva;0913 odieresis;00F6 odieresiscyrillic;04E7 odotbelow;1ECD oe;0153 oekorean;315A ogonek;02DB ogonekcmb;0328 ograve;00F2 ogujarati;0A93 oharmenian;0585 ohiragana;304A ohookabove;1ECF ohorn;01A1 ohornacute;1EDB ohorndotbelow;1EE3 ohorngrave;1EDD ohornhookabove;1EDF ohorntilde;1EE1 ohungarumlaut;0151 oi;01A3 oinvertedbreve;020F okatakana;30AA okatakanahalfwidth;FF75 okorean;3157 olehebrew;05AB omacron;014D omacronacute;1E53 omacrongrave;1E51 omdeva;0950 omega;03C9 omega1;03D6 omegacyrillic;0461 omegalatinclosed;0277 omegaroundcyrillic;047B omegatitlocyrillic;047D omegatonos;03CE omgujarati;0AD0 omicron;03BF omicrontonos;03CC omonospace;FF4F one;0031 onearabic;0661 onebengali;09E7 onecircle;2460 onecircleinversesansserif;278A onedeva;0967 onedotenleader;2024 oneeighth;215B onefitted;F6DC onegujarati;0AE7 onegurmukhi;0A67 onehackarabic;0661 onehalf;00BD onehangzhou;3021 oneideographicparen;3220 oneinferior;2081 onemonospace;FF11 onenumeratorbengali;09F4 oneoldstyle;F731 oneparen;2474 oneperiod;2488 onepersian;06F1 onequarter;00BC oneroman;2170 onesuperior;00B9 onethai;0E51 onethird;2153 oogonek;01EB oogonekmacron;01ED oogurmukhi;0A13 oomatragurmukhi;0A4B oopen;0254 oparen;24AA openbullet;25E6 option;2325 ordfeminine;00AA ordmasculine;00BA orthogonal;221F oshortdeva;0912 oshortvowelsigndeva;094A oslash;00F8 oslashacute;01FF osmallhiragana;3049 osmallkatakana;30A9 osmallkatakanahalfwidth;FF6B ostrokeacute;01FF osuperior;F6F0 otcyrillic;047F otilde;00F5 otildeacute;1E4D otildedieresis;1E4F oubopomofo;3121 overline;203E overlinecenterline;FE4A overlinecmb;0305 overlinedashed;FE49 overlinedblwavy;FE4C overlinewavy;FE4B overscore;00AF ovowelsignbengali;09CB ovowelsigndeva;094B ovowelsigngujarati;0ACB p;0070 paampssquare;3380 paasentosquare;332B pabengali;09AA pacute;1E55 padeva;092A pagedown;21DF pageup;21DE pagujarati;0AAA pagurmukhi;0A2A pahiragana;3071 paiyannoithai;0E2F pakatakana;30D1 palatalizationcyrilliccmb;0484 palochkacyrillic;04C0 pansioskorean;317F paragraph;00B6 parallel;2225 parenleft;0028 parenleftaltonearabic;FD3E parenleftbt;F8ED parenleftex;F8EC parenleftinferior;208D parenleftmonospace;FF08 parenleftsmall;FE59 parenleftsuperior;207D parenlefttp;F8EB parenleftvertical;FE35 parenright;0029 parenrightaltonearabic;FD3F parenrightbt;F8F8 parenrightex;F8F7 parenrightinferior;208E parenrightmonospace;FF09 parenrightsmall;FE5A parenrightsuperior;207E parenrighttp;F8F6 parenrightvertical;FE36 partialdiff;2202 paseqhebrew;05C0 pashtahebrew;0599 pasquare;33A9 patah;05B7 patah11;05B7 patah1d;05B7 patah2a;05B7 patahhebrew;05B7 patahnarrowhebrew;05B7 patahquarterhebrew;05B7 patahwidehebrew;05B7 pazerhebrew;05A1 pbopomofo;3106 pcircle;24DF pdotaccent;1E57 pe;05E4 pecyrillic;043F pedagesh;FB44 pedageshhebrew;FB44 peezisquare;333B pefinaldageshhebrew;FB43 peharabic;067E peharmenian;057A pehebrew;05E4 pehfinalarabic;FB57 pehinitialarabic;FB58 pehiragana;307A pehmedialarabic;FB59 pekatakana;30DA pemiddlehookcyrillic;04A7 perafehebrew;FB4E percent;0025 percentarabic;066A percentmonospace;FF05 percentsmall;FE6A period;002E periodarmenian;0589 periodcentered;00B7 periodhalfwidth;FF61 periodinferior;F6E7 periodmonospace;FF0E periodsmall;FE52 periodsuperior;F6E8 perispomenigreekcmb;0342 perpendicular;22A5 perthousand;2030 peseta;20A7 pfsquare;338A phabengali;09AB phadeva;092B phagujarati;0AAB phagurmukhi;0A2B phi;03C6 phi1;03D5 phieuphacirclekorean;327A phieuphaparenkorean;321A phieuphcirclekorean;326C phieuphkorean;314D phieuphparenkorean;320C philatin;0278 phinthuthai;0E3A phisymbolgreek;03D5 phook;01A5 phophanthai;0E1E phophungthai;0E1C phosamphaothai;0E20 pi;03C0 pieupacirclekorean;3273 pieupaparenkorean;3213 pieupcieuckorean;3176 pieupcirclekorean;3265 pieupkiyeokkorean;3172 pieupkorean;3142 pieupparenkorean;3205 pieupsioskiyeokkorean;3174 pieupsioskorean;3144 pieupsiostikeutkorean;3175 pieupthieuthkorean;3177 pieuptikeutkorean;3173 pihiragana;3074 pikatakana;30D4 pisymbolgreek;03D6 piwrarmenian;0583 plus;002B plusbelowcmb;031F pluscircle;2295 plusminus;00B1 plusmod;02D6 plusmonospace;FF0B plussmall;FE62 plussuperior;207A pmonospace;FF50 pmsquare;33D8 pohiragana;307D pointingindexdownwhite;261F pointingindexleftwhite;261C pointingindexrightwhite;261E pointingindexupwhite;261D pokatakana;30DD poplathai;0E1B postalmark;3012 postalmarkface;3020 pparen;24AB precedes;227A prescription;211E primemod;02B9 primereversed;2035 product;220F projective;2305 prolongedkana;30FC propellor;2318 propersubset;2282 propersuperset;2283 proportion;2237 proportional;221D psi;03C8 psicyrillic;0471 psilipneumatacyrilliccmb;0486 pssquare;33B0 puhiragana;3077 pukatakana;30D7 pvsquare;33B4 pwsquare;33BA q;0071 qadeva;0958 qadmahebrew;05A8 qafarabic;0642 qaffinalarabic;FED6 qafinitialarabic;FED7 qafmedialarabic;FED8 qamats;05B8 qamats10;05B8 qamats1a;05B8 qamats1c;05B8 qamats27;05B8 qamats29;05B8 qamats33;05B8 qamatsde;05B8 qamatshebrew;05B8 qamatsnarrowhebrew;05B8 qamatsqatanhebrew;05B8 qamatsqatannarrowhebrew;05B8 qamatsqatanquarterhebrew;05B8 qamatsqatanwidehebrew;05B8 qamatsquarterhebrew;05B8 qamatswidehebrew;05B8 qarneyparahebrew;059F qbopomofo;3111 qcircle;24E0 qhook;02A0 qmonospace;FF51 qof;05E7 qofdagesh;FB47 qofdageshhebrew;FB47 qofhatafpatah;05E7 05B2 qofhatafpatahhebrew;05E7 05B2 qofhatafsegol;05E7 05B1 qofhatafsegolhebrew;05E7 05B1 qofhebrew;05E7 qofhiriq;05E7 05B4 qofhiriqhebrew;05E7 05B4 qofholam;05E7 05B9 qofholamhebrew;05E7 05B9 qofpatah;05E7 05B7 qofpatahhebrew;05E7 05B7 qofqamats;05E7 05B8 qofqamatshebrew;05E7 05B8 qofqubuts;05E7 05BB qofqubutshebrew;05E7 05BB qofsegol;05E7 05B6 qofsegolhebrew;05E7 05B6 qofsheva;05E7 05B0 qofshevahebrew;05E7 05B0 qoftsere;05E7 05B5 qoftserehebrew;05E7 05B5 qparen;24AC quarternote;2669 qubuts;05BB qubuts18;05BB qubuts25;05BB qubuts31;05BB qubutshebrew;05BB qubutsnarrowhebrew;05BB qubutsquarterhebrew;05BB qubutswidehebrew;05BB question;003F questionarabic;061F questionarmenian;055E questiondown;00BF questiondownsmall;F7BF questiongreek;037E questionmonospace;FF1F questionsmall;F73F quotedbl;0022 quotedblbase;201E quotedblleft;201C quotedblmonospace;FF02 quotedblprime;301E quotedblprimereversed;301D quotedblright;201D quoteleft;2018 quoteleftreversed;201B quotereversed;201B quoteright;2019 quoterightn;0149 quotesinglbase;201A quotesingle;0027 quotesinglemonospace;FF07 r;0072 raarmenian;057C rabengali;09B0 racute;0155 radeva;0930 radical;221A radicalex;F8E5 radoverssquare;33AE radoverssquaredsquare;33AF radsquare;33AD rafe;05BF rafehebrew;05BF ragujarati;0AB0 ragurmukhi;0A30 rahiragana;3089 rakatakana;30E9 rakatakanahalfwidth;FF97 ralowerdiagonalbengali;09F1 ramiddlediagonalbengali;09F0 ramshorn;0264 ratio;2236 rbopomofo;3116 rcaron;0159 rcedilla;0157 rcircle;24E1 rcommaaccent;0157 rdblgrave;0211 rdotaccent;1E59 rdotbelow;1E5B rdotbelowmacron;1E5D referencemark;203B reflexsubset;2286 reflexsuperset;2287 registered;00AE registersans;F8E8 registerserif;F6DA reharabic;0631 reharmenian;0580 rehfinalarabic;FEAE rehiragana;308C rehyehaleflamarabic;0631 FEF3 FE8E 0644 rekatakana;30EC rekatakanahalfwidth;FF9A resh;05E8 reshdageshhebrew;FB48 reshhatafpatah;05E8 05B2 reshhatafpatahhebrew;05E8 05B2 reshhatafsegol;05E8 05B1 reshhatafsegolhebrew;05E8 05B1 reshhebrew;05E8 reshhiriq;05E8 05B4 reshhiriqhebrew;05E8 05B4 reshholam;05E8 05B9 reshholamhebrew;05E8 05B9 reshpatah;05E8 05B7 reshpatahhebrew;05E8 05B7 reshqamats;05E8 05B8 reshqamatshebrew;05E8 05B8 reshqubuts;05E8 05BB reshqubutshebrew;05E8 05BB reshsegol;05E8 05B6 reshsegolhebrew;05E8 05B6 reshsheva;05E8 05B0 reshshevahebrew;05E8 05B0 reshtsere;05E8 05B5 reshtserehebrew;05E8 05B5 reversedtilde;223D reviahebrew;0597 reviamugrashhebrew;0597 revlogicalnot;2310 rfishhook;027E rfishhookreversed;027F rhabengali;09DD rhadeva;095D rho;03C1 rhook;027D rhookturned;027B rhookturnedsuperior;02B5 rhosymbolgreek;03F1 rhotichookmod;02DE rieulacirclekorean;3271 rieulaparenkorean;3211 rieulcirclekorean;3263 rieulhieuhkorean;3140 rieulkiyeokkorean;313A rieulkiyeoksioskorean;3169 rieulkorean;3139 rieulmieumkorean;313B rieulpansioskorean;316C rieulparenkorean;3203 rieulphieuphkorean;313F rieulpieupkorean;313C rieulpieupsioskorean;316B rieulsioskorean;313D rieulthieuthkorean;313E rieultikeutkorean;316A rieulyeorinhieuhkorean;316D rightangle;221F righttackbelowcmb;0319 righttriangle;22BF rihiragana;308A rikatakana;30EA rikatakanahalfwidth;FF98 ring;02DA ringbelowcmb;0325 ringcmb;030A ringhalfleft;02BF ringhalfleftarmenian;0559 ringhalfleftbelowcmb;031C ringhalfleftcentered;02D3 ringhalfright;02BE ringhalfrightbelowcmb;0339 ringhalfrightcentered;02D2 rinvertedbreve;0213 rittorusquare;3351 rlinebelow;1E5F rlongleg;027C rlonglegturned;027A rmonospace;FF52 rohiragana;308D rokatakana;30ED rokatakanahalfwidth;FF9B roruathai;0E23 rparen;24AD rrabengali;09DC rradeva;0931 rragurmukhi;0A5C rreharabic;0691 rrehfinalarabic;FB8D rrvocalicbengali;09E0 rrvocalicdeva;0960 rrvocalicgujarati;0AE0 rrvocalicvowelsignbengali;09C4 rrvocalicvowelsigndeva;0944 rrvocalicvowelsigngujarati;0AC4 rsuperior;F6F1 rtblock;2590 rturned;0279 rturnedsuperior;02B4 ruhiragana;308B rukatakana;30EB rukatakanahalfwidth;FF99 rupeemarkbengali;09F2 rupeesignbengali;09F3 rupiah;F6DD ruthai;0E24 rvocalicbengali;098B rvocalicdeva;090B rvocalicgujarati;0A8B rvocalicvowelsignbengali;09C3 rvocalicvowelsigndeva;0943 rvocalicvowelsigngujarati;0AC3 s;0073 sabengali;09B8 sacute;015B sacutedotaccent;1E65 sadarabic;0635 sadeva;0938 sadfinalarabic;FEBA sadinitialarabic;FEBB sadmedialarabic;FEBC sagujarati;0AB8 sagurmukhi;0A38 sahiragana;3055 sakatakana;30B5 sakatakanahalfwidth;FF7B sallallahoualayhewasallamarabic;FDFA samekh;05E1 samekhdagesh;FB41 samekhdageshhebrew;FB41 samekhhebrew;05E1 saraaathai;0E32 saraaethai;0E41 saraaimaimalaithai;0E44 saraaimaimuanthai;0E43 saraamthai;0E33 saraathai;0E30 saraethai;0E40 saraiileftthai;F886 saraiithai;0E35 saraileftthai;F885 saraithai;0E34 saraothai;0E42 saraueeleftthai;F888 saraueethai;0E37 saraueleftthai;F887 sarauethai;0E36 sarauthai;0E38 sarauuthai;0E39 sbopomofo;3119 scaron;0161 scarondotaccent;1E67 scedilla;015F schwa;0259 schwacyrillic;04D9 schwadieresiscyrillic;04DB schwahook;025A scircle;24E2 scircumflex;015D scommaaccent;0219 sdotaccent;1E61 sdotbelow;1E63 sdotbelowdotaccent;1E69 seagullbelowcmb;033C second;2033 secondtonechinese;02CA section;00A7 seenarabic;0633 seenfinalarabic;FEB2 seeninitialarabic;FEB3 seenmedialarabic;FEB4 segol;05B6 segol13;05B6 segol1f;05B6 segol2c;05B6 segolhebrew;05B6 segolnarrowhebrew;05B6 segolquarterhebrew;05B6 segoltahebrew;0592 segolwidehebrew;05B6 seharmenian;057D sehiragana;305B sekatakana;30BB sekatakanahalfwidth;FF7E semicolon;003B semicolonarabic;061B semicolonmonospace;FF1B semicolonsmall;FE54 semivoicedmarkkana;309C semivoicedmarkkanahalfwidth;FF9F sentisquare;3322 sentosquare;3323 seven;0037 sevenarabic;0667 sevenbengali;09ED sevencircle;2466 sevencircleinversesansserif;2790 sevendeva;096D seveneighths;215E sevengujarati;0AED sevengurmukhi;0A6D sevenhackarabic;0667 sevenhangzhou;3027 sevenideographicparen;3226 seveninferior;2087 sevenmonospace;FF17 sevenoldstyle;F737 sevenparen;247A sevenperiod;248E sevenpersian;06F7 sevenroman;2176 sevensuperior;2077 seventeencircle;2470 seventeenparen;2484 seventeenperiod;2498 seventhai;0E57 sfthyphen;00AD shaarmenian;0577 shabengali;09B6 shacyrillic;0448 shaddaarabic;0651 shaddadammaarabic;FC61 shaddadammatanarabic;FC5E shaddafathaarabic;FC60 shaddafathatanarabic;0651 064B shaddakasraarabic;FC62 shaddakasratanarabic;FC5F shade;2592 shadedark;2593 shadelight;2591 shademedium;2592 shadeva;0936 shagujarati;0AB6 shagurmukhi;0A36 shalshelethebrew;0593 shbopomofo;3115 shchacyrillic;0449 sheenarabic;0634 sheenfinalarabic;FEB6 sheeninitialarabic;FEB7 sheenmedialarabic;FEB8 sheicoptic;03E3 sheqel;20AA sheqelhebrew;20AA sheva;05B0 sheva115;05B0 sheva15;05B0 sheva22;05B0 sheva2e;05B0 shevahebrew;05B0 shevanarrowhebrew;05B0 shevaquarterhebrew;05B0 shevawidehebrew;05B0 shhacyrillic;04BB shimacoptic;03ED shin;05E9 shindagesh;FB49 shindageshhebrew;FB49 shindageshshindot;FB2C shindageshshindothebrew;FB2C shindageshsindot;FB2D shindageshsindothebrew;FB2D shindothebrew;05C1 shinhebrew;05E9 shinshindot;FB2A shinshindothebrew;FB2A shinsindot;FB2B shinsindothebrew;FB2B shook;0282 sigma;03C3 sigma1;03C2 sigmafinal;03C2 sigmalunatesymbolgreek;03F2 sihiragana;3057 sikatakana;30B7 sikatakanahalfwidth;FF7C siluqhebrew;05BD siluqlefthebrew;05BD similar;223C sindothebrew;05C2 siosacirclekorean;3274 siosaparenkorean;3214 sioscieuckorean;317E sioscirclekorean;3266 sioskiyeokkorean;317A sioskorean;3145 siosnieunkorean;317B siosparenkorean;3206 siospieupkorean;317D siostikeutkorean;317C six;0036 sixarabic;0666 sixbengali;09EC sixcircle;2465 sixcircleinversesansserif;278F sixdeva;096C sixgujarati;0AEC sixgurmukhi;0A6C sixhackarabic;0666 sixhangzhou;3026 sixideographicparen;3225 sixinferior;2086 sixmonospace;FF16 sixoldstyle;F736 sixparen;2479 sixperiod;248D sixpersian;06F6 sixroman;2175 sixsuperior;2076 sixteencircle;246F sixteencurrencydenominatorbengali;09F9 sixteenparen;2483 sixteenperiod;2497 sixthai;0E56 slash;002F slashmonospace;FF0F slong;017F slongdotaccent;1E9B smileface;263A smonospace;FF53 sofpasuqhebrew;05C3 softhyphen;00AD softsigncyrillic;044C sohiragana;305D sokatakana;30BD sokatakanahalfwidth;FF7F soliduslongoverlaycmb;0338 solidusshortoverlaycmb;0337 sorusithai;0E29 sosalathai;0E28 sosothai;0E0B sosuathai;0E2A space;0020 spacehackarabic;0020 spade;2660 spadesuitblack;2660 spadesuitwhite;2664 sparen;24AE squarebelowcmb;033B squarecc;33C4 squarecm;339D squarediagonalcrosshatchfill;25A9 squarehorizontalfill;25A4 squarekg;338F squarekm;339E squarekmcapital;33CE squareln;33D1 squarelog;33D2 squaremg;338E squaremil;33D5 squaremm;339C squaremsquared;33A1 squareorthogonalcrosshatchfill;25A6 squareupperlefttolowerrightfill;25A7 squareupperrighttolowerleftfill;25A8 squareverticalfill;25A5 squarewhitewithsmallblack;25A3 srsquare;33DB ssabengali;09B7 ssadeva;0937 ssagujarati;0AB7 ssangcieuckorean;3149 ssanghieuhkorean;3185 ssangieungkorean;3180 ssangkiyeokkorean;3132 ssangnieunkorean;3165 ssangpieupkorean;3143 ssangsioskorean;3146 ssangtikeutkorean;3138 ssuperior;F6F2 sterling;00A3 sterlingmonospace;FFE1 strokelongoverlaycmb;0336 strokeshortoverlaycmb;0335 subset;2282 subsetnotequal;228A subsetorequal;2286 succeeds;227B suchthat;220B suhiragana;3059 sukatakana;30B9 sukatakanahalfwidth;FF7D sukunarabic;0652 summation;2211 sun;263C superset;2283 supersetnotequal;228B supersetorequal;2287 svsquare;33DC syouwaerasquare;337C t;0074 tabengali;09A4 tackdown;22A4 tackleft;22A3 tadeva;0924 tagujarati;0AA4 tagurmukhi;0A24 taharabic;0637 tahfinalarabic;FEC2 tahinitialarabic;FEC3 tahiragana;305F tahmedialarabic;FEC4 taisyouerasquare;337D takatakana;30BF takatakanahalfwidth;FF80 tatweelarabic;0640 tau;03C4 tav;05EA tavdages;FB4A tavdagesh;FB4A tavdageshhebrew;FB4A tavhebrew;05EA tbar;0167 tbopomofo;310A tcaron;0165 tccurl;02A8 tcedilla;0163 tcheharabic;0686 tchehfinalarabic;FB7B tchehinitialarabic;FB7C tchehmedialarabic;FB7D tchehmeeminitialarabic;FB7C FEE4 tcircle;24E3 tcircumflexbelow;1E71 tcommaaccent;0163 tdieresis;1E97 tdotaccent;1E6B tdotbelow;1E6D tecyrillic;0442 tedescendercyrillic;04AD teharabic;062A tehfinalarabic;FE96 tehhahinitialarabic;FCA2 tehhahisolatedarabic;FC0C tehinitialarabic;FE97 tehiragana;3066 tehjeeminitialarabic;FCA1 tehjeemisolatedarabic;FC0B tehmarbutaarabic;0629 tehmarbutafinalarabic;FE94 tehmedialarabic;FE98 tehmeeminitialarabic;FCA4 tehmeemisolatedarabic;FC0E tehnoonfinalarabic;FC73 tekatakana;30C6 tekatakanahalfwidth;FF83 telephone;2121 telephoneblack;260E telishagedolahebrew;05A0 telishaqetanahebrew;05A9 tencircle;2469 tenideographicparen;3229 tenparen;247D tenperiod;2491 tenroman;2179 tesh;02A7 tet;05D8 tetdagesh;FB38 tetdageshhebrew;FB38 tethebrew;05D8 tetsecyrillic;04B5 tevirhebrew;059B tevirlefthebrew;059B thabengali;09A5 thadeva;0925 thagujarati;0AA5 thagurmukhi;0A25 thalarabic;0630 thalfinalarabic;FEAC thanthakhatlowleftthai;F898 thanthakhatlowrightthai;F897 thanthakhatthai;0E4C thanthakhatupperleftthai;F896 theharabic;062B thehfinalarabic;FE9A thehinitialarabic;FE9B thehmedialarabic;FE9C thereexists;2203 therefore;2234 theta;03B8 theta1;03D1 thetasymbolgreek;03D1 thieuthacirclekorean;3279 thieuthaparenkorean;3219 thieuthcirclekorean;326B thieuthkorean;314C thieuthparenkorean;320B thirteencircle;246C thirteenparen;2480 thirteenperiod;2494 thonangmonthothai;0E11 thook;01AD thophuthaothai;0E12 thorn;00FE thothahanthai;0E17 thothanthai;0E10 thothongthai;0E18 thothungthai;0E16 thousandcyrillic;0482 thousandsseparatorarabic;066C thousandsseparatorpersian;066C three;0033 threearabic;0663 threebengali;09E9 threecircle;2462 threecircleinversesansserif;278C threedeva;0969 threeeighths;215C threegujarati;0AE9 threegurmukhi;0A69 threehackarabic;0663 threehangzhou;3023 threeideographicparen;3222 threeinferior;2083 threemonospace;FF13 threenumeratorbengali;09F6 threeoldstyle;F733 threeparen;2476 threeperiod;248A threepersian;06F3 threequarters;00BE threequartersemdash;F6DE threeroman;2172 threesuperior;00B3 threethai;0E53 thzsquare;3394 tihiragana;3061 tikatakana;30C1 tikatakanahalfwidth;FF81 tikeutacirclekorean;3270 tikeutaparenkorean;3210 tikeutcirclekorean;3262 tikeutkorean;3137 tikeutparenkorean;3202 tilde;02DC tildebelowcmb;0330 tildecmb;0303 tildecomb;0303 tildedoublecmb;0360 tildeoperator;223C tildeoverlaycmb;0334 tildeverticalcmb;033E timescircle;2297 tipehahebrew;0596 tipehalefthebrew;0596 tippigurmukhi;0A70 titlocyrilliccmb;0483 tiwnarmenian;057F tlinebelow;1E6F tmonospace;FF54 toarmenian;0569 tohiragana;3068 tokatakana;30C8 tokatakanahalfwidth;FF84 tonebarextrahighmod;02E5 tonebarextralowmod;02E9 tonebarhighmod;02E6 tonebarlowmod;02E8 tonebarmidmod;02E7 tonefive;01BD tonesix;0185 tonetwo;01A8 tonos;0384 tonsquare;3327 topatakthai;0E0F tortoiseshellbracketleft;3014 tortoiseshellbracketleftsmall;FE5D tortoiseshellbracketleftvertical;FE39 tortoiseshellbracketright;3015 tortoiseshellbracketrightsmall;FE5E tortoiseshellbracketrightvertical;FE3A totaothai;0E15 tpalatalhook;01AB tparen;24AF trademark;2122 trademarksans;F8EA trademarkserif;F6DB tretroflexhook;0288 triagdn;25BC triaglf;25C4 triagrt;25BA triagup;25B2 ts;02A6 tsadi;05E6 tsadidagesh;FB46 tsadidageshhebrew;FB46 tsadihebrew;05E6 tsecyrillic;0446 tsere;05B5 tsere12;05B5 tsere1e;05B5 tsere2b;05B5 tserehebrew;05B5 tserenarrowhebrew;05B5 tserequarterhebrew;05B5 tserewidehebrew;05B5 tshecyrillic;045B tsuperior;F6F3 ttabengali;099F ttadeva;091F ttagujarati;0A9F ttagurmukhi;0A1F tteharabic;0679 ttehfinalarabic;FB67 ttehinitialarabic;FB68 ttehmedialarabic;FB69 tthabengali;09A0 tthadeva;0920 tthagujarati;0AA0 tthagurmukhi;0A20 tturned;0287 tuhiragana;3064 tukatakana;30C4 tukatakanahalfwidth;FF82 tusmallhiragana;3063 tusmallkatakana;30C3 tusmallkatakanahalfwidth;FF6F twelvecircle;246B twelveparen;247F twelveperiod;2493 twelveroman;217B twentycircle;2473 twentyhangzhou;5344 twentyparen;2487 twentyperiod;249B two;0032 twoarabic;0662 twobengali;09E8 twocircle;2461 twocircleinversesansserif;278B twodeva;0968 twodotenleader;2025 twodotleader;2025 twodotleadervertical;FE30 twogujarati;0AE8 twogurmukhi;0A68 twohackarabic;0662 twohangzhou;3022 twoideographicparen;3221 twoinferior;2082 twomonospace;FF12 twonumeratorbengali;09F5 twooldstyle;F732 twoparen;2475 twoperiod;2489 twopersian;06F2 tworoman;2171 twostroke;01BB twosuperior;00B2 twothai;0E52 twothirds;2154 u;0075 uacute;00FA ubar;0289 ubengali;0989 ubopomofo;3128 ubreve;016D ucaron;01D4 ucircle;24E4 ucircumflex;00FB ucircumflexbelow;1E77 ucyrillic;0443 udattadeva;0951 udblacute;0171 udblgrave;0215 udeva;0909 udieresis;00FC udieresisacute;01D8 udieresisbelow;1E73 udieresiscaron;01DA udieresiscyrillic;04F1 udieresisgrave;01DC udieresismacron;01D6 udotbelow;1EE5 ugrave;00F9 ugujarati;0A89 ugurmukhi;0A09 uhiragana;3046 uhookabove;1EE7 uhorn;01B0 uhornacute;1EE9 uhorndotbelow;1EF1 uhorngrave;1EEB uhornhookabove;1EED uhorntilde;1EEF uhungarumlaut;0171 uhungarumlautcyrillic;04F3 uinvertedbreve;0217 ukatakana;30A6 ukatakanahalfwidth;FF73 ukcyrillic;0479 ukorean;315C umacron;016B umacroncyrillic;04EF umacrondieresis;1E7B umatragurmukhi;0A41 umonospace;FF55 underscore;005F underscoredbl;2017 underscoremonospace;FF3F underscorevertical;FE33 underscorewavy;FE4F union;222A universal;2200 uogonek;0173 uparen;24B0 upblock;2580 upperdothebrew;05C4 upsilon;03C5 upsilondieresis;03CB upsilondieresistonos;03B0 upsilonlatin;028A upsilontonos;03CD uptackbelowcmb;031D uptackmod;02D4 uragurmukhi;0A73 uring;016F ushortcyrillic;045E usmallhiragana;3045 usmallkatakana;30A5 usmallkatakanahalfwidth;FF69 ustraightcyrillic;04AF ustraightstrokecyrillic;04B1 utilde;0169 utildeacute;1E79 utildebelow;1E75 uubengali;098A uudeva;090A uugujarati;0A8A uugurmukhi;0A0A uumatragurmukhi;0A42 uuvowelsignbengali;09C2 uuvowelsigndeva;0942 uuvowelsigngujarati;0AC2 uvowelsignbengali;09C1 uvowelsigndeva;0941 uvowelsigngujarati;0AC1 v;0076 vadeva;0935 vagujarati;0AB5 vagurmukhi;0A35 vakatakana;30F7 vav;05D5 vavdagesh;FB35 vavdagesh65;FB35 vavdageshhebrew;FB35 vavhebrew;05D5 vavholam;FB4B vavholamhebrew;FB4B vavvavhebrew;05F0 vavyodhebrew;05F1 vcircle;24E5 vdotbelow;1E7F vecyrillic;0432 veharabic;06A4 vehfinalarabic;FB6B vehinitialarabic;FB6C vehmedialarabic;FB6D vekatakana;30F9 venus;2640 verticalbar;007C verticallineabovecmb;030D verticallinebelowcmb;0329 verticallinelowmod;02CC verticallinemod;02C8 vewarmenian;057E vhook;028B vikatakana;30F8 viramabengali;09CD viramadeva;094D viramagujarati;0ACD visargabengali;0983 visargadeva;0903 visargagujarati;0A83 vmonospace;FF56 voarmenian;0578 voicediterationhiragana;309E voicediterationkatakana;30FE voicedmarkkana;309B voicedmarkkanahalfwidth;FF9E vokatakana;30FA vparen;24B1 vtilde;1E7D vturned;028C vuhiragana;3094 vukatakana;30F4 w;0077 wacute;1E83 waekorean;3159 wahiragana;308F wakatakana;30EF wakatakanahalfwidth;FF9C wakorean;3158 wasmallhiragana;308E wasmallkatakana;30EE wattosquare;3357 wavedash;301C wavyunderscorevertical;FE34 wawarabic;0648 wawfinalarabic;FEEE wawhamzaabovearabic;0624 wawhamzaabovefinalarabic;FE86 wbsquare;33DD wcircle;24E6 wcircumflex;0175 wdieresis;1E85 wdotaccent;1E87 wdotbelow;1E89 wehiragana;3091 weierstrass;2118 wekatakana;30F1 wekorean;315E weokorean;315D wgrave;1E81 whitebullet;25E6 whitecircle;25CB whitecircleinverse;25D9 whitecornerbracketleft;300E whitecornerbracketleftvertical;FE43 whitecornerbracketright;300F whitecornerbracketrightvertical;FE44 whitediamond;25C7 whitediamondcontainingblacksmalldiamond;25C8 whitedownpointingsmalltriangle;25BF whitedownpointingtriangle;25BD whiteleftpointingsmalltriangle;25C3 whiteleftpointingtriangle;25C1 whitelenticularbracketleft;3016 whitelenticularbracketright;3017 whiterightpointingsmalltriangle;25B9 whiterightpointingtriangle;25B7 whitesmallsquare;25AB whitesmilingface;263A whitesquare;25A1 whitestar;2606 whitetelephone;260F whitetortoiseshellbracketleft;3018 whitetortoiseshellbracketright;3019 whiteuppointingsmalltriangle;25B5 whiteuppointingtriangle;25B3 wihiragana;3090 wikatakana;30F0 wikorean;315F wmonospace;FF57 wohiragana;3092 wokatakana;30F2 wokatakanahalfwidth;FF66 won;20A9 wonmonospace;FFE6 wowaenthai;0E27 wparen;24B2 wring;1E98 wsuperior;02B7 wturned;028D wynn;01BF x;0078 xabovecmb;033D xbopomofo;3112 xcircle;24E7 xdieresis;1E8D xdotaccent;1E8B xeharmenian;056D xi;03BE xmonospace;FF58 xparen;24B3 xsuperior;02E3 y;0079 yaadosquare;334E yabengali;09AF yacute;00FD yadeva;092F yaekorean;3152 yagujarati;0AAF yagurmukhi;0A2F yahiragana;3084 yakatakana;30E4 yakatakanahalfwidth;FF94 yakorean;3151 yamakkanthai;0E4E yasmallhiragana;3083 yasmallkatakana;30E3 yasmallkatakanahalfwidth;FF6C yatcyrillic;0463 ycircle;24E8 ycircumflex;0177 ydieresis;00FF ydotaccent;1E8F ydotbelow;1EF5 yeharabic;064A yehbarreearabic;06D2 yehbarreefinalarabic;FBAF yehfinalarabic;FEF2 yehhamzaabovearabic;0626 yehhamzaabovefinalarabic;FE8A yehhamzaaboveinitialarabic;FE8B yehhamzaabovemedialarabic;FE8C yehinitialarabic;FEF3 yehmedialarabic;FEF4 yehmeeminitialarabic;FCDD yehmeemisolatedarabic;FC58 yehnoonfinalarabic;FC94 yehthreedotsbelowarabic;06D1 yekorean;3156 yen;00A5 yenmonospace;FFE5 yeokorean;3155 yeorinhieuhkorean;3186 yerahbenyomohebrew;05AA yerahbenyomolefthebrew;05AA yericyrillic;044B yerudieresiscyrillic;04F9 yesieungkorean;3181 yesieungpansioskorean;3183 yesieungsioskorean;3182 yetivhebrew;059A ygrave;1EF3 yhook;01B4 yhookabove;1EF7 yiarmenian;0575 yicyrillic;0457 yikorean;3162 yinyang;262F yiwnarmenian;0582 ymonospace;FF59 yod;05D9 yoddagesh;FB39 yoddageshhebrew;FB39 yodhebrew;05D9 yodyodhebrew;05F2 yodyodpatahhebrew;FB1F yohiragana;3088 yoikorean;3189 yokatakana;30E8 yokatakanahalfwidth;FF96 yokorean;315B yosmallhiragana;3087 yosmallkatakana;30E7 yosmallkatakanahalfwidth;FF6E yotgreek;03F3 yoyaekorean;3188 yoyakorean;3187 yoyakthai;0E22 yoyingthai;0E0D yparen;24B4 ypogegrammeni;037A ypogegrammenigreekcmb;0345 yr;01A6 yring;1E99 ysuperior;02B8 ytilde;1EF9 yturned;028E yuhiragana;3086 yuikorean;318C yukatakana;30E6 yukatakanahalfwidth;FF95 yukorean;3160 yusbigcyrillic;046B yusbigiotifiedcyrillic;046D yuslittlecyrillic;0467 yuslittleiotifiedcyrillic;0469 yusmallhiragana;3085 yusmallkatakana;30E5 yusmallkatakanahalfwidth;FF6D yuyekorean;318B yuyeokorean;318A yyabengali;09DF yyadeva;095F z;007A zaarmenian;0566 zacute;017A zadeva;095B zagurmukhi;0A5B zaharabic;0638 zahfinalarabic;FEC6 zahinitialarabic;FEC7 zahiragana;3056 zahmedialarabic;FEC8 zainarabic;0632 zainfinalarabic;FEB0 zakatakana;30B6 zaqefgadolhebrew;0595 zaqefqatanhebrew;0594 zarqahebrew;0598 zayin;05D6 zayindagesh;FB36 zayindageshhebrew;FB36 zayinhebrew;05D6 zbopomofo;3117 zcaron;017E zcircle;24E9 zcircumflex;1E91 zcurl;0291 zdot;017C zdotaccent;017C zdotbelow;1E93 zecyrillic;0437 zedescendercyrillic;0499 zedieresiscyrillic;04DF zehiragana;305C zekatakana;30BC zero;0030 zeroarabic;0660 zerobengali;09E6 zerodeva;0966 zerogujarati;0AE6 zerogurmukhi;0A66 zerohackarabic;0660 zeroinferior;2080 zeromonospace;FF10 zerooldstyle;F730 zeropersian;06F0 zerosuperior;2070 zerothai;0E50 zerowidthjoiner;FEFF zerowidthnonjoiner;200C zerowidthspace;200B zeta;03B6 zhbopomofo;3113 zhearmenian;056A zhebrevecyrillic;04C2 zhecyrillic;0436 zhedescendercyrillic;0497 zhedieresiscyrillic;04DD zihiragana;3058 zikatakana;30B8 zinorhebrew;05AE zlinebelow;1E95 zmonospace;FF5A zohiragana;305E zokatakana;30BE zparen;24B5 zretroflexhook;0290 zstroke;01B6 zuhiragana;305A zukatakana;30BA a100;275E a101;2761 a102;2762 a103;2763 a104;2764 a105;2710 a106;2765 a107;2766 a108;2767 a109;2660 a10;2721 a110;2665 a111;2666 a112;2663 a117;2709 a118;2708 a119;2707 a11;261B a120;2460 a121;2461 a122;2462 a123;2463 a124;2464 a125;2465 a126;2466 a127;2467 a128;2468 a129;2469 a12;261E a130;2776 a131;2777 a132;2778 a133;2779 a134;277A a135;277B a136;277C a137;277D a138;277E a139;277F a13;270C a140;2780 a141;2781 a142;2782 a143;2783 a144;2784 a145;2785 a146;2786 a147;2787 a148;2788 a149;2789 a14;270D a150;278A a151;278B a152;278C a153;278D a154;278E a155;278F a156;2790 a157;2791 a158;2792 a159;2793 a15;270E a160;2794 a161;2192 a162;27A3 a163;2194 a164;2195 a165;2799 a166;279B a167;279C a168;279D a169;279E a16;270F a170;279F a171;27A0 a172;27A1 a173;27A2 a174;27A4 a175;27A5 a176;27A6 a177;27A7 a178;27A8 a179;27A9 a17;2711 a180;27AB a181;27AD a182;27AF a183;27B2 a184;27B3 a185;27B5 a186;27B8 a187;27BA a188;27BB a189;27BC a18;2712 a190;27BD a191;27BE a192;279A a193;27AA a194;27B6 a195;27B9 a196;2798 a197;27B4 a198;27B7 a199;27AC a19;2713 a1;2701 a200;27AE a201;27B1 a202;2703 a203;2750 a204;2752 a205;276E a206;2770 a20;2714 a21;2715 a22;2716 a23;2717 a24;2718 a25;2719 a26;271A a27;271B a28;271C a29;2722 a2;2702 a30;2723 a31;2724 a32;2725 a33;2726 a34;2727 a35;2605 a36;2729 a37;272A a38;272B a39;272C a3;2704 a40;272D a41;272E a42;272F a43;2730 a44;2731 a45;2732 a46;2733 a47;2734 a48;2735 a49;2736 a4;260E a50;2737 a51;2738 a52;2739 a53;273A a54;273B a55;273C a56;273D a57;273E a58;273F a59;2740 a5;2706 a60;2741 a61;2742 a62;2743 a63;2744 a64;2745 a65;2746 a66;2747 a67;2748 a68;2749 a69;274A a6;271D a70;274B a71;25CF a72;274D a73;25A0 a74;274F a75;2751 a76;25B2 a77;25BC a78;25C6 a79;2756 a7;271E a81;25D7 a82;2758 a83;2759 a84;275A a85;276F a86;2771 a87;2772 a88;2773 a89;2768 a8;271F a90;2769 a91;276C a92;276D a93;276A a94;276B a95;2774 a96;2775 a97;275B a98;275C a99;275D a9;2720 """ # string table management # class StringTable: def __init__( self, name_list, master_table_name ): self.names = name_list self.master_table = master_table_name self.indices = {} index = 0 for name in name_list: self.indices[name] = index index += len( name ) + 1 self.total = index def dump( self, file ): write = file.write write( " static const char " + self.master_table + "[" + repr( self.total ) + "] =\n" ) write( " {\n" ) line = "" for name in self.names: line += " '" line += string.join( ( re.findall( ".", name ) ), "','" ) line += "', 0,\n" write( line + " };\n\n\n" ) def dump_sublist( self, file, table_name, macro_name, sublist ): write = file.write write( "#define " + macro_name + " " + repr( len( sublist ) ) + "\n\n" ) write( " /* Values are offsets into the `" + self.master_table + "' table */\n\n" ) write( " static const short " + table_name + "[" + macro_name + "] =\n" ) write( " {\n" ) line = " " comma = "" col = 0 for name in sublist: line += comma line += "%4d" % self.indices[name] col += 1 comma = "," if col == 14: col = 0 comma = ",\n " write( line + "\n };\n\n\n" ) # We now store the Adobe Glyph List in compressed form. The list is put # into a data structure called `trie' (because it has a tree-like # appearance). Consider, for example, that you want to store the # following name mapping: # # A => 1 # Aacute => 6 # Abalon => 2 # Abstract => 4 # # It is possible to store the entries as follows. # # A => 1 # | # +-acute => 6 # | # +-b # | # +-alon => 2 # | # +-stract => 4 # # We see that each node in the trie has: # # - one or more `letters' # - an optional value # - zero or more child nodes # # The first step is to call # # root = StringNode( "", 0 ) # for word in map.values(): # root.add( word, map[word] ) # # which creates a large trie where each node has only one children. # # Executing # # root = root.optimize() # # optimizes the trie by merging the letters of successive nodes whenever # possible. # # Each node of the trie is stored as follows. # # - First the node's letter, according to the following scheme. We # use the fact that in the AGL no name contains character codes > 127. # # name bitsize description # ---------------------------------------------------------------- # notlast 1 Set to 1 if this is not the last letter # in the word. # ascii 7 The letter's ASCII value. # # - The letter is followed by a children count and the value of the # current key (if any). Again we can do some optimization because all # AGL entries are from the BMP; this means that 16 bits are sufficient # to store its Unicode values. Additionally, no node has more than # 127 children. # # name bitsize description # ----------------------------------------- # hasvalue 1 Set to 1 if a 16-bit Unicode value follows. # num_children 7 Number of children. Can be 0 only if # `hasvalue' is set to 1. # value 16 Optional Unicode value. # # - A node is finished by a list of 16bit absolute offsets to the # children, which must be sorted in increasing order of their first # letter. # # For simplicity, all 16bit quantities are stored in big-endian order. # # The root node has first letter = 0, and no value. # class StringNode: def __init__( self, letter, value ): self.letter = letter self.value = value self.children = {} def __cmp__( self, other ): return ord( self.letter[0] ) - ord( other.letter[0] ) def add( self, word, value ): if len( word ) == 0: self.value = value return letter = word[0] word = word[1:] if self.children.has_key( letter ): child = self.children[letter] else: child = StringNode( letter, 0 ) self.children[letter] = child child.add( word, value ) def optimize( self ): # optimize all children first children = self.children.values() self.children = {} for child in children: self.children[child.letter[0]] = child.optimize() # don't optimize if there's a value, # if we don't have any child or if we # have more than one child if ( self.value != 0 ) or ( not children ) or len( children ) > 1: return self child = children[0] self.letter += child.letter self.value = child.value self.children = child.children return self def dump_debug( self, write, margin ): # this is used during debugging line = margin + "+-" if len( self.letter ) == 0: line += "<NOLETTER>" else: line += self.letter if self.value: line += " => " + repr( self.value ) write( line + "\n" ) if self.children: margin += "| " for child in self.children.values(): child.dump_debug( write, margin ) def locate( self, index ): self.index = index if len( self.letter ) > 0: index += len( self.letter ) + 1 else: index += 2 if self.value != 0: index += 2 children = self.children.values() children.sort() index += 2 * len( children ) for child in children: index = child.locate( index ) return index def store( self, storage ): # write the letters l = len( self.letter ) if l == 0: storage += struct.pack( "B", 0 ) else: for n in range( l ): val = ord( self.letter[n] ) if n < l - 1: val += 128 storage += struct.pack( "B", val ) # write the count children = self.children.values() children.sort() count = len( children ) if self.value != 0: storage += struct.pack( "!BH", count + 128, self.value ) else: storage += struct.pack( "B", count ) for child in children: storage += struct.pack( "!H", child.index ) for child in children: storage = child.store( storage ) return storage def adobe_glyph_values(): """return the list of glyph names and their unicode values""" lines = string.split( adobe_glyph_list, '\n' ) glyphs = [] values = [] for line in lines: if line: fields = string.split( line, ';' ) # print fields[1] + ' - ' + fields[0] subfields = string.split( fields[1], ' ' ) if len( subfields ) == 1: glyphs.append( fields[0] ) values.append( fields[1] ) return glyphs, values def filter_glyph_names( alist, filter ): """filter `alist' by taking _out_ all glyph names that are in `filter'""" count = 0 extras = [] for name in alist: try: filtered_index = filter.index( name ) except: extras.append( name ) return extras def dump_encoding( file, encoding_name, encoding_list ): """dump a given encoding""" write = file.write write( " /* the following are indices into the SID name table */\n" ) write( " static const unsigned short " + encoding_name + "[" + repr( len( encoding_list ) ) + "] =\n" ) write( " {\n" ) line = " " comma = "" col = 0 for value in encoding_list: line += comma line += "%3d" % value comma = "," col += 1 if col == 16: col = 0 comma = ",\n " write( line + "\n };\n\n\n" ) def dump_array( the_array, write, array_name ): """dumps a given encoding""" write( " static const unsigned char " + array_name + "[" + repr( len( the_array ) ) + "L] =\n" ) write( " {\n" ) line = "" comma = " " col = 0 for value in the_array: line += comma line += "%3d" % ord( value ) comma = "," col += 1 if col == 16: col = 0 comma = ",\n " if len( line ) > 1024: write( line ) line = "" write( line + "\n };\n\n\n" ) def main(): """main program body""" if len( sys.argv ) != 2: print __doc__ % sys.argv[0] sys.exit( 1 ) file = open( sys.argv[1], "w\n" ) write = file.write count_sid = len( sid_standard_names ) # `mac_extras' contains the list of glyph names in the Macintosh standard # encoding which are not in the SID Standard Names. # mac_extras = filter_glyph_names( mac_standard_names, sid_standard_names ) # `base_list' contains the names of our final glyph names table. # It consists of the `mac_extras' glyph names, followed by the SID # standard names. # mac_extras_count = len( mac_extras ) base_list = mac_extras + sid_standard_names write( "/***************************************************************************/\n" ) write( "/* */\n" ) write( "/* %-71s*/\n" % os.path.basename( sys.argv[1] ) ) write( "/* */\n" ) write( "/* PostScript glyph names. */\n" ) write( "/* */\n" ) write( "/* Copyright 2005, 2008, 2011 by */\n" ) write( "/* David Turner, Robert Wilhelm, and Werner Lemberg. */\n" ) write( "/* */\n" ) write( "/* This file is part of the FreeType project, and may only be used, */\n" ) write( "/* modified, and distributed under the terms of the FreeType project */\n" ) write( "/* license, LICENSE.TXT. By continuing to use, modify, or distribute */\n" ) write( "/* this file you indicate that you have read the license and */\n" ) write( "/* understand and accept it fully. */\n" ) write( "/* */\n" ) write( "/***************************************************************************/\n" ) write( "\n" ) write( "\n" ) write( " /* This file has been generated automatically -- do not edit! */\n" ) write( "\n" ) write( "\n" ) # dump final glyph list (mac extras + sid standard names) # st = StringTable( base_list, "ft_standard_glyph_names" ) st.dump( file ) st.dump_sublist( file, "ft_mac_names", "FT_NUM_MAC_NAMES", mac_standard_names ) st.dump_sublist( file, "ft_sid_names", "FT_NUM_SID_NAMES", sid_standard_names ) dump_encoding( file, "t1_standard_encoding", t1_standard_encoding ) dump_encoding( file, "t1_expert_encoding", t1_expert_encoding ) # dump the AGL in its compressed form # agl_glyphs, agl_values = adobe_glyph_values() dict = StringNode( "", 0 ) for g in range( len( agl_glyphs ) ): dict.add( agl_glyphs[g], eval( "0x" + agl_values[g] ) ) dict = dict.optimize() dict_len = dict.locate( 0 ) dict_array = dict.store( "" ) write( """\ /* * This table is a compressed version of the Adobe Glyph List (AGL), * optimized for efficient searching. It has been generated by the * `glnames.py' python script located in the `src/tools' directory. * * The lookup function to get the Unicode value for a given string * is defined below the table. */ #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST """ ) dump_array( dict_array, write, "ft_adobe_glyph_list" ) # write the lookup routine now # write( """\ /* * This function searches the compressed table efficiently. */ static unsigned long ft_get_adobe_glyph_index( const char* name, const char* limit ) { int c = 0; int count, min, max; const unsigned char* p = ft_adobe_glyph_list; if ( name == 0 || name >= limit ) goto NotFound; c = *name++; count = p[1]; p += 2; min = 0; max = count; while ( min < max ) { int mid = ( min + max ) >> 1; const unsigned char* q = p + mid * 2; int c2; q = ft_adobe_glyph_list + ( ( (int)q[0] << 8 ) | q[1] ); c2 = q[0] & 127; if ( c2 == c ) { p = q; goto Found; } if ( c2 < c ) min = mid + 1; else max = mid; } goto NotFound; Found: for (;;) { /* assert (*p & 127) == c */ if ( name >= limit ) { if ( (p[0] & 128) == 0 && (p[1] & 128) != 0 ) return (unsigned long)( ( (int)p[2] << 8 ) | p[3] ); goto NotFound; } c = *name++; if ( p[0] & 128 ) { p++; if ( c != (p[0] & 127) ) goto NotFound; continue; } p++; count = p[0] & 127; if ( p[0] & 128 ) p += 2; p++; for ( ; count > 0; count--, p += 2 ) { int offset = ( (int)p[0] << 8 ) | p[1]; const unsigned char* q = ft_adobe_glyph_list + offset; if ( c == ( q[0] & 127 ) ) { p = q; goto NextIter; } } goto NotFound; NextIter: ; } NotFound: return 0; } #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ """ ) if 0: # generate unit test, or don't # # now write the unit test to check that everything works OK # write( "#ifdef TEST\n\n" ) write( "static const char* const the_names[] = {\n" ) for name in agl_glyphs: write( ' "' + name + '",\n' ) write( " 0\n};\n" ) write( "static const unsigned long the_values[] = {\n" ) for val in agl_values: write( ' 0x' + val + ',\n' ) write( " 0\n};\n" ) write( """ #include <stdlib.h> #include <stdio.h> int main( void ) { int result = 0; const char* const* names = the_names; const unsigned long* values = the_values; for ( ; *names; names++, values++ ) { const char* name = *names; unsigned long reference = *values; unsigned long value; value = ft_get_adobe_glyph_index( name, name + strlen( name ) ); if ( value != reference ) { result = 1; fprintf( stderr, "name '%s' => %04x instead of %04x\\n", name, value, reference ); } } return result; } """ ) write( "#endif /* TEST */\n" ) write("\n/* END */\n") # Now run the main routine # main() # END
Python
#!/usr/bin/env python # # Check trace components in FreeType 2 source. # Author: suzuki toshiya, 2009 # # This code is explicitly into the public domain. import sys import os import re SRC_FILE_LIST = [] USED_COMPONENT = {} KNOWN_COMPONENT = {} SRC_FILE_DIRS = [ "src" ] TRACE_DEF_FILES = [ "include/freetype/internal/fttrace.h" ] # -------------------------------------------------------------- # Parse command line options # for i in range( 1, len( sys.argv ) ): if sys.argv[i].startswith( "--help" ): print "Usage: %s [option]" % sys.argv[0] print "Search used-but-defined and defined-but-not-used trace_XXX macros" print "" print " --help:" print " Show this help" print "" print " --src-dirs=dir1:dir2:..." print " Specify the directories of C source files to be checked" print " Default is %s" % ":".join( SRC_FILE_DIRS ) print "" print " --def-files=file1:file2:..." print " Specify the header files including FT_TRACE_DEF()" print " Default is %s" % ":".join( TRACE_DEF_FILES ) print "" exit(0) if sys.argv[i].startswith( "--src-dirs=" ): SRC_FILE_DIRS = sys.argv[i].replace( "--src-dirs=", "", 1 ).split( ":" ) elif sys.argv[i].startswith( "--def-files=" ): TRACE_DEF_FILES = sys.argv[i].replace( "--def-files=", "", 1 ).split( ":" ) # -------------------------------------------------------------- # Scan C source and header files using trace macros. # c_pathname_pat = re.compile( '^.*\.[ch]$', re.IGNORECASE ) trace_use_pat = re.compile( '^[ \t]*#define[ \t]+FT_COMPONENT[ \t]+trace_' ) for d in SRC_FILE_DIRS: for ( p, dlst, flst ) in os.walk( d ): for f in flst: if c_pathname_pat.match( f ) != None: src_pathname = os.path.join( p, f ) line_num = 0 for src_line in open( src_pathname, 'r' ): line_num = line_num + 1 src_line = src_line.strip() if trace_use_pat.match( src_line ) != None: component_name = trace_use_pat.sub( '', src_line ) if component_name in USED_COMPONENT: USED_COMPONENT[component_name].append( "%s:%d" % ( src_pathname, line_num ) ) else: USED_COMPONENT[component_name] = [ "%s:%d" % ( src_pathname, line_num ) ] # -------------------------------------------------------------- # Scan header file(s) defining trace macros. # trace_def_pat_opn = re.compile( '^.*FT_TRACE_DEF[ \t]*\([ \t]*' ) trace_def_pat_cls = re.compile( '[ \t\)].*$' ) for f in TRACE_DEF_FILES: line_num = 0 for hdr_line in open( f, 'r' ): line_num = line_num + 1 hdr_line = hdr_line.strip() if trace_def_pat_opn.match( hdr_line ) != None: component_name = trace_def_pat_opn.sub( '', hdr_line ) component_name = trace_def_pat_cls.sub( '', component_name ) if component_name in KNOWN_COMPONENT: print "trace component %s is defined twice, see %s and fttrace.h:%d" % \ ( component_name, KNOWN_COMPONENT[component_name], line_num ) else: KNOWN_COMPONENT[component_name] = "%s:%d" % \ ( os.path.basename( f ), line_num ) # -------------------------------------------------------------- # Compare the used and defined trace macros. # print "# Trace component used in the implementations but not defined in fttrace.h." cmpnt = USED_COMPONENT.keys() cmpnt.sort() for c in cmpnt: if c not in KNOWN_COMPONENT: print "Trace component %s (used in %s) is not defined." % ( c, ", ".join( USED_COMPONENT[c] ) ) print "# Trace component is defined but not used in the implementations." cmpnt = KNOWN_COMPONENT.keys() cmpnt.sort() for c in cmpnt: if c not in USED_COMPONENT: if c != "any": print "Trace component %s (defined in %s) is not used." % ( c, KNOWN_COMPONENT[c] )
Python
import bpy data_dictionary = '/mnt/storage/Projects/3dconomy/data/' datafile = 'us_data.txt' # datafile = 'cdn_data.txt' # datafile = 'eu_data.txt' def InitFunction(): line_data_list = [] dataset = open(data_dictionary + datafile) for line in dataset: items = line.split(",") line_data_list.append(items) dataset.close() line_data_list.sort(compare) InflateObjects(line_data_list) def compare(a, b): return cmp(float(b[1]), float(a[1])) def InflateObjects (data_set): #set red for top 10%, green for end 10%, others yellow n=len(data_set) j = n/10 m = n - j u=0 for data_segment in data_set: r=1.0 g=1.0 b=0.0 if u < j: r=1.0 g=0.0 elif u > m: r=0.0 g=1.0 print(data_segment[0]) print(data_segment[1]) #1. rename materials to state abbrev #2. mat = bpy.data.materials[data_segment[0]] #2.5 calculate the correct color for the object. #3. mat.properties['YafRay']['color'][0] = 0.3 # mat.properties['YafRay']['color'][1] = 0.3 # mat.properties['YafRay']['color'][2] = 0.3 # scale the state/prov target_object = bpy.data.objects[data_segment[0]] target_object.SizeZ = abs(float(data_segment[1])) # ok scaling is done # Get the material for the state/prov mat = bpy.data.materials[data_segment[0]] mat.properties['YafRay']['color'][0] = r mat.properties['YafRay']['color'][1] = g mat.properties['YafRay']['color'][2] = b u=u+1 # for mat in bpy.data.materials: # print (mat.name) # if mat.properties.has_key("YafRay"): # print mat.properties['YafRay']['color'][0] # print mat.properties['YafRay']['color'][1] # print mat.properties['YafRay']['color'][2] #for prop in mat.properties['YafRay']: #print prop #print prop.value InitFunction()
Python
import os, sys import OpenEXR import Imath import math import time import numpy as np from numpy import array import myextension from readEXR import * from writeEXR import * from MRF_Utils import * # this function will return the indices of the new localImage, whose area is 1.5 times bigger than the bounding box of the user chosen area, so that in main program on can do indexing quickly def localImage(labels, Nth): tmp = np.where(labels==Nth) len_X = np.amax(tmp[0]) - np.amin(tmp[0]) max_X = np.amax(tmp[0]) + len_X*1.5 min_X = np.amin(tmp[0]) - len_X*1.5 len_Y = np.amax(tmp[1]) - np.amin(tmp[1]) max_Y = np.amax(tmp[1]) + len_Y*1.5 min_Y = np.amin(tmp[1]) - len_Y*1.5 return min_X,max_X,min_Y,max_Y if __name__ == "__main__": if len(sys.argv) < 2: print "no image input" sys.exit(1) image = sys.argv[1] n_labels = 2 R,G,B,L,size = readExr(image) ######## R = np.array(R,dtype = np.double) G = np.array(G,dtype = np.double) B = np.array(B,dtype = np.double) L = np.array(L,dtype = np.double) ######## print image,size #initialisation of labels #labels = np.array(np.random.randint(n_labels,size=size),dtype=np.double) labels = np.ones(size,dtype=np.double) # sunflower #labels[115:293,(492-378):(492-327)] = 0 #labels[156:264,(492-182):(492-128)] = 0 #labels[116:303,(492-312):(492-190)] = 0 #eye.exr #labels[81:142,(185-103):(185-49)] = 0 #eye_small.exr #labels[15:29,(36-20):(36-9)] = 0 #Pixar05.exr #labels[119:205,(702-227):(702-63)] = 0 #labels[84:241,(702-139):(702-122)] = 0 #pixar.exr #labels[50:91,(146-92):(146-44)] = 0 #pixar_creation.exr #labels[552:615,(511-229):(511-190)] = 0 #vue1_samll.exr labels[1315:1432,(5616-2537):(5616-2317)] = 0 writeEXR("../../images/label0.exr",np.array(labels,dtype=np.float32).T,np.array(labels,dtype=np.float32).T,np.array(labels,dtype=np.float32).T, size) min_X,max_X,min_Y,max_Y = localImage(labels,0) localR = np.array(R[min_X:max_X+1, min_Y:max_Y+1],dtype = np.double) localG = np.array(G[min_X:max_X+1, min_Y:max_Y+1],dtype = np.double) localB = np.array(B[min_X:max_X+1, min_Y:max_Y+1],dtype = np.double) localLabels = np.array(labels[min_X:max_X+1, min_Y:max_Y+1],dtype = np.double) """ localR = R localB = B localG = G localLabels = labels """ print localR.shape, localLabels.shape print localR[0][0],localG[0][0],localB[0][0] maxflow = np.finfo(np.float64).max writeEXR("../../images/label0_local.exr",np.array(localLabels,dtype=np.float32).T,np.array(localLabels,dtype=np.float32).T,np.array(localLabels,dtype=np.float32).T, localLabels.shape) writeEXR("../../images/localRGB.exr",np.array(localR,dtype=np.float32).T,np.array(localG,dtype=np.float32).T,np.array(localB,dtype=np.float32).T, localR.shape) for k in xrange(3): inversedCovarianceMatrixArray = [] miuArray = [] lnCovarMatDet = [] covarMatrixArray = [] for i in xrange(n_labels): covarMatrix, x, y, r, g, b = featuresRGB(localR,localG,localB,localLabels,i) inversedCovarianceMatrixArray.append(np.linalg.inv(covarMatrix)) miuArray.append((x,y,r,g,b)) lnCovarMatDet.append(np.log(np.sqrt( 32* np.pi* np.pi* np.pi* np.pi* np.pi * np.linalg.det(covarMatrix)))) covarMatrixArray.append(covarMatrix) inversedCovarianceMatrixArray = np.array(inversedCovarianceMatrixArray,dtype = np.double).reshape((n_labels,5,5)) miuArray = np.array(miuArray,dtype = np.double).reshape((n_labels,5)) lnCovarMatDet = np.array(lnCovarMatDet,dtype = np.double).reshape(n_labels) flow = myextension.quickGraphCut(n_labels, localR,localG,localB, localLabels, miuArray, inversedCovarianceMatrixArray,lnCovarMatDet) if flow < maxflow: maxflow = flow else: pass #sys.exit() labels[min_X:max_X+1, min_Y:max_Y+1] = localLabels #labels = localLabels writeEXR("../../images/label"+str(k+1)+".exr",np.array(labels,dtype=np.float32).T,np.array(labels,dtype=np.float32).T,np.array(labels,dtype=np.float32).T, labels.shape)
Python
import numpy as np def positionFeature(labels, Nth): tmp = np.where(labels == Nth) return np.mean(tmp[0]),np.std(tmp[0]),np.mean(tmp[1]),np.std(tmp[1]) def colorFeature(L,labels, Nth): tmp = np.where(labels == Nth, L) return np.mean(tmp),np.std(tmp) def features( L,labels, Nth ): tmp = np.where(labels == Nth) x_pos = tmp[0] y_pos = tmp[1] col = L[np.where(labels == Nth)] return np.cov(np.vstack((x_pos,y_pos,col))),np.mean(tmp[0]),np.mean(tmp[1]),np.mean(col) def featuresRGB( R, G, B, labels, Nth ): tmp = np.where(labels == Nth) x_pos = np.array(tmp[0],dtype=np.double) y_pos = np.array(tmp[1],dtype=np.double) _R = R[tmp] _G = G[tmp] _B = B[tmp] return np.cov(np.vstack((x_pos,y_pos,_R,_G,_B))),np.mean(x_pos),np.mean(y_pos),np.mean(_R),np.mean(_G),np.mean(_B) def proba_dl_thetam(dl, miu, covarMatrix): V = np.matrix(dl - np.matrix(miu)) exp = V* np.matrix(np.linalg.inv(covarMatrix))*V.T return np.exp(-0.5*exp)/(np.power(2*np.pi,5)*np.linalg.det(covarMatrix)) def prob_m_dl(m,pi_m, dl, miuArray,covarMatrixArray): tmp1 = pi_m * proba_dl_thetam(dl,miuArray[m],covarMatrixArray[m]) if m == 0: tmp2 = pi_m * proba_dl_thetam(dl,miuArray[0],covarMatrixArray[0]) + (1-pi_m) * proba_dl_thetam(dl,miuArray[1],covarMatrixArray[1]) elif m == 1: tmp2 = (1-pi_m) * proba_dl_thetam(dl,miuArray[0],covarMatrixArray[0]) + pi_m * proba_dl_thetam(dl,miuArray[1],covarMatrixArray[1]) return float(tmp1/tmp2) def pi_m__t_plus_1(R,G,B,m,pi_m,miuArray,covarMatrixArray): pixels_count = R.shape[0]*R.shape[1] sum = 0 for x in xrange(R.shape[0]): for y in xrange(R.shape[1]): dl = np.matrix([x,y,R[x][y],G[x][y],B[x][y]]) sum = sum + prob_m_dl(m,pi_m[m], dl, miuArray,covarMatrixArray) return sum/pixels_count def miu_m__t_plus_1(R,G,B,m,pi_m,miuArray,covarMatrixArray): sum1 = np.matrix([0,0,0,0,0]) sum2 =0 for x in xrange(R.shape[0]): for y in xrange(R.shape[1]): dl = np.matrix([x,y,R[x][y],G[x][y],B[x][y]]) tmp = prob_m_dl(m,pi_m, dl, miuArray,covarMatrixArray) sum1 = sum1 + dl * tmp sum2 = sum2 + tmp return sum1/sum2 def covarMatrix_m__t_plus_1(R,G,B,m,pi_m,miuArray,covarMatrix): sum1 = np.matrix(np.zeros((5,5))) sum2 =0 for x in xrange(R.shape[0]): for y in xrange(R.shape[1]): dl = np.matrix([x,y,R[x][y],G[x][y],B[x][y]]) miu_m = np.matrix(miuArray) tmp = prob_m_dl(m,pi_m, dl, miuArray,covarMatrix) sum1 = sum1 + (dl - miu_m).T * (dl - miu_m) * tmp sum2 = sum2 + tmp return sum1/sum2
Python
import myextension import numpy as np import ctypes a = np.arange(4*3*2).reshape(4,3,2) * 5.0 b = np.arange(4*3*2).reshape(4,3,2) * 1.0 # double array ! #print myextension.MRF(a,b) a = np.arange(4*3).reshape(4,3) * 1.1 b = np.arange(4*3).reshape(4,3) * 5.2 # double array ! c = np.arange(4*3).reshape(4,3) * 10.3 print myextension.EMProcess_Test(a,b,c)
Python
import numpy as N from numpy.ctypeslib import load_library from numpyctypes import c_ndarray import ctypes as C mylib = load_library('libMRF', '../cpp/') # '.' is the directory of the C++ lib def MRF(array1, array2): arg1 = c_ndarray(array1, dtype=N.double, ndim = 3) arg2 = c_ndarray(array2, dtype=N.double, ndim = 3) return mylib.MRF(arg1, arg2) """ def quickGraphCut(n_seg, image, labelArray, miuArray, covarMatArray,lnCovarMatDet ): arg1 = C.c_int(n_seg) arg2 = c_ndarray(image, dtype = N.double, ndim = 2) arg3 = c_ndarray(labelArray, dtype = N.double, ndim = 2) arg4 = c_ndarray(miuArray, dtype = N.double, ndim = 2) arg5 = c_ndarray(covarMatArray, dtype = N.double, ndim = 3) arg6 = c_ndarray(lnCovarMatDet, dtype = N.double, ndim = 1) return mylib.quickGraphCut(arg1,arg2,arg3,arg4,arg5,arg6) """ def quickGraphCut(n_seg, R, G, B, L, labelArray, miuArray, covarMatArray,lnCovarMatDet ): arg1 = C.c_int(n_seg) arg2 = c_ndarray(R, dtype = N.double, ndim = 2) arg3 = c_ndarray(G, dtype = N.double, ndim = 2) arg4 = c_ndarray(B, dtype = N.double, ndim = 2) arg5 = c_ndarray(L, dtype = N.double, ndim = 2) arg6 = c_ndarray(labelArray, dtype = N.double, ndim = 2) arg7 = c_ndarray(miuArray, dtype = N.double, ndim = 2) arg8 = c_ndarray(covarMatArray, dtype = N.double, ndim = 3) arg9 = c_ndarray(lnCovarMatDet, dtype = N.double, ndim = 1) return mylib.quickGraphCut(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) def alphaExpansionQuickGraphCut(R, G, B, labelArray, miuArray, covarMatArray,lnCovarMatDet, activeContours ): arg1 = c_ndarray(R, dtype = N.double, ndim = 2) arg2 = c_ndarray(G, dtype = N.double, ndim = 2) arg3 = c_ndarray(B, dtype = N.double, ndim = 2) arg4 = c_ndarray(labelArray, dtype = N.double, ndim = 2) arg5 = c_ndarray(miuArray, dtype = N.double, ndim = 2) arg6 = c_ndarray(covarMatArray, dtype = N.double, ndim = 3) arg7 = c_ndarray(lnCovarMatDet, dtype = N.double, ndim = 1) arg8 = c_ndarray(activeContours, dtype = N.double, ndim = 2) return mylib.alphaExpansionQuickGraphCut(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) def EMProcess_Test( R, G, B ): arg1 = c_ndarray(R,dtype = N.double, ndim = 2) arg2 = c_ndarray(G,dtype = N.double, ndim = 2) arg3 = c_ndarray(B,dtype = N.double, ndim = 2) return mylib.EMProcess_Test(arg1,arg2,arg3) def EMProcess(pi_m, new_pi_m, R, G, B, miuArray, new_miuArray, inversedCovarianceMatrixArray, new_covarMatArray, covarMatDet): arg1 = c_ndarray(pi_m, dtype = N.double, ndim = 1) arg2 = c_ndarray(new_pi_m, dtype = N.double, ndim = 1) arg3 = c_ndarray(R, dtype = N.double, ndim = 2) arg4 = c_ndarray(G, dtype = N.double, ndim = 2) arg5 = c_ndarray(B, dtype = N.double, ndim = 2) arg6 = c_ndarray(miuArray, dtype = N.double, ndim = 2) arg7 = c_ndarray(new_miuArray, dtype = N.double, ndim = 2) arg8 = c_ndarray(inversedCovarianceMatrixArray, dtype = N.double, ndim = 3) arg9 = c_ndarray(new_covarMatArray, dtype = N.double, ndim = 3) arg10 = c_ndarray(covarMatDet, dtype = N.double, ndim = 1) mylib.EMProcess(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)
Python