Exemplo n.º 1
0
 def connectSource(self, source, pipeline):
     """Try and open video source, attach texture sink"""
     # First, create pipeline. (Which presumably is open-ended)
     if pipeline is None:
         pipeline = gstvideo.defaultPipeline(source)
     # Apply any gltexturesink params and create pipeline
     pipeline = gstvideo.configSink(self.sink, pipeline)
     self.stream = gstvideo.createPipeline(source, pipeline)
     # Get last element
     if isinstance(self.stream, gst.Bin):
         chain = [e for e in self.stream.sorted()]
         src = chain[0]
     else:
         src = self.stream
     # And try and attach to end of it
     self.stream.add(self.sink)
     try:
         src.link(self.sink)
     except:
         wx.MessageBox(_("Unable to link GLTextureSink to pipeline\n") +
                     _("Source:") + str(source) + "\n" +
                     _("Pipeline:") + str(pipeline) + "\n",
                     _("Error creating GST pipeline"),
                     wx.OK | wx.ICON_ERROR, None)
         raise RuntimeError("Unable to link GLTextureSink to pipeline")
     # We're good
     self.stream.set_state(gst.STATE_PLAYING)
Exemplo n.º 2
0
    def build_dlg(self):
        self.var_corners = IntVar(self.top)
        self.var_corners.set(10)
        label = Label(self.top, text=_("Corners"))
        label.grid(column=0, row=0, sticky=E)
        entry = Entry(self.top, width=15, textvariable=self.var_corners)
        entry.grid(column=1, row=0)

        self.var_outer_radius = StringVar(self.top)
        self.var_outer_radius.set("100pt")
        label = Label(self.top, text=_("Outer Radius"))
        label.grid(column=0, row=1, sticky=E)
        entry = Entry(self.top, width=15, textvariable=self.var_outer_radius)
        entry.grid(column=1, row=1)

        self.var_inner_radius = StringVar(self.top)
        self.var_inner_radius.set("75pt")
        label = Label(self.top, text=_("Inner Radius"))
        label.grid(column=0, row=2, sticky=E)
        entry = Entry(self.top, width=15, textvariable=self.var_inner_radius)
        entry.grid(column=1, row=2)

        button = Button(self.top, text=_("OK"), command=self.ok)
        button.grid(column=0, row=3, sticky=W)
        button = Button(self.top, text=_("Cancel"), command=self.cancel)
        button.grid(column=1, row=3, sticky=E)
Exemplo n.º 3
0
	def build_dlg(self):
		root = TFrame(self.top, style='FlatFrame', borderwidth = 10)
		root.pack(side = TOP, fill = BOTH, expand = 1)

		middle = TFrame(root, style='FlatFrame', borderwidth = 5)
		middle.pack(side = TOP, fill = X, expand = 1)
	
		label = TLabel(middle, text = _("Delete page No.:")+" ", style='FlatLabel')
		label.pack(side = LEFT)
		self.pagenum_spin = TSpinbox(middle, var=app.mw.document.active_page+1, vartype=0, textvariable = self.pagenum,
						min = 1, max = len(app.mw.document.pages), step = 1, width = 6, command = self.ok)
		self.pagenum_spin.pack(side = LEFT)
		if len(app.mw.document.pages)==1:
			self.pagenum_spin.set_state('disabled')
			

		bottom = TFrame(root, style='FlatFrame', borderwidth = 5)
		bottom.pack(side = BOTTOM, fill = X, expand = 1)
		cancel = TButton(bottom, text=_("Cancel"), command=self.cancel)
		cancel.pack(side = RIGHT)

		label = TLabel(bottom, text = '  ', style='FlatLabel')
		label.pack(side = RIGHT)
		ok = TButton(bottom, text=_("OK"), command=self.ok)
		ok.pack(side = RIGHT)
		self.focus_widget = ok
		
		self.top.bind('<Escape>', self.cancel)
		self.top.protocol('WM_DELETE_WINDOW', self.cancel)		
		self.top.resizable (width=0, height=0)
Exemplo n.º 4
0
    def build_dlg(self):
        if not self.builded:
            cmds = self.mw.commands

            b = ToolbarButton(self.panel,
                              command=cmds.Convert_to_CMYK,
                              style='Toolbutton',
                              image='context_image_cmyk')
            tooltips.AddDescription(b, _('Convert to CMYK'))
            b.pack(side=LEFT)

            b = ToolbarButton(self.panel,
                              command=cmds.Convert_to_RGB,
                              style='Toolbutton',
                              image='context_image_rgb')
            tooltips.AddDescription(b, _('Convert to RGB'))
            b.pack(side=LEFT)

            b = ToolbarButton(self.panel,
                              command=cmds.Convert_to_Grayscale,
                              style='Toolbutton',
                              image='context_image_gray')
            tooltips.AddDescription(b, _('Convert to Grayscale'))
            b.pack(side=LEFT)

            b = ToolbarButton(self.panel,
                              command=cmds.Convert_to_BW,
                              style='Toolbutton',
                              image='context_image_bw')
            tooltips.AddDescription(b, _('Convert to B&W'))
            b.pack(side=LEFT)

            self.builded = 1
Exemplo n.º 5
0
		def ColorInfo():
				if len(self.document.selection) != 1 or self.document.CanUngroup():
					fill_frame["style"] = 'ColorWatchDisabled'
					outline_frame["style"] = 'ColorWatchDisabled'
					fill_frame['background'] = app.uimanager.currentColorTheme.bg
					outline_frame['background'] = app.uimanager.currentColorTheme.bg
					return ""

				properties = self.document.CurrentProperties()
				filltxt = ''
				outlinetxt = ''
				try:
					fill_frame["style"] = 'ColorWatchNormal'
					fillcolor = rgb_to_tk(properties.fill_pattern.Color().RGB())
					fill_frame["background"] = fillcolor
					filltxt = _('Fill:') + ' ' + properties.fill_pattern.Color().toString()
				except:
					fill_frame["style"] = 'ColorWatchTransp'
					filltxt = _('Fill: None')

				try:
					outline_frame["style"] = 'ColorWatchNormal'
					outline_frame["background"] = rgb_to_tk(properties.line_pattern.Color().RGB())
					outlinetxt = _('Outline:') + ' ' + str(math.ceil(math.floor(10 ** 4 * properties.line_width / 2.83465) / 10) / 1000) + ' mm'
				except:
					outline_frame["style"] = 'ColorWatchTransp'
					outlinetxt = _('Outline: None')

				return filltxt + "\n" + outlinetxt
Exemplo n.º 6
0
class ColorManagementPanel(PrefPanel):

    name = 'color_management'
    title = _('Color Management')
    icon = 'enable_cms'
    category = 'root'
    category_name = _('root')

    def build(self):
        label = TLabel(self,
                       text=self.__class__.name,
                       font=config.preferences.large_font,
                       justify=LEFT)
        label.pack(side=TOP, fill=X)

    def init_vars(self):
        pass

    def apply(self):
        pass

    def restore(self):
        #		defaults = Preferences.__dict__
        #		items = self.__dict__.items()
        pass
 def __init__(self):
     wx.Dialog.__init__(self, None, wx.ID_ANY,
             _("Source Chooser"),
             pos=wx.DefaultPosition, size=wx.DefaultSize)
     # From top to bottom, two video sources; GStreamer pipeline; button
     vert = wx.BoxSizer(wx.VERTICAL)
     #
     row = wx.BoxSizer(wx.HORIZONTAL)
     self.left, w = self.makeSource(_("Left eye"), "Left eye", self.setLeftToFile)
     row.Add(w, 1, wx.ALIGN_LEFT | wx.EXPAND)
     self.right, w = self.makeSource(_("Right eye"), "Right eye", self.setRightToFile)
     row.Add(w, 1, wx.ALIGN_LEFT | wx.EXPAND)
     vert.Add(row, 0, wx.ALIGN_LEFT | wx.EXPAND | wx.ALL, 32)
     #
     w = wx.StaticText(self, wx.ID_ANY, _("GStreamer pipeline"))
     vert.Add(w, 0, wx.ALIGN_CENTRE)
     previous = self.getStoredList("pipeline")
     currPipe = ""
     if len(previous) == 0:
         previous = gstvideo.defaultPipes()
         self.storeList("pipeline", previous)
     else:
         idx = self.getStoredInt("pipeline")
         if isinstance(idx, int):
             currPipe = previous[idx]
     self.pipeline = wx.ComboBox(self, wx.ID_ANY, choices=previous)
     self.pipeline.SetValue(currPipe)
     vert.Add(self.pipeline, 0, wx.ALIGN_LEFT | wx.EXPAND | wx.LEFT | wx.RIGHT, 32)
     #
     self.ok = wx.Button(self, wx.ID_OK, "OK")
     self.ok.SetDefault()
     vert.Add(self.ok, 0, wx.ALIGN_CENTRE | wx.ALL, 32)
     #
     self.SetSizer(vert)
     self.Fit()
Exemplo n.º 8
0
class RendererOptionsPanel(PrefPanel):

    name = 'renderer'
    title = _('Cairo Renderer')
    icon = 'toolbar_cairo'
    category = 'root'
    category_name = _('root')

    def build(self):
        label = TLabel(self,
                       text=self.__class__.name,
                       font=config.preferences.large_font,
                       justify=LEFT)
        label.pack(side=TOP, fill=X)

    def init_vars(self):
        pass

    def apply(self):
        pass

    def restore(self):
        #		defaults = Preferences.__dict__
        #		items = self.__dict__.items()
        pass
    def InfoText(self):
	# Return a string describing the selected object(s)
        result = _("No Selection")
	if self.objects:
	    sel_info = self.objects
	    br = self.coord_rect
	    hor_sel=round((br.right - br.left)/.283465)/10
	    ver_sel=round((br.top - br.bottom)/.283465)/10
#             hor_sel=ceil(floor(10**3*(br.right - br.left)/2.83465)/10)/100
#             ver_sel=ceil(floor(10**3*(br.top - br.bottom)/2.83465)/10)/100
	    document = sel_info[0][1].document
	    if len(sel_info) == 1:
                path, obj = sel_info[0]
                dict = {'layer': document[path[0]].Name()}
		info = obj.Info()
                if type(info) == TupleType:
                    dict.update(info[1])
                    # the %% is correct here. The result has to be a
                    # %-template itself.
                    text = _("%s on `%%(layer)s'") % info[0]+"\n Selection size: "+str(hor_sel)+" x "+str(ver_sel) +" mm"###
                else:
                    dict['object'] = info
                    text = _("%(object)s on `%(layer)s'")+"\n Selection size: "+str(hor_sel)+" x "+str(ver_sel) +" mm"    ###
                result = text, dict
	    else:
		layer = sel_info[0][0][0]
		if layer == sel_info[-1][0][0]:
		    # a single layer
		    layer_name = document.layers[layer].Name()
		    result = _("%(number)d objects on `%(layer)s'") \
                             % {'number':len(sel_info), 'layer':layer_name}
	 	    result = result + "\n Selection size: "+str(hor_sel)+" x "+str(ver_sel) +" mm"
		else:
		    result = _("%d objects on several layers") % len(sel_info)+"\n Selection size: "+str(hor_sel)+" x "+str(ver_sel) +" mm"  ###
	return result
Exemplo n.º 10
0
    def build_tab_about(self):
        panel = TFrame(self.root, style='FlatFrame', borderwidth=10)
        self.nb.add(panel, text=_('About application'))

        subpanel = TFrame(panel, style='FlatFrame', borderwidth=0)
        subpanel.pack(side=TOP, fill=Y, expand=1)

        subpanel = TFrame(subpanel, style='FlatFrame', borderwidth=5)
        subpanel.pack(side=LEFT, anchor='center')

        text = TLabel(subpanel,
                      style='FlatLabel',
                      text=_("Illustration program for prepress"))
        text.pack(side=TOP, anchor=W, pady=10)

        from time import gmtime, strftime
        year = strftime("%Y", gmtime())

        text = TLabel(subpanel,
                      style='FlatLabel',
                      text="(c)2003-%s sK1 Team" % (year))
        text.pack(side=TOP, anchor=W, pady=10)

        text = TLabel(subpanel,
                      style='FlatLabel',
                      text='http://sk1project.org',
                      foreground='blue',
                      underline=20,
                      cursor='hand2')
        text.pack(side=TOP, anchor=W)
        text.bind('<Button-1>', self.goToSite)
Exemplo n.º 11
0
class FontsPanel(PrefPanel):

    name = 'fonts'
    title = _('Application fonts')
    icon = 'context_font_name'
    category = 'root'
    category_name = _('root')

    def build(self):
        label = TLabel(self,
                       text=self.__class__.name,
                       font=config.preferences.large_font,
                       justify=LEFT)
        label.pack(side=TOP, fill=X)

    def init_vars(self):
        pass

    def apply(self):
        pass

    def restore(self):
        #		defaults = Preferences.__dict__
        #		items = self.__dict__.items()
        pass
Exemplo n.º 12
0
	def build_dlg(self):
		self.var_corners = IntVar(self.top)
		self.var_corners.set(10)
		label = Label(self.top, text=_("Corners"))
		label.grid(column=0, row=0, sticky=E)
		entry = Entry(self.top, width=15, textvariable=self.var_corners)
		entry.grid(column=1, row=0)

		self.var_outer_radius = StringVar(self.top)
		self.var_outer_radius.set("100pt")
		label = Label(self.top, text=_("Outer Radius"))
		label.grid(column=0, row=1, sticky=E)
		entry = Entry(self.top, width=15, textvariable=self.var_outer_radius)
		entry.grid(column=1, row=1)

		self.var_inner_radius = StringVar(self.top)
		self.var_inner_radius.set("75pt")
		label = Label(self.top, text=_("Inner Radius"))
		label.grid(column=0, row=2, sticky=E)
		entry = Entry(self.top, width=15, textvariable=self.var_inner_radius)
		entry.grid(column=1, row=2)

		button = Button(self.top, text=_("OK"), command=self.ok)
		button.grid(column=0, row=3, sticky=W)
		button = Button(self.top, text=_("Cancel"), command=self.cancel)
		button.grid(column=1, row=3, sticky=E)
Exemplo n.º 13
0
    def ImportVector(self, filename=None):
        was_exception = False

        if not filename:
            directory = config.preferences.dir_for_vector_import
            if directory == "~":
                directory = fs.gethome()
            if not os.path.isdir(directory):
                directory = fs.gethome()
            filename, sysfilename = dialogman.getImportFilename(initialdir=directory, initialfile=filename)
            if not filename:
                return
        try:
            if not os.path.isabs(filename):
                filename = os.path.join(os.getcwd(), filename)
                ############--->
            dlg = ProgressDialog(self.mw.root, "File importing")
            doc = dlg.RunDialog(self.import_callback, filename)
            ############ <---			doc = load.load_drawing(filename)

        except SketchError, value:
            dlg.close_dlg()
            group = None
            msgDialog(self.mw.root, title=_("Import vector"), message=_("An error occurred:") + " " + str(value))
            self.mw.remove_mru_file(filename)
            was_exception = True
Exemplo n.º 14
0
 def import_callback(self, arg):
     app.updateInfo(inf1=_("File importing"), inf2=_("Start file parsing"), inf3=3)
     filename = arg[0]
     doc = load.load_drawing(filename)
     app.updateInfo(inf1=_("File importing"), inf2=_("File has been imported"), inf3=100)
     time.sleep(0.1)
     return doc
Exemplo n.º 15
0
	def init(self, master):
		PluginPanel.init(self, master)
		top = TFrame(self.panel, style='FlatFrame', borderwidth=7)
		top.pack(side = TOP, fill=BOTH)
		
		sign = TFrame(top, style='RoundedFrame', borderwidth=5)
		sign.pack(side=TOP)

		self.sign = TLabel(sign, image='color_converter')
		self.sign.pack(side=TOP)
		
		self.cs_name = StringVar(top)
		self.cs_name.set(RGB)
		
		label = TLabel(top, text=_("Colorspace:")+" ")
		label.pack(side = TOP, anchor=W)
		
		self.colorspaces = TCombobox(top, state='readonly', postcommand = self.set_cs, 
									 values=self.make_cs_list(), width=14, style='ComboNormal',
									 textvariable=self.cs_name)
		self.colorspaces.pack(side = TOP, fill=X, pady=3)
		
		button = UpdatedButton(top, text = _("Apply"),
								command = self.apply_colorspace,
								sensitivecb = self.is_selection)
		button.pack(side = BOTTOM, expand = 1, fill = X, pady=3)
		self.Subscribe(SELECTION, button.Update)
		


		self.init_from_doc()
		self.subscribe_receivers()
Exemplo n.º 16
0
    def InfoText(self):
	# Return a string describing the selected object(s)
        result = _("No Selection")
	if self.objects:
	    sel_info = self.objects
	    br = self.coord_rect
	    hor_sel=round((br.right - br.left)/.283465)/10
	    ver_sel=round((br.top - br.bottom)/.283465)/10
#             hor_sel=ceil(floor(10**3*(br.right - br.left)/2.83465)/10)/100
#             ver_sel=ceil(floor(10**3*(br.top - br.bottom)/2.83465)/10)/100
	    document = sel_info[0][1].document
	    if len(sel_info) == 1:
                path, obj = sel_info[0]
                dict = {'layer': document[path[0]].Name()}
		info = obj.Info()
                if type(info) == TupleType:
                    dict.update(info[1])
                    # the %% is correct here. The result has to be a
                    # %-template itself.
                    text = _("%s on `%%(layer)s'") % info[0]+"\n Selection size: "+str(hor_sel)+" x "+str(ver_sel) +" mm"###
                else:
                    dict['object'] = info
                    text = _("%(object)s on `%(layer)s'")+"\n Selection size: "+str(hor_sel)+" x "+str(ver_sel) +" mm"    ###
                result = text, dict
	    else:
		layer = sel_info[0][0][0]
		if layer == sel_info[-1][0][0]:
		    # a single layer
		    layer_name = document.layers[layer].Name()
		    result = _("%(number)d objects on `%(layer)s'") \
                             % {'number':len(sel_info), 'layer':layer_name}
	 	    result = result + "\n Selection size: "+str(hor_sel)+" x "+str(ver_sel) +" mm"
		else:
		    result = _("%d objects on several layers") % len(sel_info)+"\n Selection size: "+str(hor_sel)+" x "+str(ver_sel) +" mm"  ###
	return result
Exemplo n.º 17
0
async def register_chat(message: types.Message):
    chat_id = message.from_user.id
    admins = await message.chat.get_administrators()
    for admin in admins:
        if chat_id == admin.user.id:
            await message.reply(_("🏡 Добро пожаловать Домой!\n"
                                  "🏛 Перейдите пожалуйста в ЛС и укажите Ваше расположение\n"))
            exists = add_chat(message.chat.id)

            if exists:
                text = _("🏛 Ваше расположение уже было зарегистрировано. "
                         "Создайте новое расположение Вашего 🏡чата/канала\n"
                         "Для этого выберите язык чата из списка")
            else:
                text = _("🏛 Поздравляем! Ваш 🏡чат/канал ⚡️связан с ☀️Атлантидой. "
                         "Создайте расположение Вашего 🏡чата/канала\n"
                         "Для этого выберите язык чата из списка")

            language_keyboard = ListOfButtons(
                text=["English", "Русский", "Українська"],
                callback=[language_callback.new(code="en"),
                          language_callback.new(code="ru"),
                          language_callback.new(code="uk")]
            ).inline_keyboard

            await bot.send_message(chat_id, text,
                                   reply_markup=language_keyboard)
            await dp.current_state(chat=chat_id, user=chat_id).set_state(Registration.Language)
            await dp.current_state(chat=chat_id, user=chat_id).update_data(chat_id=message.chat.id)
            break
    else:
        await message.answer(_("🏛 Приносим извинения за временные неудобства. \n"
                               "В данный момент принимаются только администраторы чатов/каналов"))
        logging.info("User is not an admin")
Exemplo n.º 18
0
	def build(self):
		text = _('sK1 generates PDF file as a printing output. So as a printing target you can use any application \
which accepts PDF file on input: evince, kprinter, acroread etc. \
Printing command should contain %f symbols replaced by \
temporal PDF file name during printing.')
		label = Text(self, height=5, wrap=WORD)
		label.pack(side=TOP, anchor='nw')
		label.insert(END, text)

		frame = FlatFrame(self)
		frame.pack(side=TOP, fill=X, expand=1, pady=10)

		frame.columnconfigure(1, weight=1)

		label = Label(frame, text=_('Printing command:'), justify=LEFT)
		label.grid(column=0, row=0, sticky='w')


		combo = TCombobox(frame, state='normal', values=self.prn_commandrs, style='ComboNormal',
									 textvariable=self.var_print_command)#, width=30)
		combo.grid(column=1, row=0, sticky='we', pady=5, padx=10)

		label = Label(frame, text=_('Output PDF level:'), justify=LEFT)
		label.grid(column=0, row=1, sticky='w')


		combo = TCombobox(frame, state='readonly', values=self.levels, style='ComboNormal',
									 width=10, textvariable=self.var_pdf_level)
		combo.grid(column=1, row=1, sticky='w', pady=5, padx=10)
Exemplo n.º 19
0
 def OpenDocument(self, filename=None, directory=None):
     self.mw.root.update()
     if type(filename) == type(0):
         filename = config.preferences.mru_files[filename]
     if not filename:
         if not directory:
             directory = self.mw.document.meta.directory
         if not directory:
             directory = config.preferences.dir_for_open
         if directory == "~":
             directory = fs.gethome()
         if not os.path.isdir(directory):
             directory = fs.gethome()
         filename, sysfilename = dialogman.getOpenFilename(initialdir=directory, initialfile=filename)
         if filename == "":
             return
     try:
         if not os.path.isabs(filename):
             filename = os.path.join(os.getcwd(), filename)
         config.preferences.dir_for_open = os.path.dirname(filename)
         ############--->
         dlg = ProgressDialog(self.mw.root, "File opening")
         doc = dlg.RunDialog(self.open_callback, filename)
         ############ <---
         doc.meta.view = None
         self.SetActiveDocument(doc)
         self.mw.add_mru_file(filename)
         self.mw.canvas.ForceRedraw()
         if self.tabspanel:
             self.tabspanel.addNewTab(self.activedoc)
     except Exception, value:
         dlg.CloseDialog()
         msgDialog(self.mw.root, title=_("Open"), message=_("\nAn error occurred:\n\n") + str(value) + "\n")
         self.mw.remove_mru_file(filename)
Exemplo n.º 20
0
    def create_std_buttons(self, master, update_from=1):
        button_frame = Frame(master)

        button = Checkbutton(button_frame,
                             text=_("Auto Update"),
                             variable=self.var_auto_update)
        button.pack(side=TOP, expand=1, fill=X)

        if update_from:
            button = UpdatedButton(button_frame,
                                   text=_("Update From..."),
                                   command=self.update_from_object)
            button.pack(side=TOP, expand=1, fill=X)

        button = UpdatedButton(button_frame,
                               text=_("Apply"),
                               command=self.do_apply,
                               sensitivecb=self.can_apply)
        button.pack(side=LEFT, expand=1, fill=X)
        self.Subscribe(SELECTION, button.Update)
        button = UpdatedButton(button_frame,
                               text=_("Close"),
                               command=self.close_dlg)
        button.pack(side=RIGHT, expand=1, fill=X)

        return button_frame
Exemplo n.º 21
0
 def open_callback(self, arg):
     app.updateInfo(inf1=_("Document parsing"), inf2=_("Start document processing"), inf3=3)
     filename = arg[0]
     doc = load.load_drawing(filename)
     app.updateInfo(inf1=_("Document parsing"), inf2=_("Document has been loaded"), inf3=100)
     time.sleep(0.1)
     return doc
Exemplo n.º 22
0
    def __init__(self, parent):
        CtxSubPanel.__init__(self, parent)
        self.var_reference = StringVar(self.mw.root, 'left')
        self.var_stub = StringVar(self.mw.root)

        radio = UpdatedRadiobutton(self.panel,
                                   value='left',
                                   image='context_text_left',
                                   command=self.applyProperties,
                                   variable=self.var_reference,
                                   style='ToolbarRadiobutton')
        radio.pack(side=LEFT)
        tooltips.AddDescription(radio, _('Left alignment'))
        radio = UpdatedRadiobutton(self.panel,
                                   value='center',
                                   image='context_text_center',
                                   command=self.applyProperties,
                                   variable=self.var_reference,
                                   style='ToolbarRadiobutton')
        radio.pack(side=LEFT)
        tooltips.AddDescription(radio, _('Center alignment'))
        radio = UpdatedRadiobutton(self.panel,
                                   value='right',
                                   image='context_text_right',
                                   command=self.applyProperties,
                                   variable=self.var_reference,
                                   style='ToolbarRadiobutton')
        radio.pack(side=LEFT)
        tooltips.AddDescription(radio, _('Right alignment'))
        #		radio = UpdatedRadiobutton(self.panel, value = 'justify', image='context_text_justify_disabled',
        #								command=self.applyProperties, variable = self.var_stub, style='ToolbarRadiobutton', state='disabled')
        #		radio.pack(side=LEFT)
        #		tooltips.AddDescription(radio, _('Justify'))

        self.ReSubscribe()
Exemplo n.º 23
0
    def build(self):
        text = _(
            'sK1 generates PDF file as a printing output. So as a printing target you can use any application \
which accepts PDF file on input: evince, kprinter, acroread etc. \
Printing command should contain %f symbols replaced by \
temporal PDF file name during printing.')
        label = Text(self, height=5, wrap=WORD)
        label.pack(side=TOP, anchor='nw')
        label.insert(END, text)

        frame = FlatFrame(self)
        frame.pack(side=TOP, fill=X, expand=1, pady=10)

        frame.columnconfigure(1, weight=1)

        label = Label(frame, text=_('Printing command:'), justify=LEFT)
        label.grid(column=0, row=0, sticky='w')

        combo = TCombobox(frame,
                          state='normal',
                          values=self.prn_commandrs,
                          style='ComboNormal',
                          textvariable=self.var_print_command)  #, width=30)
        combo.grid(column=1, row=0, sticky='we', pady=5, padx=10)

        label = Label(frame, text=_('Output PDF level:'), justify=LEFT)
        label.grid(column=0, row=1, sticky='w')

        combo = TCombobox(frame,
                          state='readonly',
                          values=self.levels,
                          style='ComboNormal',
                          width=10,
                          textvariable=self.var_pdf_level)
        combo.grid(column=1, row=1, sticky='w', pady=5, padx=10)
Exemplo n.º 24
0
	def build_dlg(self):
		root = TFrame(self.top, style='FlatFrame', borderwidth = 10)
		root.pack(side = TOP, fill = BOTH, expand = 1)

		middle = TFrame(root, style='FlatFrame', borderwidth = 5)
		middle.pack(side = TOP, fill = X, expand = 1)
	
		label = TLabel(middle, text = _("Go to page No.:")+" ", style='FlatLabel')
		label.pack(side = LEFT)
		self.pagenum_spin = TSpinbox(middle, var=app.mw.document.active_page+1, vartype=0, textvariable = self.pagenum,
						min = 1, max = len(app.mw.document.pages), step = 1, width = 6, command = self.ok)
		self.pagenum_spin.pack(side = LEFT)
		if len(app.mw.document.pages)==1:
			self.pagenum_spin.set_state('disabled')
			

		bottom = TFrame(root, style='FlatFrame', borderwidth = 5)
		bottom.pack(side = BOTTOM, fill = X, expand = 1)
		cancel = TButton(bottom, text=_("Cancel"), command=self.cancel)
		cancel.pack(side = RIGHT)

		label = TLabel(bottom, text = '  ', style='FlatLabel')
		label.pack(side = RIGHT)
		ok = TButton(bottom, text=_("OK"), command=self.ok)
		ok.pack(side = RIGHT)
		self.focus_widget = ok
		
		self.top.bind('<Escape>', self.cancel)
		self.top.protocol('WM_DELETE_WINDOW', self.cancel)		
		self.top.resizable (width=0, height=0)
Exemplo n.º 25
0
	def CreateImage(self, sysfilename=None):
		if not sysfilename:
			initialdir = config.preferences.dir_for_bitmap_import
			filename, sysfilename = dialogman.getImportBMFilename(
										initialdir=initialdir, initialfile='')

		if sysfilename:
			try:
				self.canvas.commands.ForceRedraw
				fileptr = open(sysfilename, 'r')
				is_eps = eps.IsEpsFileStart(fileptr.read(256))
				fileptr.close()
				dir, name = os.path.split(filename)
				config.preferences.dir_for_bitmap_import = dir
				if is_eps:
					imageobj = eps.EpsImage(filename=sysfilename)
				else:
					imageobj = image.Image(imagefile=sysfilename)
				self.canvas.PlaceObject(imageobj)
			except IOError, value:
				if type(value) == TupleType:
					value = value[1]
				self.application.MessageBox(title=_("Load Image"),
								message=_("Cannot load %(filename)s:\n"
											"%(message)s") \
								% {'filename':`os.path.split(filename)[1]`,
									'message':value})
Exemplo n.º 26
0
	def init(self, master):
		PluginPanel.init(self, master)

		top = TFrame(self.panel, style='FlatFrame', borderwidth=5)
		top.pack(side = TOP, fill=BOTH)
		
		sign = TFrame(top, style='RoundedFrame', borderwidth=5)
		sign.pack(side = TOP)

		self.sign=TLabel(sign, image='shaping_divide')
		self.sign.pack(side=TOP)

		button = UpdatedButton(top, text = _("Apply"),
								command = self.apply_action,
								sensitivecb = self.is_correct_selection)
		button.pack(side = BOTTOM, expand = 1, fill = X)
		self.Subscribe(SELECTION, button.Update)
		
		button_frame = TFrame(top, style='FlatFrame', borderwidth=1)
		button_frame.pack(side = BOTTOM, fill=X, pady=5)
				
		self.var_originals = IntVar(top)
		self.var_originals.set(1)
		
		self.autoupdate_check = TCheckbutton(button_frame, text = _("Leave originals"), 
											variable = self.var_originals)
		self.autoupdate_check.pack(side = LEFT, anchor=W, padx=10)

		self.init_from_doc()
		self.subscribe_receivers()
Exemplo n.º 27
0
	def ok(self, *arg):		
		if not 0 <= self.pagenum_spin.get_value()-1 < len(app.mw.document.pages):
			msgDialog(self.top, title = _("Error"), message = _('Incorrect page number!'))
			self.pagenum_spin.entry.focus_set()
			return
		app.mw.document.DeletePage(self.pagenum_spin.get_value()-1)
		self.close_dlg()
Exemplo n.º 28
0
	def build_dlg(self):
		self.var_ppi = IntVar(self.top)
		self.var_ppi.set(72)
		label = Label(self.top, text=_("ppi"))
		label.grid(column=0, row=0, sticky=E)
		entry = Entry(self.top, width=15, textvariable=self.var_ppi)
		entry.grid(column=1, row=0)

		self.var_alpha = BooleanVar(self.top)
		self.var_alpha.set(1)
		label = Label(self.top, text=_("w. Transparency"))
		label.grid(column=0, row=1, sticky=E)
		entry = Checkbutton(self.top, variable=self.var_alpha)
		entry.grid(column=1, row=1)

		self.var_use_bbox = BooleanVar(self.top)
		self.var_use_bbox.set(0)
		label = Label(self.top, text=_("use BB information"))
		label.grid(column=0, row=2, sticky=E)
		entry = Checkbutton(self.top, variable=self.var_use_bbox)
		entry.grid(column=1, row=2)


		button = Button(self.top, text=_("OK"), command=self.ok)
		button.grid(column=0, row=3, sticky=W)
		button = Button(self.top, text=_("Cancel"), command=self.cancel)
		button.grid(column=1, row=3, sticky=E)
Exemplo n.º 29
0
    def build_dlg(self):
        self.var_ppi = IntVar(self.top)
        self.var_ppi.set(72)
        label = Label(self.top, text=_("ppi"))
        label.grid(column=0, row=0, sticky=E)
        entry = Entry(self.top, width=15, textvariable=self.var_ppi)
        entry.grid(column=1, row=0)

        self.var_alpha = BooleanVar(self.top)
        self.var_alpha.set(1)
        label = Label(self.top, text=_("w. Transparency"))
        label.grid(column=0, row=1, sticky=E)
        entry = Checkbutton(self.top, variable=self.var_alpha)
        entry.grid(column=1, row=1)

        self.var_use_bbox = BooleanVar(self.top)
        self.var_use_bbox.set(0)
        label = Label(self.top, text=_("use BB information"))
        label.grid(column=0, row=2, sticky=E)
        entry = Checkbutton(self.top, variable=self.var_use_bbox)
        entry.grid(column=1, row=2)

        button = Button(self.top, text=_("OK"), command=self.ok)
        button.grid(column=0, row=3, sticky=W)
        button = Button(self.top, text=_("Cancel"), command=self.cancel)
        button.grid(column=1, row=3, sticky=E)
Exemplo n.º 30
0
    def init(self, master):
        PluginPanel.init(self, master)
        top = self.panel

        grid_top = TFrame(top, borderwidth=2, style='FlatFrame')
        grid_top.pack(side=TOP, expand=1, fill=X)

        button_frame = self.create_std_buttons(top)
        button_frame.pack(side=BOTTOM, fill=BOTH, expand=1)
        # ===========================================================
        do_apply = self.do_apply

        label = TLabel(top,
                       text=" " + _("Grid origin") + " ",
                       style="FlatLabel")
        label.pack()
        frame = TLabelframe(top,
                            labelwidget=label,
                            style='Labelframe',
                            borderwidth=4)

        frame.pack(side=TOP, fill=X, pady=4, padx=2)

        f = TFrame(frame, style='FlatFrame')
        self.var_xorig = create_length_entry(top, f, do_apply)
        label = TLabel(f, text="X: ", anchor=E)
        label.pack(side=RIGHT, fill=X)
        f.pack(side=TOP, fill=X, pady=2)

        f = TFrame(frame, style='FlatFrame')
        self.var_yorig = create_length_entry(top, f, do_apply)
        label = TLabel(f, text="Y: ", anchor=E)
        label.pack(side=RIGHT, fill=X)
        f.pack(side=TOP, fill=X, pady=2)

        # ===========================================================

        label = TLabel(top, text=" " + _("Grid size") + " ", style="FlatLabel")
        label.pack()
        frame = TLabelframe(top,
                            labelwidget=label,
                            style='Labelframe',
                            borderwidth=4)
        frame.pack(side=TOP, fill=X, pady=4, padx=2)

        f = TFrame(frame, style='FlatFrame')
        self.var_xwidth = create_length_entry(top, f, do_apply)
        label = TLabel(f, text="ΔX: ", anchor=E)
        label.pack(side=RIGHT, fill=X)
        f.pack(side=TOP, fill=X, pady=2)

        f = TFrame(frame, style='FlatFrame')
        self.var_ywidth = create_length_entry(top, f, do_apply)
        label = TLabel(f, text="ΔY: ")
        label.pack(side=RIGHT, fill=X)
        f.pack(side=TOP, fill=X, pady=2)

        app.mw.docmanager.activedoc.Subscribe(GRID, self.init_from_doc)
        app.mw.Subscribe(DOCUMENT, self.init_from_doc)
        self.init_from_doc()
Exemplo n.º 31
0
	def init(self, master):
		PluginPanel.init(self, master)

		top = TFrame(self.panel, style='FlatFrame', borderwidth=5)
		top.pack(side = TOP, fill=BOTH)

		sign = TFrame(top, style='RoundedFrame', borderwidth=5)
		sign.pack(side = TOP)

		self.sign=TLabel(sign, image='shaping_trim')
		self.sign.pack(side=TOP)

		button = UpdatedButton(top, text = _("Apply"),
								command = self.apply_action,
								sensitivecb = self.is_correct_selection)
		button.pack(side = BOTTOM, expand = 1, fill = X)
		self.Subscribe(SELECTION, button.Update)
		
		button_frame = TFrame(top, style='FlatFrame', borderwidth=1)
		button_frame.pack(side = BOTTOM, fill=X, pady=5)
				
		self.var_originals = IntVar(top)
		self.var_originals.set(0)
		
		self.autoupdate_check = TCheckbutton(button_frame, text = _("Leave originals"), 
											variable = self.var_originals)
		self.autoupdate_check.pack(side = LEFT, anchor=W, padx=10)

		self.init_from_doc()
		self.subscribe_receivers()
Exemplo n.º 32
0
 def CurrentInfoText(self):
     t = self.trafo
     data = {}
     if type(t) == TrafoType:
         x = t.m11
         y = t.m22
         #if round(x, 3) == round(y, 3):
         #    text = _("Uniform Scale %(factor)[factor]")
         #    data['factor'] = x
         #else:
         br = self.coord_rect
         hor_sel = ceil(
             floor(10**3 * x * (br.right - br.left) / 2.83465) / 10) / 100
         ver_sel = ceil(
             floor(10**3 * y * (br.top - br.bottom) / 2.83465) / 10) / 100
         text = _("Scale %(factorx)[factor], %(factory)[factor]")
         text = text + "\n Changing size to: " + str(hor_sel) + " x " + str(
             ver_sel) + " mm"
         data['factorx'] = x
         data['factory'] = y
     else:
         text = _("Move %(x)[length], %(y)[length]")
         data['x'] = t.x
         data['y'] = t.y
     return text, data
Exemplo n.º 33
0
    def ImportVector(self, filename=None):
        was_exception = False

        if not filename:
            directory = config.preferences.dir_for_vector_import
            if directory == '~':
                directory = fs.gethome()
            if not os.path.isdir(directory):
                directory = fs.gethome()
            filename, sysfilename = dialogman.getImportFilename(
                initialdir=directory, initialfile=filename)
            if not filename:
                return
        try:
            if not os.path.isabs(filename):
                filename = os.path.join(os.getcwd(), filename)
            ############--->
            dlg = ProgressDialog(self.mw.root, 'File importing')
            doc = dlg.RunDialog(self.import_callback, filename)
            ############ <---			doc = load.load_drawing(filename)

        except SketchError, value:
            dlg.close_dlg()
            group = None
            msgDialog(self.mw.root,
                      title=_("Import vector"),
                      message=_("An error occurred:") + " " + str(value))
            self.mw.remove_mru_file(filename)
            was_exception = True
Exemplo n.º 34
0
 def PrintDocument(self, document, tofile=0):
     bbox = document.BoundingRect(visible=0, printable=1)
     if bbox is None:
         msgDialog(
             self.mw.root,
             title=_("Printing"),
             message=_(
                 "The document doesn't have \n any printable layers!\n"))
         return
     ############ --->
     if tofile:
         directory = config.preferences.dir_for_vector_export
         filename = document.meta.filename[:-4] + '.pdf'
         filename, pdffile = dialogman.getGenericSaveFilename(
             _("Print into PDF file"),
             pdf_types,
             initialdir=directory,
             initialfile=filename)
         if filename == '': return
         dlg = ProgressDialog(self.mw.root, 'PDF generation')
         dlg.RunDialog(self.print_tofile_callback, document, pdffile)
     else:
         dlg = ProgressDialog(self.mw.root, 'PDF generation')
         command, pdffile = dlg.RunDialog(self.print_callback, document)
         os.system(command)
Exemplo n.º 35
0
 def CurrentInfoText(self):
     if self.horizontal:
         text = _("Horizontal Guide Line at %(coord)[length]")
         dict = {'coord': self.drag_cur.y}
     else:
         text = _("Vertical Guide Line at %(coord)[length]")
         dict = {'coord': self.drag_cur.x}
     return text, dict
Exemplo n.º 36
0
	def RedoText(self):
		# Return a string to describe the operation that would be redone
		# next, in a format suitable for a menu entry.
		if self.redoinfo:
			redolabel = self.redoinfo[0][0]
			if type(redolabel) == StringType:
				return _("Redo %s") % redolabel
		return _("Redo")
Exemplo n.º 37
0
 def save_callback(self, arg):
     app.updateInfo(inf1=_('Document saving/exporting'),
                    inf2=_('Start document processing'),
                    inf3=3)
     self.SaveToFile(arg[0], arg[1], arg[2], arg[3], arg[4])
     app.updateInfo(inf2=_('Finish document processing'), inf3=100)
     time.sleep(.1)
     return None
def save(document, file, filename, options={}):
    app.updateInfo(inf1=_('PDF generation.'),
                   inf2=_('Start document composing'),
                   inf3=3)
    saver = PDFGenSaver(file, filename, document, options)
    saver.Save()
    saver.close()
    app.updateInfo(inf2=_('Document generation is finished'), inf3=100)
Exemplo n.º 39
0
 def RedoText(self):
     # Return a string to describe the operation that would be redone
     # next, in a format suitable for a menu entry.
     if self.redoinfo:
         redolabel = self.redoinfo[0][0]
         if type(redolabel) == StringType:
             return _("Redo %s") % redolabel
     return _("Redo")
Exemplo n.º 40
0
 def Info(self):
     width, height = self.data.Size()
     x, y = self.trafo.offset()
     if self.IsEmbedded():
         return _("Embedded Image %(width)d x %(height)d " "at (%(x)d, %(y)d)") % locals()
     else:
         filename = os.path.basename(self.data.Filename())
         return _("Linked Image `%(filename)s' %(width)d x %(height)d " "at (%(x)d, %(y)d)") % locals()
Exemplo n.º 41
0
	def CurrentInfoText(self):
		if self.horizontal:
			text = _("Horizontal Guide Line at %(coord)[length]")
			dict = {'coord': self.drag_cur.y}
		else:
			text = _("Vertical Guide Line at %(coord)[length]")
			dict = {'coord': self.drag_cur.x}
		return text, dict
Exemplo n.º 42
0
    def init(self, master):
        PluginPanel.init(self, master)

        self.initial_color = self.default_color
        self.current_color = copy.copy(self.initial_color)

        top = TFrame(self.panel, style='FlatFrame', borderwidth=5)
        top.pack(side=TOP, fill=BOTH)

        self.selector = ColorSpaceSelector(top, self.refresh_widgets,
                                           self.current_color, self.sign)
        self.selector.pack(side=TOP, expand=1, fill=X)

        self.picker = ColorChooserWidget(top, self.refresh_widgets,
                                         self.current_color)
        self.picker.pack(side=TOP, expand=1, fill=X)

        self.digitizer = ColorDigitizer(top, self.refresh_widgets,
                                        self.current_color)
        self.digitizer.pack(side=TOP, expand=1, fill=X)

        button = UpdatedButton(top,
                               text=_("Apply"),
                               command=self.apply_pattern,
                               sensitivecb=self.is_selection)
        button.pack(side=BOTTOM, expand=1, fill=X)
        self.Subscribe(SELECTION, button.Update)

        button_frame = TFrame(top, style='FlatFrame', borderwidth=1)
        button_frame.pack(side=BOTTOM, fill=X, pady=5)

        button = TButton(button_frame,
                         style='TSmallbutton',
                         text=' ',
                         image='small_colorpicker',
                         command=self.copy_from)
        button.pack(side=LEFT)
        tooltips.AddDescription(button, _("Copy From..."))

        button = TButton(button_frame,
                         style='TSmallbutton',
                         text=' ',
                         image='restore_color',
                         command=self.restore_color)
        button.pack(side=LEFT, padx=5)
        tooltips.AddDescription(button, _("Restore color"))

        self.var_autoupdate = IntVar(top)
        self.var_autoupdate.set(1)

        self.autoupdate_check = TCheckbutton(button_frame,
                                             text=_("Auto Update"),
                                             variable=self.var_autoupdate,
                                             command=self.init_from_doc)
        self.autoupdate_check.pack(side=RIGHT, anchor=W, padx=10)

        self.init_from_doc()
        self.subscribe_receivers()
Exemplo n.º 43
0
 def save_doc_if_edited(self, document, title=_("sK1 - Save Document...")):
     if document is not None and document.WasEdited():
         message = _("\nFile: <%s> has been changed ! \n\nDo you want to save it?\n") % document.meta.filename
         result = msgDialog(self.mw.root, title=title, message=message, buttons=msgdialog.SaveDontSaveCancel)
         self.mw.root.deiconify()
         if result == msgdialog.Save:
             self.SaveDocument(document)
         return result
     return msgdialog.No
Exemplo n.º 44
0
	def __init__(self, parent):
		CtxSubPanel.__init__(self, parent)
		
		b = TButton(self.panel, command=self.flip, style='Toolbutton', image='context_hflip')
		tooltips.AddDescription(b, _('Flip Horizontal'))
		b.pack(side = LEFT)
		b = TButton(self.panel,  command=self.flop, style='Toolbutton', image='context_vflip')
		tooltips.AddDescription(b, _('Flip Vertical'))
		b.pack(side = LEFT)
Exemplo n.º 45
0
	def __init__(self, master, dialog, **kw):
		self.dialog = dialog
		apply(TFrame.__init__, (self, master), kw)

		cancel_bt = TButton(self, text=_("Cancel"), command=self.dialog.cancel)
		cancel_bt.pack(side=RIGHT)

		ok_bt = TButton(self, text=_("OK"), command=self.dialog.ok)
		ok_bt.pack(side=RIGHT, padx=5)
Exemplo n.º 46
0
    def __init__(self, master, dialog, **kw):
        self.dialog = dialog
        apply(TFrame.__init__, (self, master), kw)

        cancel_bt = TButton(self, text=_("Cancel"), command=self.dialog.cancel)
        cancel_bt.pack(side=RIGHT)

        ok_bt = TButton(self, text=_("OK"), command=self.dialog.ok)
        ok_bt.pack(side=RIGHT, padx=5)
Exemplo n.º 47
0
	def no_pattern(self, category):
		from sk1.dialogs import styledlg
		if category == 'fill':
			title = _("No Fill")
			prop = 'fill_pattern'
		else:
			title = _("No Line")
			prop = 'line_pattern'
		styledlg.set_properties(self.root, self.document, title, category,
								{prop: EmptyPattern})
Exemplo n.º 48
0
 def Info(self):
     trafo = self.trafo
     w = hypot(trafo.m11, trafo.m21)
     h = hypot(trafo.m12, trafo.m22)
     dict = {"center": trafo.offset(), "radius": w, "axes": (w, h)}
     if w == h:
         text = _("Circle radius %(radius)[length], " "center %(center)[position]")
     else:
         text = _("Ellipse axes %(axes)[size], center %(center)[position]")
     return text, dict
Exemplo n.º 49
0
	def __init__(self, parent):
		CtxSubPanel.__init__(self, parent)
		
		b = TCommandButton(self.panel, self.mw.commands.CombineBeziers, style='Toolbutton', image='context_combine')
		b.pack(side = LEFT)
		tooltips.AddDescription(b, _('Combine'))
		
		b = TCommandButton(self.panel, self.mw.commands.SplitBeziers, style='Toolbutton', image='context_split')
		b.pack(side = LEFT)
		tooltips.AddDescription(b, _('Split'))
Exemplo n.º 50
0
	def build_dlg(self):
		if not self.builded:
			cmds = self.mw.canvas.commands.PolyBezierEditor		
			b = TButton(self.panel, command=cmds.InsertNodes.Invoke, style='Toolbutton', image='context_node_add')
			tooltips.AddDescription(b, _('Insert node'))
			b.pack(side = LEFT)
			b = TButton(self.panel, command=cmds.DeleteNodes.Invoke, style='Toolbutton', image='context_node_remove')
			tooltips.AddDescription(b, _('Remove nodes'))
			b.pack(side = LEFT)
			
			#############
			b = TLabel(self.panel, image = "toolbar_sep")
			b.pack(side = LEFT)
			
			b = TButton(self.panel, command=cmds.CloseNodes.Invoke, style='Toolbutton', image='context_node_join')
			tooltips.AddDescription(b, _('Join selected nodes'))
			b.pack(side = LEFT)
			b = TButton(self.panel, command=cmds.OpenNodes.Invoke, style='Toolbutton', image='context_node_break')
			tooltips.AddDescription(b, _('Break path at selected nodes'))
			b.pack(side = LEFT)
			
			#############
			b = TLabel(self.panel, image = "toolbar_sep")
			b.pack(side = LEFT)
						
			b = TButton(self.panel, command=cmds.ContAngle.Invoke, style='Toolbutton', image='context_node_corner')
			tooltips.AddDescription(b, _('Make selected nodes corner'))
			b.pack(side = LEFT)
			b = TButton(self.panel, command=cmds.ContSmooth.Invoke, style='Toolbutton', image='context_node_smooth')
			tooltips.AddDescription(b, _('Make selected nodes smooth'))
			b.pack(side = LEFT)
			b = TButton(self.panel, command=cmds.ContSymmetrical.Invoke, style='Toolbutton', image='context_node_symm')
			tooltips.AddDescription(b, _('Make selected nodes symmetric'))
			b.pack(side = LEFT)
						
			#############
			b = TLabel(self.panel, image = "toolbar_sep")
			b.pack(side = LEFT)			
			
			b = TButton(self.panel, command=cmds.SegmentsToLines.Invoke, style='Toolbutton', image='context_node_line')
			tooltips.AddDescription(b, _('Make selected segments lines'))
			b.pack(side = LEFT)
			b = TButton(self.panel, command=cmds.SegmentsToCurve.Invoke, style='Toolbutton', image='context_node_curve')
			tooltips.AddDescription(b, _('Make selected segments curves'))
			b.pack(side = LEFT)
			
			#############
			b = TLabel(self.panel, image = "toolbar_sep")
			b.pack(side = LEFT)	
			
			b = TButton(self.panel, command=cmds.SelectAllNodes.Invoke, style='Toolbutton', image='context_node_all')
			tooltips.AddDescription(b, _('Select all nodes in path'))
			b.pack(side = LEFT)			

			self.builded=1
Exemplo n.º 51
0
	def init(self, master):
		PluginPanel.init(self, master)

		top = TFrame(self.panel, style='FlatFrame', borderwidth=5)
		top.pack(side=TOP, fill=BOTH)

		sign = TFrame(top, style='RoundedFrame', borderwidth=5)
		sign.pack(side=TOP)

		self.sign = TLabel(sign, image='effects_blend')
		self.sign.pack(side=TOP)

		button_frame = TFrame(top, style='FlatFrame')
		button_frame.pack(side=BOTTOM, fill=BOTH, expand=1)

		self.update_buttons = []
		button = UpdatedButton(top, text=_("Apply"),
								command=self.apply_blend,
								sensitivecb=self.doc_can_blend)
		button.pack(in_=button_frame, side=LEFT, expand=1, fill=X)
		self.document.Subscribe(SELECTION, button.Update)
		self.update_buttons.append(button)


		steps_frame = TFrame(top, style='FlatFrame', borderwidth=15)
		steps_frame.pack(side=TOP)
		label = TLabel(steps_frame, text="  " + _("Steps:") + " ")
		label.pack(side=LEFT, anchor=E)

		self.var_steps = IntVar(top)
		self.var_steps.set(config.preferences.blend_panel_default_steps)

		self.entry = TSpinbox(steps_frame, var=10, vartype=0, textvariable=self.var_steps,
									min=1, max=100000, step=1, width=6, command=self.apply_blend)
		self.entry.pack(side=LEFT, anchor=E)


		button = UpdatedButton(top, text=_("Select Start"),
								sensitivecb=self.can_select,
								command=self.select_control,
								args=SelectStart)
		button.pack(side=BOTTOM, fill=X, expand=1, pady=3)
		self.document.Subscribe(SELECTION, button.Update)
		self.update_buttons.append(button)

		button = UpdatedButton(top, text=_("Select End"),
								sensitivecb=self.can_select,
								command=self.select_control,
								args=SelectEnd)
		button.pack(side=BOTTOM, fill=X, expand=1)
		self.document.Subscribe(SELECTION, button.Update)
		self.update_buttons.append(button)

		self.init_from_doc()
		self.subscribe_receivers()
Exemplo n.º 52
0
	def build_dlg(self):
		root = self.top

		top = TFrame(root, borderwidth=5, style='FlatFrame')
		top.pack(side=TOP, expand=0, fill=BOTH)

		top2 = TFrame(top, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		format_label = TLabel(top2, text=_('Style name:'), borderwidth=0)
		format_label.pack(side=LEFT, pady=3)

		self.entry_name = TEntrybox(top, command=self.ok, width=15)
		self.entry_name.pack(side=TOP, fill=X)

		top2 = TFrame(top, height=5, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		prop_cont = TLabelframe(top, text=_('Style properties'), padding=10)
		prop_cont.pack(side=TOP, fill=X)

		properties = self.object.Properties()
		self.flags = {}
		for prop in property_names:
			type = property_types[prop]
			if type == FillProperty:
				state = self.object.has_fill and NORMAL or DISABLED
			elif type == LineProperty:
				state = self.object.has_line and NORMAL or DISABLED
			elif type == FontProperty:
				state = self.object.has_font and NORMAL or DISABLED
			else:
				# unknown property type!
				continue
			long, short = property_titles[prop]
			self.flags[prop] = var = IntVar(root)
			var.set(state == NORMAL)
			radio = TCheckbutton(prop_cont, text=long, state=state, variable=var)
			radio.pack(side=TOP, anchor=W)

		top2 = TFrame(top, height=3, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		but_frame = Frame(top)
		but_frame.pack(side=TOP, fill=X)

		button = TButton(but_frame, text=_("Cancel"), command=self.cancel)
		button.pack(side=RIGHT, padx=5)
		button = TButton(but_frame, text=_("OK"), command=self.ok)
		button.pack(side=RIGHT, padx=5)

		root.resizable (width=0, height=0)

		self.entry_name.set_focus()
Exemplo n.º 53
0
	def init(self, master):
		PluginPanel.init(self, master)
		top = self.panel

		grid_top = TFrame(top, borderwidth=2, style='FlatFrame')
		grid_top.pack(side=TOP, expand=1, fill=X)

		button_frame = self.create_std_buttons(top)
		button_frame.pack(side=BOTTOM, fill=BOTH, expand=1)
# ===========================================================
		do_apply = self.do_apply

		label = TLabel(top, text=" " + _("Grid origin") + " ", style="FlatLabel")
		label.pack()
		frame = TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=4)

		frame.pack(side=TOP, fill=X, pady=4, padx=2)

		f = TFrame(frame, style='FlatFrame')
		self.var_xorig = create_length_entry(top, f, do_apply)
		label = TLabel(f, text="X: ", anchor=E)
		label.pack(side=RIGHT, fill=X)
		f.pack(side=TOP, fill=X, pady=2)


		f = TFrame(frame, style='FlatFrame')
		self.var_yorig = create_length_entry(top, f, do_apply)
		label = TLabel(f, text="Y: ", anchor=E)
		label.pack(side=RIGHT, fill=X)
		f.pack(side=TOP, fill=X, pady=2)

# ===========================================================

		label = TLabel(top, text=" " + _("Grid size") + " ", style="FlatLabel")
		label.pack()
		frame = TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=4)
		frame.pack(side=TOP, fill=X, pady=4, padx=2)

		f = TFrame(frame, style='FlatFrame')
		self.var_xwidth = create_length_entry(top, f, do_apply)
		label = TLabel(f, text="ΔX: ", anchor=E)
		label.pack(side=RIGHT, fill=X)
		f.pack(side=TOP, fill=X, pady=2)


		f = TFrame(frame, style='FlatFrame')
		self.var_ywidth = create_length_entry(top, f, do_apply)
		label = TLabel(f, text="ΔY: ")
		label.pack(side=RIGHT, fill=X)
		f.pack(side=TOP, fill=X, pady=2)

		app.mw.docmanager.activedoc.Subscribe(GRID, self.init_from_doc)
		app.mw.Subscribe(DOCUMENT, self.init_from_doc)
		self.init_from_doc()
Exemplo n.º 54
0
 def CurrentInfoText(self):
     t = self.trafo
     data = {}
     if abs(round(t.m11, 2)) == abs(round(t.m22, 2)):
         text = _("Circle %(radius)[length], center %(center)[position]")
         data["radius"] = t.m11
     else:
         text = _("Ellipse %(size)[size], center %(center)[position]")
         data["size"] = (abs(t.m11), abs(t.m22))
     data["center"] = t.offset()
     return text, data