本文整理汇总了Python中util.curr_directory函数的典型用法代码示例。如果您正苦于以下问题:Python curr_directory函数的具体用法?Python curr_directory怎么用?Python curr_directory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了curr_directory函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: updater_available
def updater_available():
if is_from_sources():
return os.path.exists(util.curr_directory() + '/toxygen_updater.py')
elif platform.system() == 'Windows':
return os.path.exists(util.curr_directory() + '/toxygen_updater.exe')
else:
return os.path.exists(util.curr_directory() + '/toxygen_updater')
开发者ID:limalayla,项目名称:toxygen,代码行数:7,代码来源:updater.py
示例2: incoming_file_transfer
def incoming_file_transfer(self, friend_number, file_number, size, file_name):
"""
New transfer
:param friend_number: number of friend who sent file
:param file_number: file number
:param size: file size in bytes
:param file_name: file name without path
"""
settings = Settings.get_instance()
friend = self.get_friend_by_number(friend_number)
auto = settings['allow_auto_accept'] and friend.tox_id in settings['auto_accept_from_friends']
inline = (file_name == 'toxygen_inline.png' or file_name == 'utox-inline.png') and settings['allow_inline']
if inline and size < 1024 * 1024:
self.accept_transfer(None, '', friend_number, file_number, size, True)
tm = TransferMessage(MESSAGE_OWNER['FRIEND'],
time.time(),
FILE_TRANSFER_MESSAGE_STATUS['INCOMING_STARTED'],
size,
file_name,
friend_number,
file_number)
elif auto:
path = settings['auto_accept_path'] or curr_directory()
if not os.path.isdir(path):
path = curr_directory()
new_file_name, i = file_name, 1
while os.path.isfile(path + '/' + new_file_name): # file with same name already exists
if '.' in file_name: # has extension
d = file_name.rindex('.')
else: # no extension
d = len(file_name)
new_file_name = file_name[:d] + ' ({})'.format(i) + file_name[d:]
i += 1
self.accept_transfer(None, path + '/' + new_file_name, friend_number, file_number, size)
tm = TransferMessage(MESSAGE_OWNER['FRIEND'],
time.time(),
FILE_TRANSFER_MESSAGE_STATUS['INCOMING_STARTED'],
size,
new_file_name,
friend_number,
file_number)
else:
tm = TransferMessage(MESSAGE_OWNER['FRIEND'],
time.time(),
FILE_TRANSFER_MESSAGE_STATUS['INCOMING_NOT_STARTED'],
size,
file_name,
friend_number,
file_number)
if friend_number == self.get_active_number():
item = self.create_file_transfer_item(tm)
if (inline and size < 1024 * 1024) or auto:
self._file_transfers[(friend_number, file_number)].set_state_changed_handler(item.update)
self._messages.scrollToBottom()
else:
friend.set_messages(True)
friend.append_message(tm)
开发者ID:SergeyDjam,项目名称:toxygen,代码行数:59,代码来源:profile.py
示例3: get_default_settings
def get_default_settings():
return {
'read': [],
'write': [],
'delete': [],
'master': [],
'folder': curr_directory(),
'folder_save': curr_directory(),
'auto_rights': 'r'
}
开发者ID:milisarge,项目名称:toxfs,代码行数:10,代码来源:settings.py
示例4: __init__
def __init__(self):
if system() == 'Windows':
self._libtoxcore = CDLL(util.curr_directory() + '/libs/libtox.dll')
elif system() == 'Darwin':
self._libtoxcore = CDLL('libtoxcore.dylib')
else:
# libtoxcore and libsodium must be installed in your os
try:
self._libtoxcore = CDLL('libtoxcore.so')
except:
self._libtoxcore = CDLL(util.curr_directory() + '/libs/libtoxcore.so')
开发者ID:limalayla,项目名称:toxygen,代码行数:11,代码来源:libtox.py
示例5: import_sm
def import_sm(self):
directory = QtGui.QFileDialog.getExistingDirectory(self,
QtGui.QApplication.translate("MainWindow",
'Choose folder with smiley pack',
None,
QtGui.QApplication.UnicodeUTF8),
curr_directory(),
QtGui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog)
if directory:
src = directory + '/'
dest = curr_directory() + '/smileys/' + os.path.basename(directory) + '/'
copy(src, dest)
开发者ID:supercoeus,项目名称:toxygen,代码行数:13,代码来源:menu.py
示例6: sound_notification
def sound_notification(t):
"""
Plays sound notification
:param t: type of notification
"""
if t == SOUND_NOTIFICATION['MESSAGE']:
f = curr_directory() + '/sounds/message.wav'
elif t == SOUND_NOTIFICATION['FILE_TRANSFER']:
f = curr_directory() + '/sounds/file.wav'
else:
f = curr_directory() + '/sounds/contact.wav'
a = AudioFile(f)
a.play()
a.close()
开发者ID:SergeyDjam,项目名称:toxygen,代码行数:14,代码来源:notifications.py
示例7: get_params
def get_params(url, version):
if is_from_sources():
return ['python3', 'toxygen_updater.py', url, version]
elif platform.system() == 'Windows':
return [util.curr_directory() + '/toxygen_updater.exe', url, version]
else:
return ['./toxygen_updater', url, version]
开发者ID:limalayla,项目名称:toxygen,代码行数:7,代码来源:updater.py
示例8: __init__
def __init__(self, text, time, user="", sent=True, message_type=TOX_MESSAGE_TYPE["NORMAL"], parent=None):
QtGui.QWidget.__init__(self, parent)
self.name = DataLabel(self)
self.name.setGeometry(QtCore.QRect(2, 2, 95, 23))
self.name.setTextFormat(QtCore.Qt.PlainText)
font = QtGui.QFont()
font.setFamily(settings.Settings.get_instance()["font"])
font.setPointSize(11)
font.setBold(True)
self.name.setFont(font)
self.name.setText(user)
self.time = QtGui.QLabel(self)
self.time.setGeometry(QtCore.QRect(parent.width() - 60, 0, 50, 25))
font.setPointSize(10)
font.setBold(False)
self.time.setFont(font)
self._time = time
if not sent:
movie = QtGui.QMovie(curr_directory() + "/images/spinner.gif")
self.time.setMovie(movie)
movie.start()
self.t = True
else:
self.time.setText(convert_time(time))
self.t = False
self.message = MessageEdit(text, parent.width() - 160, message_type, self)
if message_type != TOX_MESSAGE_TYPE["NORMAL"]:
self.name.setStyleSheet("QLabel { color: #5CB3FF; }")
self.message.setAlignment(QtCore.Qt.AlignCenter)
self.time.setStyleSheet("QLabel { color: #5CB3FF; }")
self.message.setGeometry(QtCore.QRect(100, 0, parent.width() - 160, self.message.height()))
self.setFixedHeight(self.message.height())
开发者ID:toxygen-project,项目名称:toxygen,代码行数:34,代码来源:list_items.py
示例9: import_plugin
def import_plugin(self):
import util
directory = QtGui.QFileDialog.getExistingDirectory(
self,
QtGui.QApplication.translate(
"MainWindow", "Choose folder with plugin", None, QtGui.QApplication.UnicodeUTF8
),
util.curr_directory(),
QtGui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog,
)
if directory:
src = directory + "/"
dest = curr_directory() + "/plugins/"
util.copy(src, dest)
msgBox = QtGui.QMessageBox()
msgBox.setWindowTitle(
QtGui.QApplication.translate("MainWindow", "Restart Toxygen", None, QtGui.QApplication.UnicodeUTF8)
)
msgBox.setText(
QtGui.QApplication.translate(
"MainWindow", "Plugin will be loaded after restart", None, QtGui.QApplication.UnicodeUTF8
)
)
msgBox.exec_()
开发者ID:toxygen-project,项目名称:toxygen,代码行数:25,代码来源:mainscreen.py
示例10: run
def run(self):
class AudioFile:
chunk = 1024
def __init__(self, fl):
self.stop = False
self.fl = fl
self.wf = wave.open(self.fl, 'rb')
self.p = pyaudio.PyAudio()
self.stream = self.p.open(
format=self.p.get_format_from_width(self.wf.getsampwidth()),
channels=self.wf.getnchannels(),
rate=self.wf.getframerate(),
output=True)
def play(self):
while not self.stop:
data = self.wf.readframes(self.chunk)
while data and not self.stop:
self.stream.write(data)
data = self.wf.readframes(self.chunk)
self.wf = wave.open(self.fl, 'rb')
def close(self):
self.stream.close()
self.p.terminate()
self.a = AudioFile(curr_directory() + '/sounds/call.wav')
self.a.play()
self.a.close()
开发者ID:toxygen-project,项目名称:toxygen,代码行数:30,代码来源:avwidgets.py
示例11: mouseReleaseEvent
def mouseReleaseEvent(self, event):
if event.button() == QtCore.Qt.LeftButton and self._resize_needed: # scale inline
if self._full_size:
pixmap = self._pixmap.scaled(self._max_size, self._max_size, QtCore.Qt.KeepAspectRatio)
self._image_label.setPixmap(pixmap)
self.resize(QtCore.QSize(self._max_size, pixmap.height()))
self._image_label.setGeometry(5, 0, pixmap.width(), pixmap.height())
else:
self._image_label.setPixmap(self._pixmap)
self.resize(QtCore.QSize(self._max_size, self._pixmap.height() + 17))
self._image_label.setGeometry(5, 0, self._pixmap.width(), self._pixmap.height())
self._full_size = not self._full_size
self._elem.setSizeHint(QtCore.QSize(self.width(), self.height()))
elif event.button() == QtCore.Qt.RightButton: # save inline
directory = QtGui.QFileDialog.getExistingDirectory(
self,
QtGui.QApplication.translate("MainWindow", "Choose folder", None, QtGui.QApplication.UnicodeUTF8),
curr_directory(),
QtGui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog,
)
if directory:
fl = QtCore.QFile(directory + "/toxygen_inline_" + curr_time().replace(":", "_") + ".png")
self._pixmap.save(fl, "PNG")
return False
开发者ID:toxygen-project,项目名称:toxygen,代码行数:25,代码来源:list_items.py
示例12: __init__
def __init__(self, file_name, size, user, time, width, parent=None):
super(UnsentFileItem, self).__init__(file_name, size, time, user, -1, -1,
TOX_FILE_TRANSFER_STATE['PAUSED_BY_FRIEND'], width, parent)
self._time = time
self.pb.setVisible(False)
movie = QtGui.QMovie(curr_directory() + '/images/spinner.gif')
self.time.setMovie(movie)
movie.start()
开发者ID:supercoeus,项目名称:toxygen,代码行数:8,代码来源:list_items.py
示例13: __init__
def __init__(self):
if system() == 'Linux':
# libtoxcore and libsodium must be installed in your os
self._libtoxcore = CDLL('libtoxcore.so')
elif system() == 'Windows':
self._libtoxcore = CDLL(util.curr_directory() + '/libs/libtox.dll')
else:
raise OSError('Unknown system.')
开发者ID:gourytch,项目名称:toxygen,代码行数:8,代码来源:libtox.py
示例14: copy_public_key
def copy_public_key(self):
clipboard = QtGui.QApplication.clipboard()
profile = Profile.get_instance()
clipboard.setText(profile.tox_id[:64])
pixmap = QtGui.QPixmap(curr_directory() + '/images/accept.png')
icon = QtGui.QIcon(pixmap)
self.copy_pk.setIcon(icon)
self.copy_pk.setIconSize(QtCore.QSize(10, 10))
开发者ID:supercoeus,项目名称:toxygen,代码行数:8,代码来源:menu.py
示例15: download
def download(version):
os.chdir(util.curr_directory())
url = get_url(version)
params = get_params(url, version)
print('Updating Toxygen')
util.log('Updating Toxygen')
try:
subprocess.Popen(params)
except Exception as ex:
util.log('Exception: running updater failed with ' + str(ex))
开发者ID:limalayla,项目名称:toxygen,代码行数:10,代码来源:updater.py
示例16: sticker_loader
def sticker_loader():
"""
:return list of stickers
"""
result = []
d = util.curr_directory() + '/stickers/'
keys = [x[1] for x in os.walk(d)][0]
for key in keys:
path = d + key + '/'
files = filter(lambda f: f.endswith('.png'), os.listdir(path))
files = map(lambda f: str(path + f), files)
result.extend(files)
return result
开发者ID:gourytch,项目名称:toxygen,代码行数:13,代码来源:smileys.py
示例17: initUI
def initUI(self):
self.setObjectName("privacySettings")
self.resize(370, 600)
self.setMinimumSize(QtCore.QSize(370, 600))
self.setMaximumSize(QtCore.QSize(370, 600))
self.saveHistory = QtGui.QCheckBox(self)
self.saveHistory.setGeometry(QtCore.QRect(10, 20, 350, 22))
self.saveUnsentOnly = QtGui.QCheckBox(self)
self.saveUnsentOnly.setGeometry(QtCore.QRect(10, 60, 350, 22))
self.fileautoaccept = QtGui.QCheckBox(self)
self.fileautoaccept.setGeometry(QtCore.QRect(10, 100, 350, 22))
self.typingNotifications = QtGui.QCheckBox(self)
self.typingNotifications.setGeometry(QtCore.QRect(10, 140, 350, 30))
self.inlines = QtGui.QCheckBox(self)
self.inlines.setGeometry(QtCore.QRect(10, 180, 350, 30))
self.auto_path = QtGui.QLabel(self)
self.auto_path.setGeometry(QtCore.QRect(10, 230, 350, 30))
self.path = QtGui.QPlainTextEdit(self)
self.path.setGeometry(QtCore.QRect(10, 265, 350, 45))
self.change_path = QtGui.QPushButton(self)
self.change_path.setGeometry(QtCore.QRect(10, 320, 350, 30))
settings = Settings.get_instance()
self.typingNotifications.setChecked(settings['typing_notifications'])
self.fileautoaccept.setChecked(settings['allow_auto_accept'])
self.saveHistory.setChecked(settings['save_history'])
self.inlines.setChecked(settings['allow_inline'])
self.saveUnsentOnly.setChecked(settings['save_unsent_only'])
self.saveUnsentOnly.setEnabled(settings['save_history'])
self.saveHistory.stateChanged.connect(self.update)
self.path.setPlainText(settings['auto_accept_path'] or curr_directory())
self.change_path.clicked.connect(self.new_path)
self.block_user_label = QtGui.QLabel(self)
self.block_user_label.setGeometry(QtCore.QRect(10, 360, 350, 30))
self.block_id = QtGui.QPlainTextEdit(self)
self.block_id.setGeometry(QtCore.QRect(10, 390, 350, 30))
self.block = QtGui.QPushButton(self)
self.block.setGeometry(QtCore.QRect(10, 430, 350, 30))
self.block.clicked.connect(lambda: Profile.get_instance().block_user(self.block_id.toPlainText()) or self.close())
self.blocked_users_label = QtGui.QLabel(self)
self.blocked_users_label.setGeometry(QtCore.QRect(10, 470, 350, 30))
self.comboBox = QtGui.QComboBox(self)
self.comboBox.setGeometry(QtCore.QRect(10, 500, 350, 30))
self.comboBox.addItems(settings['blocked'])
self.unblock = QtGui.QPushButton(self)
self.unblock.setGeometry(QtCore.QRect(10, 540, 350, 30))
self.unblock.clicked.connect(lambda: self.unblock_user())
self.retranslateUi()
QtCore.QMetaObject.connectSlotsByName(self)
开发者ID:supercoeus,项目名称:toxygen,代码行数:50,代码来源:menu.py
示例18: load_avatar
def load_avatar(self):
"""
Tries to load avatar of contact or uses default avatar
"""
avatar_path = '{}.png'.format(self._tox_id[:TOX_PUBLIC_KEY_SIZE * 2])
os.chdir(ProfileHelper.get_path() + 'avatars/')
if not os.path.isfile(avatar_path): # load default image
avatar_path = 'avatar.png'
os.chdir(curr_directory() + '/images/')
pixmap = QtGui.QPixmap(QtCore.QSize(64, 64))
pixmap.load(avatar_path)
self._widget.avatar_label.setScaledContents(False)
self._widget.avatar_label.setPixmap(pixmap.scaled(64, 64, QtCore.Qt.KeepAspectRatio))
self._widget.avatar_label.repaint()
开发者ID:SergeyDjam,项目名称:toxygen,代码行数:14,代码来源:profile.py
示例19: __init__
def __init__(self):
self.path = curr_directory() + '/settings.json'
if os.path.isfile(self.path):
with open(self.path) as fl:
data = fl.read()
super(self.__class__, self).__init__(json.loads(data))
else:
super(self.__class__, self).__init__(Settings.get_default_settings())
self['read'] = map(lambda x: x[:TOX_PUBLIC_KEY_SIZE * 2], set(self['read']))
self['write'] = map(lambda x: x[:TOX_PUBLIC_KEY_SIZE * 2], set(self['write']))
self['delete'] = map(lambda x: x[:TOX_PUBLIC_KEY_SIZE * 2], set(self['delete']))
self['master'] = map(lambda x: x[:TOX_PUBLIC_KEY_SIZE * 2], set(self['master']))
if self['folder'][-1] == '/' or self['folder'][-1] == '\\':
self['folder'] = self['folder'][:-1]
self.save()
开发者ID:ingvar1995,项目名称:filebot,代码行数:15,代码来源:settings.py
示例20: closeEvent
def closeEvent(self, event):
settings = Settings.get_instance()
style = str(self.themeSelect.currentText())
settings['theme'] = style
QtGui.QApplication.setStyle(get_style(style))
language = self.lang_choose.currentText()
if settings['language'] != language:
settings['language'] = language
index = self.lang_choose.currentIndex()
path = Settings.supported_languages()[index][1]
app = QtGui.QApplication.instance()
app.removeTranslator(app.translator)
app.translator.load(curr_directory() + '/translations/' + path)
app.installTranslator(app.translator)
settings.save()
开发者ID:SergeyDjam,项目名称:toxygen,代码行数:15,代码来源:menu.py
注:本文中的util.curr_directory函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论