当前位置: 首页>>代码示例>>Python>>正文


Python sk1._函数代码示例

本文整理汇总了Python中sk1._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: save_selected

	def save_selected(self):
		doc_file = '' + self.current_doc.doc_file
		if not doc_file:
			doc_file = '' + self.current_doc.doc_name
		if not os.path.splitext(doc_file)[1] == "." + \
					uc2const.FORMAT_EXTENSION[uc2const.SK2][0]:
			doc_file = os.path.splitext(doc_file)[0] + "." + \
					uc2const.FORMAT_EXTENSION[uc2const.SK2][0]
		if not os.path.lexists(os.path.dirname(doc_file)):
			doc_file = os.path.join(config.save_dir,
								os.path.basename(doc_file))
		doc_file = dialogs.get_save_file_name(self.mw, self, doc_file,
							_('Save selected objects only as...'),
							path_only=True)
		if doc_file:
			try:
				self.make_backup(doc_file)
				self.current_doc.save_selected(doc_file)
				self.history.add_entry(doc_file, appconst.SAVED)
			except:
				first = _('Cannot save document:')
				msg = ("%s\n'%s'.") % (first, doc_file) + '\n'
				msg += _('Please check requested file format and write permissions')
				dialogs.error_dialog(self.mw, self.appdata.app_name, msg)
				self.print_stacktrace()
开发者ID:sk1project,项目名称:sk1-wx,代码行数:25,代码来源:application.py

示例2: stroke_selected

	def stroke_selected(self, color):
		doc = self.app.current_doc
		canvas = doc.canvas
		if canvas.mode in modes.EDIT_MODES and canvas.controller.target:
			doc.api.stroke_selected(color, [canvas.controller.target, ])
		elif not doc.selection.objs:
			txt = _('Do you wish to change default stroke color for this document?')
			txt += '\n'
			txt += _('This style will be applied to newly created objects.')
			title = self.app.appdata.app_name
			if dialogs.yesno_dialog(self.mw, title, txt):
				new_style = doc.model.get_def_style()
				if color:
					if new_style[1]:
						new_style[1][2] = deepcopy(color)
					else:
						new_style[1] = [sk2_const.STROKE_MIDDLE,
									0.1 * uc2const.mm_to_pt,
									deepcopy(color), [], sk2_const.CAP_BUTT,
									sk2_const.JOIN_MITER,
									1.0 / math.sin(45.0 / 2.0),
									0, 0, []
									]
				else:
					new_style[1] = []
				doc.api.set_default_style(new_style)
		else:
			doc.api.stroke_selected(color)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:28,代码来源:app_proxy.py

示例3: __init__

	def __init__(self, parent, dlg, cms, pattern_def, onchange=None):
		self.dlg = dlg
		self.app = dlg.app
		self.cms = cms
		self.pattern_def = deepcopy(pattern_def)
		self.callback = onchange
		wal.HPanel.__init__(self, parent)
		left_panel = wal.VPanel(self)
		self.pattern_swatch = PatternSwatch(left_panel, self.cms, pattern_def)
		left_panel.pack(self.pattern_swatch)

		button_panel = wal.HPanel(left_panel)
		txt = _('Load pattern from file')
		button_panel.pack(wal.ImageButton(self, icons.PD_OPEN, wal.SIZE_16,
				tooltip=txt, flat=False, onclick=self.load_pattern),
				padding=1)
		txt = _('Save pattern into file')
		button_panel.pack(wal.ImageButton(self, icons.PD_FILE_SAVE, wal.SIZE_16,
				tooltip=txt, flat=False, onclick=self.save_pattern),
				padding=1)
		left_panel.pack(button_panel, padding=2)

		self.pack(left_panel, fill=True)

		right_panel = wal.VPanel(self)

		self.pattern_color_editor = PatternColorEditor(right_panel, dlg, cms,
								pattern_def[2], onchange=self.color_changed)
		right_panel.pack(self.pattern_color_editor, padding=5)

		self.trafo_editor = PatternTrafoEditor(right_panel, dlg.app,
											onchange=self.trafo_changed)
		right_panel.pack(self.trafo_editor, padding=5)

		self.pack(right_panel, fill=True, expand=True)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:35,代码来源:patternctrls.py

示例4: save

	def save(self, doc=''):
		if not doc:
			doc = self.current_doc
		if not doc.doc_file:
			return self.save_as()
		ext = os.path.splitext(self.current_doc.doc_file)[1]
		if not ext == "." + uc2const.FORMAT_EXTENSION[uc2const.SK2][0]:
			return self.save_as()
		if not os.path.lexists(os.path.dirname(self.current_doc.doc_file)):
			return self.save_as()

		try:
			self.make_backup(self.current_doc.doc_file)
			doc.save()
			self.history.add_entry(self.current_doc.doc_file, appconst.SAVED)
			events.emit(events.DOC_SAVED, doc)
		except:
			msg = _('Cannot save file')
			msg = "%s '%s'" % (msg, self.current_doc.doc_file) + '\n'
			msg += _('Please check file write permissions')
			dialogs.error_dialog(self.mw, self.appdata.app_name, msg)
			self.print_stacktrace()
			return False
		events.emit(events.APP_STATUS, _('Document saved'))
		return True
开发者ID:Scrik,项目名称:sk1-wx,代码行数:25,代码来源:application.py

示例5: close

	def close(self, doc=None):
		if not self.docs: return
		if doc is None: doc = self.current_doc
		if not doc == self.current_doc: self.set_current_doc(doc)

		if self.insp.is_doc_not_saved(doc):
			msg = _("Document '%s' has been modified.") % (doc.doc_name) + '\n'
			msg += _('Do you want to save your changes?')
			ret = dialogs.ync_dialog(self.mw, self.appdata.app_name, msg)

			if ret is None: return False
			if ret:
				if not self.save(): return False

		if doc in self.docs:
			self.docs.remove(doc)
			doc.close()
			events.emit(events.DOC_CLOSED)
			if not len(self.docs):
				self.current_doc = None
				events.emit(events.NO_DOCS)
				msg = _('To start create new or open existing document')
				events.emit(events.APP_STATUS, msg)
				self.mw.set_title()
			else:
				self.set_current_doc(self.docs[-1])
		return True
开发者ID:Scrik,项目名称:sk1-wx,代码行数:27,代码来源:application.py

示例6: build

	def build(self):
		self.metainfo = deepcopy(self.doc.model.metainfo)
		if self.metainfo[3]: self.metainfo[3] = b64decode(self.metainfo[3])

		grid = wal.GridPanel(self, 4, 2, 5, 5)
		grid.add_growable_col(1)
		grid.add_growable_row(3)

		grid.pack(wal.Label(grid, _('Author:')))
		self.author_field = wal.Entry(grid, '' + self.metainfo[0])
		grid.pack(self.author_field, fill=True)

		grid.pack(wal.Label(grid, _('License:')))
		self.license_field = wal.Entry(grid, '' + self.metainfo[1])
		grid.pack(self.license_field, fill=True)

		grid.pack(wal.Label(grid, _('Keywords:')))
		self.keys_field = wal.Entry(grid, '' + self.metainfo[2])
		grid.pack(self.keys_field, fill=True)

		grid.pack(wal.Label(grid, _('Notes:')))
		self.notes_field = wal.Entry(grid, '' + self.metainfo[3], multiline=True)
		grid.pack(self.notes_field, fill=True)

		self.pack(grid, fill=True, expand=True, padding_all=5)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:25,代码来源:docprops.py

示例7: __init__

	def __init__(self, parent, app):
		self.app = app
		wal.LabeledPanel.__init__(self, parent, _('Align'))

		self.pack((5, 5))
		self.pack(wal.Label(self, _('Relative to:')))
		self.source = wal.Combolist(self, items=SOURCE_NAMES,
								onchange=self.update)
		self.pack(self.source, padding_all=5, fill=True)
		self.pack((5, 5))

		self.halign = wal.HToggleKeeper(self, H_ALIGN_MODES,
								H_ALIGN_MODE_ICONS, H_ALIGN_MODE_NAMES,
								on_change=self.update, allow_none=True)
		self.pack(self.halign)
		self.halign.set_mode(ALIGN_CENTER)

		self.valign = wal.HToggleKeeper(self, V_ALIGN_MODES,
								V_ALIGN_MODE_ICONS, V_ALIGN_MODE_NAMES,
								on_change=self.update, allow_none=True)
		self.pack(self.valign, padding_all=5)
		self.valign.set_mode(ALIGN_CENTER)

		self.group = wal.Checkbox(self, _('Selection as group'), True,
								onclick=self.update)
		self.pack(self.group, padding_all=5)

		self.apply_btn = wal.Button(self, _('Apply'), onclick=self.action)
		self.pack(self.apply_btn, padding_all=5, fill=True)
开发者ID:Scrik,项目名称:sk1-wx,代码行数:29,代码来源:__init__.py

示例8: __init__

	def __init__(self, parent, printer, app):
		self.app = app
		self.printer = printer
		wal.LabeledPanel.__init__(self, parent, _('Paper'))

		grid = wal.GridPanel(self, 2, 2, 5, 5)
		grid.add_growable_col(1)

		grid.pack(wal.Label(grid, _('Page size:')))

		self.size_combo = wal.Combolist(grid, onchange=self.on_change)
		grid.pack(self.size_combo, fill=True)

		grid.pack(wal.Label(grid, _('Width:')))

		hpanel = wal.HPanel(grid)

		self.wspin = StaticUnitSpin(self.app, hpanel)
		hpanel.pack(self.wspin)
		hpanel.pack(StaticUnitLabel(self.app, hpanel), padding=5)

		hpanel.pack((5, 5))

		hpanel.pack(wal.Label(grid, _('Height:')), padding=5)

		self.hspin = StaticUnitSpin(self.app, hpanel)
		hpanel.pack(self.hspin)
		hpanel.pack(StaticUnitLabel(self.app, hpanel), padding=5)

		grid.pack(hpanel)

		self.pack(grid, fill=True, expand=True, padding_all=10)

		self.set_data()
开发者ID:sk1project,项目名称:sk1-wx,代码行数:34,代码来源:cupspropsdlg.py

示例9: __init__

	def __init__(self, parent, printer, app):
		self.printer = printer
		self.app = app
		wal.LabeledPanel.__init__(self, parent, _('Document metainfo'))

		grid = wal.GridPanel(self, 4, 2, 2, 5)
		grid.add_growable_col(1)

		grid.pack(wal.Label(grid, _('Title:')))
		self.title = wal.Entry(grid, self.printer.meta_title)
		grid.pack(self.title, fill=True)

		grid.pack(wal.Label(grid, _('Subject:')))
		self.subject = wal.Entry(grid, self.printer.meta_subject)
		grid.pack(self.subject, fill=True)

		grid.pack(wal.Label(grid, _('Author:')))
		self.author = wal.Entry(grid, self.printer.meta_author)
		grid.pack(self.author, fill=True)

		grid.pack(wal.Label(grid, _('Keywords:')))
		self.keywords = wal.Entry(grid, self.printer.meta_keywords)
		grid.pack(self.keywords, fill=True)

		self.pack(grid, fill=True, expand=True, padding_all=7)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:25,代码来源:pdfpropsdlg.py

示例10: set_dialog_buttons

	def set_dialog_buttons(self):
		PrnProsDialog.set_dialog_buttons(self)
		self.import_btn = wal.Button(self.left_button_box, _('Set metainfo'),
							tooltip=_('Set metainfo from current document'),
							onclick=self.main_panel.doc_info.import_data)
		self.left_button_box.pack(self.import_btn)
		self.import_btn.set_enable(self.main_panel.doc_info.is_metadata())
开发者ID:sk1project,项目名称:sk1-wx,代码行数:7,代码来源:pdfpropsdlg.py

示例11: __init__

    def __init__(self, parent, dlg, cms, stops, sel_stop=0, onposition=None, oncolor=None):
        self.dlg = dlg
        self.cms = cms
        self.stops = stops
        self.selected_stop = sel_stop
        self.pos_callback = onposition
        self.color_callback = oncolor
        wal.LabeledPanel.__init__(self, parent, text=_("Gradient stop"))
        grid = wal.GridPanel(self, cols=3, vgap=5, hgap=5)

        grid.pack(wal.Label(grid, _("Color value:")))

        clr = self.stops[self.selected_stop][1]
        txt = _("Change stop color")
        self.swatch = PDColorButton(grid, self.dlg, self.cms, clr, txt, onchange=self.edit_color)
        grid.pack(self.swatch)
        grid.pack((1, 1))

        grid.pack(wal.Label(grid, _("Position:")))
        self.position = wal.FloatSpin(
            grid, range_val=(0.0, 100.0), step=1.0, onchange=self.pos_changed, onenter=self.pos_changed
        )
        grid.pack(self.position)
        grid.pack(wal.Label(grid, "%"))
        self.pack(grid, align_center=False, padding_all=10)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:25,代码来源:gradientctrls.py

示例12: set_selected_nodes

	def set_selected_nodes(self, points=[], add_flag=False):
		if points: self.new_node = None
		if not add_flag:
			for item in self.selected_nodes:
				item.selected = False
			self.selected_nodes = []
		for item in points:
			if item.is_start() and item.path.is_closed():
				continue
			if item.selected and item in self.selected_nodes:
				item.selected = False
				self.selected_nodes.remove(item)
			else:
				item.selected = True
				self.selected_nodes.append(item)
		if len(self.selected_nodes) == 1:
			self.create_control_points()
		else:
			self.clear_control_points()
		events.emit(events.SELECTION_CHANGED, self.presenter)
		msg = _('No selected nodes')
		if self.selected_nodes:
			msg = _('Selected %d node(s)') % len(self.selected_nodes)
		events.emit(events.APP_STATUS, msg)
		self.canvas.selection_redraw()
开发者ID:Scrik,项目名称:sk1-wx,代码行数:25,代码来源:editor_bezier.py

示例13: _get_open_filters

def _get_open_filters(items=[]):
	wildcard = ''
	descr = uc2const.FORMAT_DESCRIPTION
	ext = uc2const.FORMAT_EXTENSION
	if not items:
		items = [] + data.LOADER_FORMATS
	wildcard += _('All supported formats') + '|'
	for item in items:
		for extension in ext[item]:
			wildcard += '*.' + extension + ';'
			wildcard += '*.' + extension.upper() + ';'
	if is_mac():return wildcard

	wildcard += '|'

	wildcard += _('All files (*.*)') + '|'
	wildcard += '*;*.*|'

	for item in items:
		wildcard += descr[item] + '|'
		for extension in ext[item]:
			wildcard += '*.' + extension + ';'
			wildcard += '*.' + extension.upper() + ';'
		if not item == items[-1]:
			wildcard += '|'

	return wildcard
开发者ID:sk1project,项目名称:sk1-wx,代码行数:27,代码来源:filedlgs.py

示例14: __init__

	def __init__(self, parent, prefpanel):
		CMS_Tab.__init__(self, parent, prefpanel)
		txt = _('Activate Color Management')
		panel = wal.VPanel(self)
		hp = wal.HPanel(panel)
		self.cms_check = wal.Checkbox(hp, txt, config.cms_use,
									onclick=self.activate_cms)


		hp.pack(self.cms_check)
		panel.pack(hp, fill=True, padding_all=3)



		self.banner = wal.VPanel(panel)
		self.banner.set_bg(wal.DARK_GRAY)
		bmp = get_bmp(self.banner, icons.PD_PREFS_CMS_BANNER)
		self.banner.pack(bmp, padding=2)
		panel.pack(self.banner, expand=True, fill=True)
		txt = _('Note: If Color Management is not activated all colors '
			'will be processed using simple calculation procedures. Therefore '
			'resulted color values will be not accurate.')
		fontsize = -3
		if wal.is_msw(): fontsize = -1
		label = wal.Label(self, txt, fontsize=fontsize)
		label.set_enable(False)
		if wal.is_msw():label.wrap(430)
		panel.pack(label, fill=True, padding_all=5)
		self.pack(panel, fill=True, expand=True)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:29,代码来源:prefs_cms.py

示例15: update_val

	def update_val(self):
		text = _('Fill:')
		if self.non_solid:
			pass
		elif self.colorspace is None:
			text += ' ' + _('None')
		else:
			if self.colorspace == uc2const.COLOR_CMYK:
				c, m, y, k = self.color
				text += ' C-%d%% M-%d%% Y-%d%% K-%d%%' % (c * 100, m * 100,
														 y * 100, k * 100)
			elif self.colorspace == uc2const.COLOR_RGB:
				r, g, b = self.color
				text += ' R-%d G-%d B-%d' % (r * 255, g * 255, b * 255)
			elif self.colorspace == uc2const.COLOR_LAB:
				l, a, b = self.color
				text += ' L-%d a-%d b-%d' % (l * 255, a * 255, b * 255)
			elif self.colorspace == uc2const.COLOR_GRAY:
				gray, = self.color
				text += ' gray-%d' % (gray * 255)
			elif self.colorspace == uc2const.COLOR_SPOT:
				text += ' %s' % (self.color_name)
			else:
				pass

			if self.alpha < 1.0:
				if self.colorspace == uc2const.COLOR_CMYK:
					alpha = int(round(self.alpha * 100))
					text += ' A-%d%%' % (alpha)
				else:
					alpha = int(round(self.alpha * 255))
					text += ' A-%d' % (alpha)

		self.set_text(text)
开发者ID:sk1project,项目名称:sk1-gtk2,代码行数:34,代码来源:color_monitor.py


注:本文中的sk1._函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。